diff mbox series

[RFC,3/5] drm/msm/dpu: Use DRM DSC helper for det_thresh_flatness

Message ID 20230329-rfc-msm-dsc-helper-v1-3-f3e479f59b6d@quicinc.com
State Superseded
Headers show
Series Introduce MSM-specific DSC helpers | expand

Commit Message

Jessica Zhang March 29, 2023, 11:18 p.m. UTC
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jessica Zhang March 29, 2023, 11:45 p.m. UTC | #1
On 3/29/2023 4:31 PM, Dmitry Baryshkov wrote:
> On 30/03/2023 02:18, Jessica Zhang wrote:
>> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
>> ---
>>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c 
>> b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
>> index 619926da1441..648c530b5d05 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
>> @@ -3,6 +3,8 @@
>>    * Copyright (c) 2020-2022, Linaro Limited
>>    */
>> +#include <drm/display/drm_dsc_helper.h>
>> +
>>   #include "dpu_kms.h"
>>   #include "dpu_hw_catalog.h"
>>   #include "dpu_hwio.h"
>> @@ -102,7 +104,7 @@ static void dpu_hw_dsc_config(struct dpu_hw_dsc 
>> *hw_dsc,
>>       data |= dsc->final_offset;
>>       DPU_REG_WRITE(c, DSC_DSC_OFFSET, data);
>> -    det_thresh_flatness = 7 + 2 * (dsc->bits_per_component - 8);
>> +    det_thresh_flatness = drm_dsc_calculate_det_thresh_flatness(dsc);
> 
> But this changes the value! Compare:
> 
> bpc | old | new
> 8   | 7   | 2
> 10  | 11  | 8
> 12  | 15  | 256
> 
> If this is intentional, please state so and maybe add a Fixes tag.

Hi Dmitry,

Yep this was intentional to match downstream and the spec. Will add a 
fixes tag for this.

Thanks,

Jessica Zhang

> 
> 
>>       data = det_thresh_flatness << 10;
>>       data |= dsc->flatness_max_qp << 5;
>>       data |= dsc->flatness_min_qp;
>>
> 
> -- 
> With best wishes
> Dmitry
>
Dmitry Baryshkov March 29, 2023, 11:51 p.m. UTC | #2
On 30/03/2023 02:45, Jessica Zhang wrote:
> 
> 
> On 3/29/2023 4:31 PM, Dmitry Baryshkov wrote:
>> On 30/03/2023 02:18, Jessica Zhang wrote:
>>> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
>>> ---
>>>   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c 
>>> b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
>>> index 619926da1441..648c530b5d05 100644
>>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
>>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
>>> @@ -3,6 +3,8 @@
>>>    * Copyright (c) 2020-2022, Linaro Limited
>>>    */
>>> +#include <drm/display/drm_dsc_helper.h>
>>> +
>>>   #include "dpu_kms.h"
>>>   #include "dpu_hw_catalog.h"
>>>   #include "dpu_hwio.h"
>>> @@ -102,7 +104,7 @@ static void dpu_hw_dsc_config(struct dpu_hw_dsc 
>>> *hw_dsc,
>>>       data |= dsc->final_offset;
>>>       DPU_REG_WRITE(c, DSC_DSC_OFFSET, data);
>>> -    det_thresh_flatness = 7 + 2 * (dsc->bits_per_component - 8);
>>> +    det_thresh_flatness = drm_dsc_calculate_det_thresh_flatness(dsc);
>>
>> But this changes the value! Compare:
>>
>> bpc | old | new
>> 8   | 7   | 2
>> 10  | 11  | 8
>> 12  | 15  | 256
>>
>> If this is intentional, please state so and maybe add a Fixes tag.
> 
> Hi Dmitry,
> 
> Yep this was intentional to match downstream and the spec. Will add a 
> fixes tag for this.

Good! I found corresponding change in msm-4.14, so now I understand why 
previously we had what we had.

> 
> Thanks,
> 
> Jessica Zhang
> 
>>
>>
>>>       data = det_thresh_flatness << 10;
>>>       data |= dsc->flatness_max_qp << 5;
>>>       data |= dsc->flatness_min_qp;
>>>
>>
>> -- 
>> With best wishes
>> Dmitry
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
index 619926da1441..648c530b5d05 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
@@ -3,6 +3,8 @@ 
  * Copyright (c) 2020-2022, Linaro Limited
  */
 
+#include <drm/display/drm_dsc_helper.h>
+
 #include "dpu_kms.h"
 #include "dpu_hw_catalog.h"
 #include "dpu_hwio.h"
@@ -102,7 +104,7 @@  static void dpu_hw_dsc_config(struct dpu_hw_dsc *hw_dsc,
 	data |= dsc->final_offset;
 	DPU_REG_WRITE(c, DSC_DSC_OFFSET, data);
 
-	det_thresh_flatness = 7 + 2 * (dsc->bits_per_component - 8);
+	det_thresh_flatness = drm_dsc_calculate_det_thresh_flatness(dsc);
 	data = det_thresh_flatness << 10;
 	data |= dsc->flatness_max_qp << 5;
 	data |= dsc->flatness_min_qp;