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

Commit c19ac773 authored by Terence Hampson's avatar Terence Hampson
Browse files

msm: mdss: correct ubwc total plane size calc and usage



Total plane size was not calculated properly for ubwc formats.
Additional the value that this was compared against was also
not calculated properly. This change fixes some minor issues
in data validation.

Change-Id: I0a925f4824bf084e4a7465ecc650ea93936e8f68
Signed-off-by: default avatarTerence Hampson <thampson@codeaurora.org>
parent f34a3ba0
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -654,7 +654,8 @@ int mdss_mdp_get_plane_sizes(struct mdss_mdp_format_params *fmt, u32 w, u32 h,
		}
	}

	for (i = 0; i < ps->num_planes; i++)
	/* Safe to use MAX_PLANES as ps is memset at start of function */
	for (i = 0; i < MAX_PLANES; i++)
		ps->total_size += ps->plane_size[i];

	return rc;
@@ -664,7 +665,7 @@ static int mdss_mdp_ubwc_data_check(struct mdss_mdp_data *data,
			struct mdss_mdp_plane_sizes *ps,
			struct mdss_mdp_format_params *fmt)
{
	int i, rc = 0;
	int rc = 0;
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	unsigned long data_size = 0;
	dma_addr_t base_addr;
@@ -675,9 +676,11 @@ static int mdss_mdp_ubwc_data_check(struct mdss_mdp_data *data,
		goto end;
	}

	for (i = 0; i < MAX_PLANES; i++)
		data_size += data->p[i].len;
	if (data->p[0].len == ps->plane_size[0])
		goto end;

	/* From this point, assumption is plane 0 is to be divided */
	data_size = data->p[0].len;
	if (data_size < ps->total_size) {
		pr_err("insufficient current mem len=%lu required mem len=%u\n",
		       data_size, ps->total_size);
@@ -685,9 +688,6 @@ static int mdss_mdp_ubwc_data_check(struct mdss_mdp_data *data,
		goto end;
	}

	if (data->p[0].len == ps->plane_size[0])
		goto end;

	base_addr = data->p[0].addr;

	if (fmt->format == MDP_Y_CBCR_H2V2_UBWC) {