From 5c51cd9cfd34d8ce425123b35cbf1a347481d877 Mon Sep 17 00:00:00 2001 From: Jayaprakash Madisetty Date: Wed, 16 Feb 2022 22:15:34 +0530 Subject: [PATCH] disp: msm: sde: update alignment check for dest WB fb This changes takes pitches into account for alignment check of destination writeback fb. As per HW recommendation the stride needs to be a multiple of 256 bits. Change-Id: Ib823a8d309f7ed579d701a4bf56772ce318fb1f5 Signed-off-by: Jayaprakash Madisetty --- msm/sde/sde_encoder_phys_wb.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/msm/sde/sde_encoder_phys_wb.c b/msm/sde/sde_encoder_phys_wb.c index f993d528fa..af53f83987 100644 --- a/msm/sde/sde_encoder_phys_wb.c +++ b/msm/sde/sde_encoder_phys_wb.c @@ -838,7 +838,7 @@ static int _sde_enc_phys_wb_validate_cwb(struct sde_encoder_phys *phys_enc, struct sde_rect wb_roi = {0,}, pu_roi = {0,}; u32 out_width = 0, out_height = 0; const struct sde_format *fmt; - int prog_line, ret = 0; + int prog_line, ret = 0, i; fb = sde_wb_connector_state_get_output_fb(conn_state); if (!fb) { @@ -902,12 +902,14 @@ static int _sde_enc_phys_wb_validate_cwb(struct sde_encoder_phys *phys_enc, return -EINVAL; } - if (((wb_roi.w < out_width) || (wb_roi.h < out_height)) && - ((wb_roi.w * wb_roi.h * fmt->bpp) % 256) && !SDE_FORMAT_IS_LINEAR(fmt)) { - SDE_ERROR("invalid stride w=%d h=%d bpp=%d out_width=%d, out_height=%d lin=%d\n", - wb_roi.w, wb_roi.h, fmt->bpp, out_width, out_height, - SDE_FORMAT_IS_LINEAR(fmt)); - return -EINVAL; + /* pitch has to be multiple of 256 bits */ + for (i = 0; i < fb->format->num_planes; i++) { + if (fb->pitches[i] % 32) { + SDE_ERROR("invalid stride plane:%d pitch:%u fmt: %4.4s bpp:%d wxh:%dx%d\n", + i, fb->pitches[i], (char *)&fmt->base.pixel_format, + fmt->bpp, wb_roi.w, wb_roi.h); + return -EINVAL; + } } /*