Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ef17d45 authored by Veera Sundaram Sankaran's avatar Veera Sundaram Sankaran
Browse files

msm: mdss: add additional ubwc data checks



In the current scenario, when the sizes of data plane 0 and
the plane 0 matches, the data plane configuration is skipped
to avoid configuring it all the time. Add additional checks
when we skip the configuration to make sure all the data
planes are configured correctly.

Change-Id: Ife7def6d97933732469c14f053b81da9d7661731
Signed-off-by: default avatarVeera Sundaram Sankaran <veeras@codeaurora.org>
parent 1a5da77f
Loading
Loading
Loading
Loading
+21 −5
Original line number Original line Diff line number Diff line
@@ -667,7 +667,7 @@ static int mdss_mdp_ubwc_data_check(struct mdss_mdp_data *data,
			struct mdss_mdp_plane_sizes *ps,
			struct mdss_mdp_plane_sizes *ps,
			struct mdss_mdp_format_params *fmt)
			struct mdss_mdp_format_params *fmt)
{
{
	int rc = 0;
	int i, inc;
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	unsigned long data_size = 0;
	unsigned long data_size = 0;
	dma_addr_t base_addr;
	dma_addr_t base_addr;
@@ -675,7 +675,7 @@ static int mdss_mdp_ubwc_data_check(struct mdss_mdp_data *data,
	if (!mdss_mdp_is_ubwc_supported(mdata)) {
	if (!mdss_mdp_is_ubwc_supported(mdata)) {
		pr_err("ubwc format is not supported for format: %d\n",
		pr_err("ubwc format is not supported for format: %d\n",
			fmt->format);
			fmt->format);
		goto end;
		return -ENOTSUPP;
	}
	}


	if (data->p[0].len == ps->plane_size[0])
	if (data->p[0].len == ps->plane_size[0])
@@ -686,8 +686,7 @@ static int mdss_mdp_ubwc_data_check(struct mdss_mdp_data *data,
	if (data_size < ps->total_size) {
	if (data_size < ps->total_size) {
		pr_err("insufficient current mem len=%lu required mem len=%u\n",
		pr_err("insufficient current mem len=%lu required mem len=%u\n",
		       data_size, ps->total_size);
		       data_size, ps->total_size);
		rc = -ENOMEM;
		return -ENOMEM;
		goto end;
	}
	}


	base_addr = data->p[0].addr;
	base_addr = data->p[0].addr;
@@ -757,8 +756,25 @@ static int mdss_mdp_ubwc_data_check(struct mdss_mdp_data *data,
		data->p[2].len = ps->plane_size[2];
		data->p[2].len = ps->plane_size[2];
	}
	}
	data->num_planes = ps->num_planes;
	data->num_planes = ps->num_planes;

end:
end:
	return rc;
	if (data->num_planes != ps->num_planes) {
		pr_err("num_planes don't match: fmt:%d, data:%d, ps:%d\n",
				fmt->format, data->num_planes, ps->num_planes);
		return -EINVAL;
	}

	inc = ((fmt->format == MDP_Y_CBCR_H2V2_UBWC) ? 1 : 2);
	for (i = 0; i < MAX_PLANES; i += inc) {
		if (data->p[i].len != ps->plane_size[i]) {
			pr_err("plane:%d fmt:%d, len does not match: data:%lu, ps:%d\n",
					i, fmt->format, data->p[i].len,
					ps->plane_size[i]);
			return -EINVAL;
		}
	}

	return 0;
}
}


int mdss_mdp_data_check(struct mdss_mdp_data *data,
int mdss_mdp_data_check(struct mdss_mdp_data *data,