From nobody Fri Apr 3 22:31:38 2026 Received: from mail-106119.protonmail.ch (mail-106119.protonmail.ch [79.135.106.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E72D4207A for ; Sun, 22 Mar 2026 18:48:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.135.106.119 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774205300; cv=none; b=faLrG4nOHXglS6BllQZPRTpT58Mi+Xl0nUHp1DSqtQrZem5xb7fR3/EyFeWkNRDIRAFLDASFgVgA6Nhb6L4D2pCeBpr/a2OfuPq+iJEMQ1GIJRCPe6I2Gk3czLkiEOXAYm9mjhXEPDLFwBdgktt37C7HHzJfJFzIdyZGxPNy8So= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774205300; c=relaxed/simple; bh=q8WdoOQnLFlKMthCaNNS1wcc56rilLpUD3yzl7joAaA=; h=Date:To:From:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=GH4epm1lgzOzqTG1HM3R8DulYyULiXIRzxS3mGZEbOpe106halK2q6xXLpypai0QJS02tgC0nl45JIixfLN/xWA3PuHDXLbaB5MrS9m/Wbpk4CHvgJCFqttNPRK9rto0yJsFTZAsWnxRiSANhB6rvAI9foQqd7MbwAOAHllrahU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b=emA7uTEb; arc=none smtp.client-ip=79.135.106.119 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="emA7uTEb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1774205296; x=1774464496; bh=W2vGcjC6o/9rSwUMT8OLICaUBrAZ7/2I6vU0gYR4kkI=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=emA7uTEbUSB1oLP8p8Qfqf3JY4Ah2oLbQEHzVwPVwpsJiypdw9g9gxhVLWtIwV7t/ 6jWcwvikiTzA0HwQMpK8laie4hIDdn0yjZKUzRBXRgwjPCb2XUK1d/AriteyNhZ5kK DHWpG/wvWPpY951Wee/DLhxlIO307BpjjvtvHd93n3/stWlHd1d8b4LrdMGd0c6P5d UpRbOEVb3rBXCezInh5WXfImlckCPEYkT8XTZe+mlEX9AhkgrZopqeXN6GwoohF8U4 evuntgGhVq7wSf+Gm4GkaNVdcIrBkJaIrwTC+jpNi1Og2GtAlpJ5QZ4CfwXvzoWxZF zZvCoqxC+x49g== Date: Sun, 22 Mar 2026 18:48:09 +0000 To: Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter From: Alexander Koskovich Cc: Jonathan Marek , Neil Armstrong , Pengyu Luo , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Alexander Koskovich Subject: [PATCH v2] drm/msm/dpu: calculate data_width like downstream Message-ID: <20260322-fix-data-width-calc-v2-1-d5f28136bc4e@pm.me> Feedback-ID: 37836894:user:proton X-Pm-Message-ID: 42764064717d064bdc2b817f89f4066be9490a98 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Derive INTF data_width from dce_bytes_per_line rather than timing->width when DSC is enabled. Use DIV_ROUND_UP to avoid rounding errors. Signed-off-by: Alexander Koskovich Reviewed-by: Dmitry Baryshkov Tested-by: Pengyu Luo # Lenovo Legion Y700 Gen4 (SM= 8750) --- Changes in v2: - Added back comment about DSC & DP - Link to v1: https://lore.kernel.org/r/20260322-fix-data-width-calc-v1-1-1= 28880f5a067@pm.me --- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 2 ++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 26 +++++++++++++++++-= ---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 1 + 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers= /gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c index 0ba777bda253..ba810f26ea30 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c @@ -10,6 +10,7 @@ #include "dpu_formats.h" #include "dpu_trace.h" #include "disp/msm_disp_snapshot.h" +#include "msm_dsc_helper.h" =20 #include #include @@ -136,6 +137,7 @@ static void drm_mode_to_intf_timing_params( timing->width =3D timing->width * drm_dsc_get_bpp_int(dsc) / (dsc->bits_per_component * 3); timing->xres =3D timing->width; + timing->dce_bytes_per_line =3D msm_dsc_get_bytes_per_line(dsc); } } =20 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c b/drivers/gpu/drm/= msm/disp/dpu1/dpu_hw_intf.c index 7e620f590984..ac82b69aedf6 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c @@ -173,13 +173,29 @@ static void dpu_hw_intf_setup_timing_engine(struct dp= u_hw_intf *intf, data_width =3D p->width; =20 /* - * If widebus is enabled, data is valid for only half the active window - * since the data rate is doubled in this mode. But for the compression - * mode in DP case, the p->width is already adjusted in - * drm_mode_to_intf_timing_params() + * If widebus is disabled: + * For uncompressed stream, the data is valid for the entire active + * window period. + * For compressed stream, data is valid for a shorter time period + * inside the active window depending on the compression ratio. + * + * If widebus is enabled: + * For uncompressed stream, data is valid for only half the active + * window, since the data rate is doubled in this mode. + * For compressed stream, data validity window needs to be adjusted for + * compression ratio and then further halved. + * + * For the compression mode in DP case, the p->width is already + * adjusted in drm_mode_to_intf_timing_params(). */ - if (p->wide_bus_en && !dp_intf) + if (p->compression_en && !dp_intf) { + if (p->wide_bus_en) + data_width =3D DIV_ROUND_UP(p->dce_bytes_per_line, 6); + else + data_width =3D DIV_ROUND_UP(p->dce_bytes_per_line, 3); + } else if (p->wide_bus_en && !dp_intf) { data_width =3D p->width >> 1; + } =20 /* TODO: handle DSC+DP case, we only handle DSC+DSI case so far */ if (p->compression_en && !dp_intf && diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h b/drivers/gpu/drm/= msm/disp/dpu1/dpu_hw_intf.h index f6ef2c21b66d..badd26305fc9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h @@ -35,6 +35,7 @@ struct dpu_hw_intf_timing_params { =20 bool wide_bus_en; bool compression_en; + u32 dce_bytes_per_line; }; =20 struct dpu_hw_intf_prog_fetch { --- base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c change-id: 20260322-fix-data-width-calc-c44287df08b8 Best regards, --=20 Alexander Koskovich