* [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation
@ 2024-10-07 5:01 Jonathan Marek
2024-10-07 5:01 ` [PATCH v2 2/2] drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation Jonathan Marek
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jonathan Marek @ 2024-10-07 5:01 UTC (permalink / raw)
To: freedreno
Cc: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
Marijn Suijten, David Airlie, Simona Vetter, Jessica Zhang,
Konrad Dybcio, open list:DRM DRIVER for Qualcomm display hardware,
open list:DRM DRIVER for Qualcomm display hardware, open list
drm_mode_vrefresh() can introduce a large rounding error, avoid it.
Fixes: 7c9e4a554d4a ("drm/msm/dsi: Reduce pclk rate for compression")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
---
drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 185d7de0bf376..1205aa398e445 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -542,7 +542,7 @@ static unsigned long dsi_adjust_pclk_for_compression(const struct drm_display_mo
int new_htotal = mode->htotal - mode->hdisplay + new_hdisplay;
- return new_htotal * mode->vtotal * drm_mode_vrefresh(mode);
+ return mult_frac(mode->clock * 1000u, new_htotal, mode->htotal);
}
static unsigned long dsi_get_pclk_rate(const struct drm_display_mode *mode,
--
2.45.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation
2024-10-07 5:01 [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation Jonathan Marek
@ 2024-10-07 5:01 ` Jonathan Marek
2024-10-07 13:19 ` Dmitry Baryshkov
2024-10-14 19:30 ` Abhinav Kumar
2024-10-07 13:16 ` [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation Dmitry Baryshkov
2024-10-14 19:39 ` Abhinav Kumar
2 siblings, 2 replies; 6+ messages in thread
From: Jonathan Marek @ 2024-10-07 5:01 UTC (permalink / raw)
To: freedreno
Cc: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
Marijn Suijten, David Airlie, Simona Vetter, Jessica Zhang,
Konrad Dybcio, Sibi Sankar,
open list:DRM DRIVER for Qualcomm display hardware,
open list:DRM DRIVER for Qualcomm display hardware, open list
When (mode->clock * 1000) is larger than (1<<31), int to unsigned long
conversion will sign extend the int to 64 bits and the pclk_rate value
will be incorrect.
Fix this by making the result of the multiplication unsigned.
Note that above (1<<32) would still be broken and require more changes, but
its unlikely anyone will need that anytime soon.
Fixes: c4d8cfe516dc ("drm/msm/dsi: add implementation for helper functions")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
---
drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 1205aa398e445..a98d24b7cb00b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -550,7 +550,7 @@ static unsigned long dsi_get_pclk_rate(const struct drm_display_mode *mode,
{
unsigned long pclk_rate;
- pclk_rate = mode->clock * 1000;
+ pclk_rate = mode->clock * 1000u;
if (dsc)
pclk_rate = dsi_adjust_pclk_for_compression(mode, dsc);
--
2.45.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation
2024-10-07 5:01 [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation Jonathan Marek
2024-10-07 5:01 ` [PATCH v2 2/2] drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation Jonathan Marek
@ 2024-10-07 13:16 ` Dmitry Baryshkov
2024-10-14 19:39 ` Abhinav Kumar
2 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2024-10-07 13:16 UTC (permalink / raw)
To: Jonathan Marek
Cc: freedreno, Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Jessica Zhang, Konrad Dybcio,
open list:DRM DRIVER for Qualcomm display hardware,
open list:DRM DRIVER for Qualcomm display hardware, open list
On Mon, Oct 07, 2024 at 01:01:48AM GMT, Jonathan Marek wrote:
> drm_mode_vrefresh() can introduce a large rounding error, avoid it.
>
> Fixes: 7c9e4a554d4a ("drm/msm/dsi: Reduce pclk rate for compression")
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> ---
> drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation
2024-10-07 5:01 ` [PATCH v2 2/2] drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation Jonathan Marek
@ 2024-10-07 13:19 ` Dmitry Baryshkov
2024-10-14 19:30 ` Abhinav Kumar
1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2024-10-07 13:19 UTC (permalink / raw)
To: Jonathan Marek
Cc: freedreno, Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Jessica Zhang, Konrad Dybcio,
Sibi Sankar, open list:DRM DRIVER for Qualcomm display hardware,
open list:DRM DRIVER for Qualcomm display hardware, open list
On Mon, Oct 07, 2024 at 01:01:49AM GMT, Jonathan Marek wrote:
> When (mode->clock * 1000) is larger than (1<<31), int to unsigned long
> conversion will sign extend the int to 64 bits and the pclk_rate value
> will be incorrect.
>
> Fix this by making the result of the multiplication unsigned.
>
> Note that above (1<<32) would still be broken and require more changes, but
> its unlikely anyone will need that anytime soon.
>
> Fixes: c4d8cfe516dc ("drm/msm/dsi: add implementation for helper functions")
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> ---
> drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation
2024-10-07 5:01 ` [PATCH v2 2/2] drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation Jonathan Marek
2024-10-07 13:19 ` Dmitry Baryshkov
@ 2024-10-14 19:30 ` Abhinav Kumar
1 sibling, 0 replies; 6+ messages in thread
From: Abhinav Kumar @ 2024-10-14 19:30 UTC (permalink / raw)
To: Jonathan Marek, freedreno
Cc: Rob Clark, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Jessica Zhang, Konrad Dybcio,
Sibi Sankar, open list:DRM DRIVER for Qualcomm display hardware,
open list:DRM DRIVER for Qualcomm display hardware, open list
On 10/6/2024 10:01 PM, Jonathan Marek wrote:
> When (mode->clock * 1000) is larger than (1<<31), int to unsigned long
> conversion will sign extend the int to 64 bits and the pclk_rate value
> will be incorrect.
>
> Fix this by making the result of the multiplication unsigned.
>
> Note that above (1<<32) would still be broken and require more changes, but
> its unlikely anyone will need that anytime soon.
>
> Fixes: c4d8cfe516dc ("drm/msm/dsi: add implementation for helper functions")
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> ---
> drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation
2024-10-07 5:01 [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation Jonathan Marek
2024-10-07 5:01 ` [PATCH v2 2/2] drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation Jonathan Marek
2024-10-07 13:16 ` [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation Dmitry Baryshkov
@ 2024-10-14 19:39 ` Abhinav Kumar
2 siblings, 0 replies; 6+ messages in thread
From: Abhinav Kumar @ 2024-10-14 19:39 UTC (permalink / raw)
To: Jonathan Marek, freedreno
Cc: Rob Clark, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter, Jessica Zhang, Konrad Dybcio,
open list:DRM DRIVER for Qualcomm display hardware,
open list:DRM DRIVER for Qualcomm display hardware, open list
On 10/6/2024 10:01 PM, Jonathan Marek wrote:
> drm_mode_vrefresh() can introduce a large rounding error, avoid it.
>
> Fixes: 7c9e4a554d4a ("drm/msm/dsi: Reduce pclk rate for compression")
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> ---
> drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-14 19:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 5:01 [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation Jonathan Marek
2024-10-07 5:01 ` [PATCH v2 2/2] drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation Jonathan Marek
2024-10-07 13:19 ` Dmitry Baryshkov
2024-10-14 19:30 ` Abhinav Kumar
2024-10-07 13:16 ` [PATCH v2 1/2] drm/msm/dsi: improve/fix dsc pclk calculation Dmitry Baryshkov
2024-10-14 19:39 ` Abhinav Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox