[PATCH 1/3] drm/msm/dp: account for widebus in msm_dp_catalog_panel_tpg_enable()

Abhinav Kumar posted 3 patches 1 day, 22 hours ago
[PATCH 1/3] drm/msm/dp: account for widebus in msm_dp_catalog_panel_tpg_enable()
Posted by Abhinav Kumar 1 day, 22 hours ago
Adjust the h_active calculation to account for widebus in tpg.

Fixes: 757a2f36ab09 ("drm/msm/dp: enable widebus feature for display port")
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
---
 drivers/gpu/drm/msm/dp/dp_catalog.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c
index b4c8856fb25d..05c8e1996f60 100644
--- a/drivers/gpu/drm/msm/dp/dp_catalog.c
+++ b/drivers/gpu/drm/msm/dp/dp_catalog.c
@@ -1011,9 +1011,21 @@ void msm_dp_catalog_panel_tpg_enable(struct msm_dp_catalog *msm_dp_catalog,
 	u32 v_sync_width;
 	u32 hsync_ctl;
 	u32 display_hctl;
+	u32 h_sync_width;
+	u32 h_front_porch;
+	u32 h_back_porch;
+	u32 h_active;
+
+	h_active = drm_mode->hdisplay;
+	h_back_porch = drm_mode->htotal - drm_mode->hsync_end;
+	h_sync_width = drm_mode->htotal - (drm_mode->hsync_start + h_back_porch);
+	h_front_porch = drm_mode->hsync_start - drm_mode->hdisplay;
+
+	if (msm_dp_catalog->wide_bus_en)
+		h_active /= 2;
 
 	/* TPG config parameters*/
-	hsync_period = drm_mode->htotal;
+	hsync_period = h_sync_width + h_back_porch + h_active + h_front_porch;
 	vsync_period = drm_mode->vtotal;
 
 	display_v_start = ((drm_mode->vtotal - drm_mode->vsync_start) *

-- 
2.34.1
Re: [PATCH 1/3] drm/msm/dp: account for widebus in msm_dp_catalog_panel_tpg_enable()
Posted by Dmitry Baryshkov 1 day, 4 hours ago
On Mon, Dec 02, 2024 at 12:41:58PM -0800, Abhinav Kumar wrote:
> Adjust the h_active calculation to account for widebus in tpg.
> 
> Fixes: 757a2f36ab09 ("drm/msm/dp: enable widebus feature for display port")
> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
>  drivers/gpu/drm/msm/dp/dp_catalog.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c
> index b4c8856fb25d..05c8e1996f60 100644
> --- a/drivers/gpu/drm/msm/dp/dp_catalog.c
> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c
> @@ -1011,9 +1011,21 @@ void msm_dp_catalog_panel_tpg_enable(struct msm_dp_catalog *msm_dp_catalog,
>  	u32 v_sync_width;
>  	u32 hsync_ctl;
>  	u32 display_hctl;
> +	u32 h_sync_width;
> +	u32 h_front_porch;
> +	u32 h_back_porch;
> +	u32 h_active;
> +
> +	h_active = drm_mode->hdisplay;
> +	h_back_porch = drm_mode->htotal - drm_mode->hsync_end;
> +	h_sync_width = drm_mode->htotal - (drm_mode->hsync_start + h_back_porch);

It's at least drm_mode->hsync_end - drm_mode->hsync_start

> +	h_front_porch = drm_mode->hsync_start - drm_mode->hdisplay;
> +
> +	if (msm_dp_catalog->wide_bus_en)
> +		h_active /= 2;
>  
>  	/* TPG config parameters*/
> -	hsync_period = drm_mode->htotal;
> +	hsync_period = h_sync_width + h_back_porch + h_active + h_front_porch;

Is it equivalent to:

hsync_period = drm_mode->htotal;
if (msm_dp_catalog->wide_bus_en)
    hsync_period -= drm_mode->hdisplay / 2;

I think it's simpler to handle.

>  	vsync_period = drm_mode->vtotal;
>  
>  	display_v_start = ((drm_mode->vtotal - drm_mode->vsync_start) *
> 
> -- 
> 2.34.1
> 

-- 
With best wishes
Dmitry
Re: [PATCH 1/3] drm/msm/dp: account for widebus in msm_dp_catalog_panel_tpg_enable()
Posted by Abhinav Kumar 23 hours ago

On 12/3/2024 6:34 AM, Dmitry Baryshkov wrote:
> On Mon, Dec 02, 2024 at 12:41:58PM -0800, Abhinav Kumar wrote:
>> Adjust the h_active calculation to account for widebus in tpg.
>>
>> Fixes: 757a2f36ab09 ("drm/msm/dp: enable widebus feature for display port")
>> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>> ---
>>   drivers/gpu/drm/msm/dp/dp_catalog.c | 14 +++++++++++++-
>>   1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c
>> index b4c8856fb25d..05c8e1996f60 100644
>> --- a/drivers/gpu/drm/msm/dp/dp_catalog.c
>> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c
>> @@ -1011,9 +1011,21 @@ void msm_dp_catalog_panel_tpg_enable(struct msm_dp_catalog *msm_dp_catalog,
>>   	u32 v_sync_width;
>>   	u32 hsync_ctl;
>>   	u32 display_hctl;
>> +	u32 h_sync_width;
>> +	u32 h_front_porch;
>> +	u32 h_back_porch;
>> +	u32 h_active;
>> +
>> +	h_active = drm_mode->hdisplay;
>> +	h_back_porch = drm_mode->htotal - drm_mode->hsync_end;
>> +	h_sync_width = drm_mode->htotal - (drm_mode->hsync_start + h_back_porch);
> 
> It's at least drm_mode->hsync_end - drm_mode->hsync_start
> 
>> +	h_front_porch = drm_mode->hsync_start - drm_mode->hdisplay;
>> +
>> +	if (msm_dp_catalog->wide_bus_en)
>> +		h_active /= 2;
>>   
>>   	/* TPG config parameters*/
>> -	hsync_period = drm_mode->htotal;
>> +	hsync_period = h_sync_width + h_back_porch + h_active + h_front_porch;
> 
> Is it equivalent to:
> 
> hsync_period = drm_mode->htotal;
> if (msm_dp_catalog->wide_bus_en)
>      hsync_period -= drm_mode->hdisplay / 2;
> 
> I think it's simpler to handle.
> 

Yes certainly!

Thanks for the feedback. Will fix it up.

>>   	vsync_period = drm_mode->vtotal;
>>   
>>   	display_v_start = ((drm_mode->vtotal - drm_mode->vsync_start) *
>>
>> -- 
>> 2.34.1
>>
>