* [PATCH v12 1/9] drm/display/dsc: Add flatness and initial scale value calculations
2023-05-17 22:27 [PATCH v12 0/9] Introduce MSM-specific DSC helpers Jessica Zhang
@ 2023-05-17 22:27 ` Jessica Zhang
2023-05-18 0:37 ` Dmitry Baryshkov
2023-05-22 9:37 ` Jani Nikula
2023-05-17 22:27 ` [PATCH v12 2/9] drm/display/dsc: add helper to set semi-const parameters Jessica Zhang
` (7 subsequent siblings)
8 siblings, 2 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-17 22:27 UTC (permalink / raw)
To: freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm, Jessica Zhang
Add helpers to calculate det_thresh_flatness and initial_scale_value as
these calculations are defined within the DSC spec.
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
include/drm/display/drm_dsc_helper.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h
index fc2104415dcb..753b0034eda7 100644
--- a/include/drm/display/drm_dsc_helper.h
+++ b/include/drm/display/drm_dsc_helper.h
@@ -25,5 +25,15 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg);
int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_type type);
int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg);
+static inline u8 drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc)
+{
+ return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset);
+}
+
+static inline u32 drm_dsc_flatness_det_thresh(const struct drm_dsc_config *dsc)
+{
+ return 2 << (dsc->bits_per_component - 8);
+}
+
#endif /* _DRM_DSC_HELPER_H_ */
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v12 1/9] drm/display/dsc: Add flatness and initial scale value calculations
2023-05-17 22:27 ` [PATCH v12 1/9] drm/display/dsc: Add flatness and initial scale value calculations Jessica Zhang
@ 2023-05-18 0:37 ` Dmitry Baryshkov
2023-05-22 9:37 ` Jani Nikula
1 sibling, 0 replies; 18+ messages in thread
From: Dmitry Baryshkov @ 2023-05-18 0:37 UTC (permalink / raw)
To: Jessica Zhang, freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Sean Paul, dri-devel, linux-arm-msm
On 18/05/2023 01:27, Jessica Zhang wrote:
> Add helpers to calculate det_thresh_flatness and initial_scale_value as
> these calculations are defined within the DSC spec.
>
> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
> include/drm/display/drm_dsc_helper.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v12 1/9] drm/display/dsc: Add flatness and initial scale value calculations
2023-05-17 22:27 ` [PATCH v12 1/9] drm/display/dsc: Add flatness and initial scale value calculations Jessica Zhang
2023-05-18 0:37 ` Dmitry Baryshkov
@ 2023-05-22 9:37 ` Jani Nikula
2023-05-22 21:15 ` Jessica Zhang
1 sibling, 1 reply; 18+ messages in thread
From: Jani Nikula @ 2023-05-22 9:37 UTC (permalink / raw)
To: Jessica Zhang, freedreno
Cc: linux-arm-msm, Abhinav Kumar, dri-devel, Kuogee Hsieh,
Konrad Dybcio, Jessica Zhang, Dmitry Baryshkov, Marijn Suijten,
Sean Paul
On Wed, 17 May 2023, Jessica Zhang <quic_jesszhan@quicinc.com> wrote:
> Add helpers to calculate det_thresh_flatness and initial_scale_value as
> these calculations are defined within the DSC spec.
>
> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
> include/drm/display/drm_dsc_helper.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h
> index fc2104415dcb..753b0034eda7 100644
> --- a/include/drm/display/drm_dsc_helper.h
> +++ b/include/drm/display/drm_dsc_helper.h
> @@ -25,5 +25,15 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg);
> int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_type type);
> int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg);
>
> +static inline u8 drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc)
> +{
> + return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset);
> +}
> +
> +static inline u32 drm_dsc_flatness_det_thresh(const struct drm_dsc_config *dsc)
> +{
> + return 2 << (dsc->bits_per_component - 8);
> +}
kernel-doc? Maybe make them regular functions instead of static inline?
BR,
Jani.
> +
> #endif /* _DRM_DSC_HELPER_H_ */
--
Jani Nikula, Intel Open Source Graphics Center
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH v12 1/9] drm/display/dsc: Add flatness and initial scale value calculations
2023-05-22 9:37 ` Jani Nikula
@ 2023-05-22 21:15 ` Jessica Zhang
0 siblings, 0 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-22 21:15 UTC (permalink / raw)
To: Jani Nikula, freedreno
Cc: linux-arm-msm, Abhinav Kumar, dri-devel, Kuogee Hsieh,
Konrad Dybcio, Dmitry Baryshkov, Marijn Suijten, Sean Paul
On 5/22/2023 2:37 AM, Jani Nikula wrote:
> On Wed, 17 May 2023, Jessica Zhang <quic_jesszhan@quicinc.com> wrote:
>> Add helpers to calculate det_thresh_flatness and initial_scale_value as
>> these calculations are defined within the DSC spec.
>>
>> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
>> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
>> ---
>> include/drm/display/drm_dsc_helper.h | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h
>> index fc2104415dcb..753b0034eda7 100644
>> --- a/include/drm/display/drm_dsc_helper.h
>> +++ b/include/drm/display/drm_dsc_helper.h
>> @@ -25,5 +25,15 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg);
>> int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_type type);
>> int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg);
>>
>> +static inline u8 drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc)
>> +{
>> + return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset);
>> +}
>> +
>> +static inline u32 drm_dsc_flatness_det_thresh(const struct drm_dsc_config *dsc)
>> +{
>> + return 2 << (dsc->bits_per_component - 8);
>> +}
>
> kernel-doc?
Hi Jani,
Sure, I'll add kernel docs for these.
> Maybe make them regular functions instead of static inline?
I was under the impression that smaller/single-line functions were good
candidates for inlining. However, if you have a strong preference for
having these as regular functions, I'm ok with that too.
Thanks,
Jessica Zhang
>
> BR,
> Jani.
>
>> +
>> #endif /* _DRM_DSC_HELPER_H_ */
>
> --
> Jani Nikula, Intel Open Source Graphics Center
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v12 2/9] drm/display/dsc: add helper to set semi-const parameters
2023-05-17 22:27 [PATCH v12 0/9] Introduce MSM-specific DSC helpers Jessica Zhang
2023-05-17 22:27 ` [PATCH v12 1/9] drm/display/dsc: Add flatness and initial scale value calculations Jessica Zhang
@ 2023-05-17 22:27 ` Jessica Zhang
2023-05-17 22:27 ` [PATCH v12 3/9] drm/display/dsc: Add drm_dsc_get_bpp_int helper Jessica Zhang
` (6 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-17 22:27 UTC (permalink / raw)
To: freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm, Jessica Zhang
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Add a helper setting config values which are typically constant across
operating modes (table E-4 of the standard) and mux_word_size (which is
a const according to 3.5.2).
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
drivers/gpu/drm/display/drm_dsc_helper.c | 22 ++++++++++++++++++++++
include/drm/display/drm_dsc_helper.h | 1 +
2 files changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/display/drm_dsc_helper.c b/drivers/gpu/drm/display/drm_dsc_helper.c
index fc187a8d8873..440da64d4129 100644
--- a/drivers/gpu/drm/display/drm_dsc_helper.c
+++ b/drivers/gpu/drm/display/drm_dsc_helper.c
@@ -270,6 +270,28 @@ void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_payload,
}
EXPORT_SYMBOL(drm_dsc_pps_payload_pack);
+/**
+ * drm_dsc_set_const_params() - Set DSC parameters considered typically
+ * constant across operation modes
+ *
+ * @vdsc_cfg:
+ * DSC Configuration data partially filled by driver
+ */
+void drm_dsc_set_const_params(struct drm_dsc_config *vdsc_cfg)
+{
+ if (!vdsc_cfg->rc_model_size)
+ vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST;
+ vdsc_cfg->rc_edge_factor = DSC_RC_EDGE_FACTOR_CONST;
+ vdsc_cfg->rc_tgt_offset_high = DSC_RC_TGT_OFFSET_HI_CONST;
+ vdsc_cfg->rc_tgt_offset_low = DSC_RC_TGT_OFFSET_LO_CONST;
+
+ if (vdsc_cfg->bits_per_component <= 10)
+ vdsc_cfg->mux_word_size = DSC_MUX_WORD_SIZE_8_10_BPC;
+ else
+ vdsc_cfg->mux_word_size = DSC_MUX_WORD_SIZE_12_BPC;
+}
+EXPORT_SYMBOL(drm_dsc_set_const_params);
+
/* From DSC_v1.11 spec, rc_parameter_Set syntax element typically constant */
static const u16 drm_dsc_rc_buf_thresh[] = {
896, 1792, 2688, 3584, 4480, 5376, 6272, 6720, 7168, 7616,
diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h
index 753b0034eda7..e0cbc38ada26 100644
--- a/include/drm/display/drm_dsc_helper.h
+++ b/include/drm/display/drm_dsc_helper.h
@@ -21,6 +21,7 @@ void drm_dsc_dp_pps_header_init(struct dp_sdp_header *pps_header);
int drm_dsc_dp_rc_buffer_size(u8 rc_buffer_block_size, u8 rc_buffer_size);
void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_sdp,
const struct drm_dsc_config *dsc_cfg);
+void drm_dsc_set_const_params(struct drm_dsc_config *vdsc_cfg);
void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg);
int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_type type);
int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg);
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v12 3/9] drm/display/dsc: Add drm_dsc_get_bpp_int helper
2023-05-17 22:27 [PATCH v12 0/9] Introduce MSM-specific DSC helpers Jessica Zhang
2023-05-17 22:27 ` [PATCH v12 1/9] drm/display/dsc: Add flatness and initial scale value calculations Jessica Zhang
2023-05-17 22:27 ` [PATCH v12 2/9] drm/display/dsc: add helper to set semi-const parameters Jessica Zhang
@ 2023-05-17 22:27 ` Jessica Zhang
2023-05-18 0:38 ` Dmitry Baryshkov
2023-05-22 9:35 ` Jani Nikula
2023-05-17 22:27 ` [PATCH v12 4/9] drm/msm/dsi: use DRM DSC helpers for DSC setup Jessica Zhang
` (5 subsequent siblings)
8 siblings, 2 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-17 22:27 UTC (permalink / raw)
To: freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm, Jessica Zhang
Add helper to get the integer value of drm_dsc_config.bits_per_pixel
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
include/drm/display/drm_dsc_helper.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h
index e0cbc38ada26..7bf7e8ff8eb4 100644
--- a/include/drm/display/drm_dsc_helper.h
+++ b/include/drm/display/drm_dsc_helper.h
@@ -9,6 +9,7 @@
#define DRM_DSC_HELPER_H_
#include <drm/display/drm_dsc.h>
+#include <linux/bug.h>
enum drm_dsc_params_type {
DRM_DSC_1_2_444,
@@ -26,6 +27,12 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg);
int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_type type);
int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg);
+static inline u32 drm_dsc_get_bpp_int(const struct drm_dsc_config *dsc)
+{
+ WARN_ON_ONCE(dsc->bits_per_pixel & 0xf);
+ return dsc->bits_per_pixel >> 4;
+}
+
static inline u8 drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc)
{
return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset);
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v12 3/9] drm/display/dsc: Add drm_dsc_get_bpp_int helper
2023-05-17 22:27 ` [PATCH v12 3/9] drm/display/dsc: Add drm_dsc_get_bpp_int helper Jessica Zhang
@ 2023-05-18 0:38 ` Dmitry Baryshkov
2023-05-22 9:35 ` Jani Nikula
1 sibling, 0 replies; 18+ messages in thread
From: Dmitry Baryshkov @ 2023-05-18 0:38 UTC (permalink / raw)
To: Jessica Zhang, freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Sean Paul, dri-devel, linux-arm-msm
On 18/05/2023 01:27, Jessica Zhang wrote:
> Add helper to get the integer value of drm_dsc_config.bits_per_pixel
>
> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
> include/drm/display/drm_dsc_helper.h | 7 +++++++
> 1 file changed, 7 insertions(+)
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v12 3/9] drm/display/dsc: Add drm_dsc_get_bpp_int helper
2023-05-17 22:27 ` [PATCH v12 3/9] drm/display/dsc: Add drm_dsc_get_bpp_int helper Jessica Zhang
2023-05-18 0:38 ` Dmitry Baryshkov
@ 2023-05-22 9:35 ` Jani Nikula
2023-05-22 21:16 ` Jessica Zhang
1 sibling, 1 reply; 18+ messages in thread
From: Jani Nikula @ 2023-05-22 9:35 UTC (permalink / raw)
To: Jessica Zhang, freedreno
Cc: linux-arm-msm, Abhinav Kumar, dri-devel, Kuogee Hsieh,
Konrad Dybcio, Jessica Zhang, Dmitry Baryshkov, Marijn Suijten,
Sean Paul
On Wed, 17 May 2023, Jessica Zhang <quic_jesszhan@quicinc.com> wrote:
> Add helper to get the integer value of drm_dsc_config.bits_per_pixel
>
> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
> include/drm/display/drm_dsc_helper.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h
> index e0cbc38ada26..7bf7e8ff8eb4 100644
> --- a/include/drm/display/drm_dsc_helper.h
> +++ b/include/drm/display/drm_dsc_helper.h
> @@ -9,6 +9,7 @@
> #define DRM_DSC_HELPER_H_
>
> #include <drm/display/drm_dsc.h>
> +#include <linux/bug.h>
Seems like a small thing, adding static inlines in headers usually leads
to more header dependencies like this, and gradually slows down build.
Does it need to be a static inline?
BR,
Jani.
>
> enum drm_dsc_params_type {
> DRM_DSC_1_2_444,
> @@ -26,6 +27,12 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg);
> int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_type type);
> int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg);
>
> +static inline u32 drm_dsc_get_bpp_int(const struct drm_dsc_config *dsc)
> +{
> + WARN_ON_ONCE(dsc->bits_per_pixel & 0xf);
> + return dsc->bits_per_pixel >> 4;
> +}
> +
> static inline u8 drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc)
> {
> return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset);
--
Jani Nikula, Intel Open Source Graphics Center
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH v12 3/9] drm/display/dsc: Add drm_dsc_get_bpp_int helper
2023-05-22 9:35 ` Jani Nikula
@ 2023-05-22 21:16 ` Jessica Zhang
0 siblings, 0 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-22 21:16 UTC (permalink / raw)
To: Jani Nikula, freedreno
Cc: linux-arm-msm, Abhinav Kumar, dri-devel, Kuogee Hsieh,
Konrad Dybcio, Dmitry Baryshkov, Marijn Suijten, Sean Paul
On 5/22/2023 2:35 AM, Jani Nikula wrote:
> On Wed, 17 May 2023, Jessica Zhang <quic_jesszhan@quicinc.com> wrote:
>> Add helper to get the integer value of drm_dsc_config.bits_per_pixel
>>
>> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
>> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
>> ---
>> include/drm/display/drm_dsc_helper.h | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h
>> index e0cbc38ada26..7bf7e8ff8eb4 100644
>> --- a/include/drm/display/drm_dsc_helper.h
>> +++ b/include/drm/display/drm_dsc_helper.h
>> @@ -9,6 +9,7 @@
>> #define DRM_DSC_HELPER_H_
>>
>> #include <drm/display/drm_dsc.h>
>> +#include <linux/bug.h>
>
> Seems like a small thing, adding static inlines in headers usually leads
> to more header dependencies like this, and gradually slows down build.
>
> Does it need to be a static inline?
Hi Jani,
Good point about the dependencies. Will make this a non-inline function.
Thanks,
Jessica Zhang
>
> BR,
> Jani.
>
>>
>> enum drm_dsc_params_type {
>> DRM_DSC_1_2_444,
>> @@ -26,6 +27,12 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg);
>> int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_type type);
>> int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg);
>>
>> +static inline u32 drm_dsc_get_bpp_int(const struct drm_dsc_config *dsc)
>> +{
>> + WARN_ON_ONCE(dsc->bits_per_pixel & 0xf);
>> + return dsc->bits_per_pixel >> 4;
>> +}
>> +
>> static inline u8 drm_dsc_initial_scale_value(const struct drm_dsc_config *dsc)
>> {
>> return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset);
>
> --
> Jani Nikula, Intel Open Source Graphics Center
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v12 4/9] drm/msm/dsi: use DRM DSC helpers for DSC setup
2023-05-17 22:27 [PATCH v12 0/9] Introduce MSM-specific DSC helpers Jessica Zhang
` (2 preceding siblings ...)
2023-05-17 22:27 ` [PATCH v12 3/9] drm/display/dsc: Add drm_dsc_get_bpp_int helper Jessica Zhang
@ 2023-05-17 22:27 ` Jessica Zhang
2023-05-17 22:27 ` [PATCH v12 5/9] drm/msm: Add MSM-specific DSC helper methods Jessica Zhang
` (4 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-17 22:27 UTC (permalink / raw)
To: freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm, Jessica Zhang
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Use new DRM DSC helpers to setup DSI DSC configuration. The
initial_scale_value needs to be adjusted according to the standard, but
this is a separate change.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
drivers/gpu/drm/msm/dsi/dsi_host.c | 61 +++++---------------------------------
1 file changed, 8 insertions(+), 53 deletions(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 961689a255c4..74d38f90398a 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1731,28 +1731,9 @@ static int dsi_host_parse_lane_data(struct msm_dsi_host *msm_host,
return -EINVAL;
}
-static u32 dsi_dsc_rc_buf_thresh[DSC_NUM_BUF_RANGES - 1] = {
- 0x0e, 0x1c, 0x2a, 0x38, 0x46, 0x54, 0x62,
- 0x69, 0x70, 0x77, 0x79, 0x7b, 0x7d, 0x7e
-};
-
-/* only 8bpc, 8bpp added */
-static char min_qp[DSC_NUM_BUF_RANGES] = {
- 0, 0, 1, 1, 3, 3, 3, 3, 3, 3, 5, 5, 5, 7, 13
-};
-
-static char max_qp[DSC_NUM_BUF_RANGES] = {
- 4, 4, 5, 6, 7, 7, 7, 8, 9, 10, 11, 12, 13, 13, 15
-};
-
-static char bpg_offset[DSC_NUM_BUF_RANGES] = {
- 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12
-};
-
static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct drm_dsc_config *dsc)
{
- int i;
- u16 bpp = dsc->bits_per_pixel >> 4;
+ int ret;
if (dsc->bits_per_pixel & 0xf) {
DRM_DEV_ERROR(&msm_host->pdev->dev, "DSI does not support fractional bits_per_pixel\n");
@@ -1764,49 +1745,23 @@ static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct drm_dsc
return -EOPNOTSUPP;
}
- dsc->rc_model_size = 8192;
- dsc->first_line_bpg_offset = 12;
- dsc->rc_edge_factor = 6;
- dsc->rc_tgt_offset_high = 3;
- dsc->rc_tgt_offset_low = 3;
dsc->simple_422 = 0;
dsc->convert_rgb = 1;
dsc->vbr_enable = 0;
- /* handle only bpp = bpc = 8 */
- for (i = 0; i < DSC_NUM_BUF_RANGES - 1 ; i++)
- dsc->rc_buf_thresh[i] = dsi_dsc_rc_buf_thresh[i];
+ drm_dsc_set_const_params(dsc);
+ drm_dsc_set_rc_buf_thresh(dsc);
- for (i = 0; i < DSC_NUM_BUF_RANGES; i++) {
- dsc->rc_range_params[i].range_min_qp = min_qp[i];
- dsc->rc_range_params[i].range_max_qp = max_qp[i];
- /*
- * Range BPG Offset contains two's-complement signed values that fill
- * 8 bits, yet the registers and DCS PPS field are only 6 bits wide.
- */
- dsc->rc_range_params[i].range_bpg_offset = bpg_offset[i] & DSC_RANGE_BPG_OFFSET_MASK;
+ /* handle only bpp = bpc = 8, pre-SCR panels */
+ ret = drm_dsc_setup_rc_params(dsc, DRM_DSC_1_1_PRE_SCR);
+ if (ret) {
+ DRM_DEV_ERROR(&msm_host->pdev->dev, "could not find DSC RC parameters\n");
+ return ret;
}
- dsc->initial_offset = 6144; /* Not bpp 12 */
- if (bpp != 8)
- dsc->initial_offset = 2048; /* bpp = 12 */
-
- if (dsc->bits_per_component <= 10)
- dsc->mux_word_size = DSC_MUX_WORD_SIZE_8_10_BPC;
- else
- dsc->mux_word_size = DSC_MUX_WORD_SIZE_12_BPC;
-
- dsc->initial_xmit_delay = 512;
dsc->initial_scale_value = 32;
- dsc->first_line_bpg_offset = 12;
dsc->line_buf_depth = dsc->bits_per_component + 1;
- /* bpc 8 */
- dsc->flatness_min_qp = 3;
- dsc->flatness_max_qp = 12;
- dsc->rc_quant_incr_limit0 = 11;
- dsc->rc_quant_incr_limit1 = 11;
-
return drm_dsc_compute_rc_parameters(dsc);
}
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v12 5/9] drm/msm: Add MSM-specific DSC helper methods
2023-05-17 22:27 [PATCH v12 0/9] Introduce MSM-specific DSC helpers Jessica Zhang
` (3 preceding siblings ...)
2023-05-17 22:27 ` [PATCH v12 4/9] drm/msm/dsi: use DRM DSC helpers for DSC setup Jessica Zhang
@ 2023-05-17 22:27 ` Jessica Zhang
2023-05-17 23:01 ` Marijn Suijten
2023-05-17 22:27 ` [PATCH v12 6/9] drm/msm/dpu: Use fixed DRM DSC helper for det_thresh_flatness Jessica Zhang
` (3 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Jessica Zhang @ 2023-05-17 22:27 UTC (permalink / raw)
To: freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm, Jessica Zhang
Introduce MSM-specific DSC helper methods, as some calculations are
common between DP and DSC.
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
drivers/gpu/drm/msm/msm_dsc_helper.h | 38 ++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/drivers/gpu/drm/msm/msm_dsc_helper.h b/drivers/gpu/drm/msm/msm_dsc_helper.h
new file mode 100644
index 000000000000..c7d7ed026368
--- /dev/null
+++ b/drivers/gpu/drm/msm/msm_dsc_helper.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved
+ *
+ * Helper methods for MSM-specific DSC calculations that are common between timing engine,
+ * DSI, and DP.
+ */
+
+#ifndef MSM_DSC_HELPER_H_
+#define MSM_DSC_HELPER_H_
+
+#include <linux/math.h>
+#include <drm/display/drm_dsc_helper.h>
+
+/**
+ * msm_dsc_calculate_slices_per_intf() - get number of slices per interface
+ * @dsc: Pointer to drm dsc config struct
+ * @intf_width: interface width in pixels
+ * Returns: Integer representing the number of slices for the given interface
+ */
+static inline u32 msm_dsc_calculate_slices_per_intf(const struct drm_dsc_config *dsc, int intf_width)
+{
+ return DIV_ROUND_UP(intf_width, dsc->slice_width);
+}
+
+/**
+ * msm_dsc_get_bytes_per_line() - calculate bytes per line
+ * @dsc: Pointer to drm dsc config struct
+ * Returns: Integer value representing bytes per line. DSI and DP need
+ * to perform further calculations to turn this into pclk_per_intf,
+ * such as dividing by different values depending on if widebus is enabled.
+ */
+static inline u32 msm_dsc_get_bytes_per_line(const struct drm_dsc_config *dsc)
+{
+ return dsc->slice_count * dsc->slice_chunk_size;
+}
+
+#endif /* MSM_DSC_HELPER_H_ */
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v12 5/9] drm/msm: Add MSM-specific DSC helper methods
2023-05-17 22:27 ` [PATCH v12 5/9] drm/msm: Add MSM-specific DSC helper methods Jessica Zhang
@ 2023-05-17 23:01 ` Marijn Suijten
2023-05-18 0:26 ` Jessica Zhang
0 siblings, 1 reply; 18+ messages in thread
From: Marijn Suijten @ 2023-05-17 23:01 UTC (permalink / raw)
To: Jessica Zhang
Cc: freedreno, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter, Rob Clark,
Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm
On 2023-05-17 15:27:18, Jessica Zhang wrote:
> Introduce MSM-specific DSC helper methods, as some calculations are
> common between DP and DSC.
>
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
> drivers/gpu/drm/msm/msm_dsc_helper.h | 38 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/msm_dsc_helper.h b/drivers/gpu/drm/msm/msm_dsc_helper.h
> new file mode 100644
> index 000000000000..c7d7ed026368
> --- /dev/null
> +++ b/drivers/gpu/drm/msm/msm_dsc_helper.h
> @@ -0,0 +1,38 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved
> + *
> + * Helper methods for MSM-specific DSC calculations that are common between timing engine,
> + * DSI, and DP.
> + */
> +
> +#ifndef MSM_DSC_HELPER_H_
> +#define MSM_DSC_HELPER_H_
> +
> +#include <linux/math.h>
> +#include <drm/display/drm_dsc_helper.h>
> +
> +/**
> + * msm_dsc_calculate_slices_per_intf() - get number of slices per interface
Oh no, we just went to get to match the function below, and now this is
back at calculate. My bad, I wasn't clear enough in previous review: I
meant the ext after the -, so "get number of" -> "calculate number of".
Sorry!
> + * @dsc: Pointer to drm dsc config struct
> + * @intf_width: interface width in pixels
> + * Returns: Integer representing the number of slices for the given interface
> + */
> +static inline u32 msm_dsc_calculate_slices_per_intf(const struct drm_dsc_config *dsc, int intf_width)
u32... also for intf_width?
- Marijn
> +{
> + return DIV_ROUND_UP(intf_width, dsc->slice_width);
> +}
> +
> +/**
> + * msm_dsc_get_bytes_per_line() - calculate bytes per line
> + * @dsc: Pointer to drm dsc config struct
> + * Returns: Integer value representing bytes per line. DSI and DP need
> + * to perform further calculations to turn this into pclk_per_intf,
> + * such as dividing by different values depending on if widebus is enabled.
> + */
> +static inline u32 msm_dsc_get_bytes_per_line(const struct drm_dsc_config *dsc)
> +{
> + return dsc->slice_count * dsc->slice_chunk_size;
> +}
> +
> +#endif /* MSM_DSC_HELPER_H_ */
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH v12 5/9] drm/msm: Add MSM-specific DSC helper methods
2023-05-17 23:01 ` Marijn Suijten
@ 2023-05-18 0:26 ` Jessica Zhang
0 siblings, 0 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-18 0:26 UTC (permalink / raw)
To: Marijn Suijten
Cc: freedreno, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter, Rob Clark,
Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm
On 5/17/2023 4:01 PM, Marijn Suijten wrote:
> On 2023-05-17 15:27:18, Jessica Zhang wrote:
>> Introduce MSM-specific DSC helper methods, as some calculations are
>> common between DP and DSC.
>>
>> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
>> ---
>> drivers/gpu/drm/msm/msm_dsc_helper.h | 38 ++++++++++++++++++++++++++++++++++++
>> 1 file changed, 38 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/msm/msm_dsc_helper.h b/drivers/gpu/drm/msm/msm_dsc_helper.h
>> new file mode 100644
>> index 000000000000..c7d7ed026368
>> --- /dev/null
>> +++ b/drivers/gpu/drm/msm/msm_dsc_helper.h
>> @@ -0,0 +1,38 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +/*
>> + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved
>> + *
>> + * Helper methods for MSM-specific DSC calculations that are common between timing engine,
>> + * DSI, and DP.
>> + */
>> +
>> +#ifndef MSM_DSC_HELPER_H_
>> +#define MSM_DSC_HELPER_H_
>> +
>> +#include <linux/math.h>
>> +#include <drm/display/drm_dsc_helper.h>
>> +
>> +/**
>> + * msm_dsc_calculate_slices_per_intf() - get number of slices per interface
>
> Oh no, we just went to get to match the function below, and now this is
> back at calculate. My bad, I wasn't clear enough in previous review: I
> meant the ext after the -, so "get number of" -> "calculate number of".
Hi Marijn,
Got it.
>
> Sorry!
>
>> + * @dsc: Pointer to drm dsc config struct
>> + * @intf_width: interface width in pixels
>> + * Returns: Integer representing the number of slices for the given interface
>> + */
>> +static inline u32 msm_dsc_calculate_slices_per_intf(const struct drm_dsc_config *dsc, int intf_width)
>
> u32... also for intf_width?
Acked.
Thanks,
Jessica Zhang
>
> - Marijn
>
>> +{
>> + return DIV_ROUND_UP(intf_width, dsc->slice_width);
>> +}
>> +
>> +/**
>> + * msm_dsc_get_bytes_per_line() - calculate bytes per line
>> + * @dsc: Pointer to drm dsc config struct
>> + * Returns: Integer value representing bytes per line. DSI and DP need
>> + * to perform further calculations to turn this into pclk_per_intf,
>> + * such as dividing by different values depending on if widebus is enabled.
>> + */
>> +static inline u32 msm_dsc_get_bytes_per_line(const struct drm_dsc_config *dsc)
>> +{
>> + return dsc->slice_count * dsc->slice_chunk_size;
>> +}
>> +
>> +#endif /* MSM_DSC_HELPER_H_ */
>>
>> --
>> 2.40.1
>>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v12 6/9] drm/msm/dpu: Use fixed DRM DSC helper for det_thresh_flatness
2023-05-17 22:27 [PATCH v12 0/9] Introduce MSM-specific DSC helpers Jessica Zhang
` (4 preceding siblings ...)
2023-05-17 22:27 ` [PATCH v12 5/9] drm/msm: Add MSM-specific DSC helper methods Jessica Zhang
@ 2023-05-17 22:27 ` Jessica Zhang
2023-05-17 22:27 ` [PATCH v12 7/9] drm/msm/dpu: Fix slice_last_group_size calculation Jessica Zhang
` (2 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-17 22:27 UTC (permalink / raw)
To: freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm, Jessica Zhang
The current dpu_hw_dsc calculation for det_thresh_flatness does not
match the downstream calculation or the DSC spec.
Use the DRM DSC helper for det_thresh_flatness to match downstream
implementation and the DSC spec.
Fixes: c110cfd1753e ("drm/msm/disp/dpu1: Add support for DSC")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
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 4e1396575e6a..3cad6a80af97 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_flatness_det_thresh(dsc);
data = det_thresh_flatness << 10;
data |= dsc->flatness_max_qp << 5;
data |= dsc->flatness_min_qp;
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v12 7/9] drm/msm/dpu: Fix slice_last_group_size calculation
2023-05-17 22:27 [PATCH v12 0/9] Introduce MSM-specific DSC helpers Jessica Zhang
` (5 preceding siblings ...)
2023-05-17 22:27 ` [PATCH v12 6/9] drm/msm/dpu: Use fixed DRM DSC helper for det_thresh_flatness Jessica Zhang
@ 2023-05-17 22:27 ` Jessica Zhang
2023-05-17 22:27 ` [PATCH v12 8/9] drm/msm/dsi: Use MSM and DRM DSC helper methods Jessica Zhang
2023-05-17 22:27 ` [PATCH v12 9/9] drm/msm/dsi: update hdisplay calculation for dsi_timing_setup Jessica Zhang
8 siblings, 0 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-17 22:27 UTC (permalink / raw)
To: freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm, Jessica Zhang
Correct the math for slice_last_group_size so that it matches the
calculations downstream.
Fixes: c110cfd1753e ("drm/msm/disp/dpu1: Add support for DSC")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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 3cad6a80af97..ea7d828b8812 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c
@@ -56,9 +56,10 @@ static void dpu_hw_dsc_config(struct dpu_hw_dsc *hw_dsc,
if (is_cmd_mode)
initial_lines += 1;
- slice_last_group_size = 3 - (dsc->slice_width % 3);
+ slice_last_group_size = (dsc->slice_width + 2) % 3;
+
data = (initial_lines << 20);
- data |= ((slice_last_group_size - 1) << 18);
+ data |= (slice_last_group_size << 18);
/* bpp is 6.4 format, 4 LSBs bits are for fractional part */
data |= (dsc->bits_per_pixel << 8);
data |= (dsc->block_pred_enable << 7);
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v12 8/9] drm/msm/dsi: Use MSM and DRM DSC helper methods
2023-05-17 22:27 [PATCH v12 0/9] Introduce MSM-specific DSC helpers Jessica Zhang
` (6 preceding siblings ...)
2023-05-17 22:27 ` [PATCH v12 7/9] drm/msm/dpu: Fix slice_last_group_size calculation Jessica Zhang
@ 2023-05-17 22:27 ` Jessica Zhang
2023-05-17 22:27 ` [PATCH v12 9/9] drm/msm/dsi: update hdisplay calculation for dsi_timing_setup Jessica Zhang
8 siblings, 0 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-17 22:27 UTC (permalink / raw)
To: freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm, Jessica Zhang
Use MSM and DRM DSC helper methods to configure DSC for DSI.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
drivers/gpu/drm/msm/dsi/dsi_host.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 74d38f90398a..c950755e530f 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -28,6 +28,7 @@
#include "dsi.xml.h"
#include "sfpb.xml.h"
#include "dsi_cfg.h"
+#include "msm_dsc_helper.h"
#include "msm_kms.h"
#include "msm_gem.h"
#include "phy/dsi_phy.h"
@@ -848,7 +849,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod
/* first calculate dsc parameters and then program
* compress mode registers
*/
- slice_per_intf = DIV_ROUND_UP(hdisplay, dsc->slice_width);
+ slice_per_intf = msm_dsc_calculate_slices_per_intf(dsc, hdisplay);
/*
* If slice_count is greater than slice_per_intf
@@ -1759,7 +1760,7 @@ static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct drm_dsc
return ret;
}
- dsc->initial_scale_value = 32;
+ dsc->initial_scale_value = drm_dsc_initial_scale_value(dsc);
dsc->line_buf_depth = dsc->bits_per_component + 1;
return drm_dsc_compute_rc_parameters(dsc);
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v12 9/9] drm/msm/dsi: update hdisplay calculation for dsi_timing_setup
2023-05-17 22:27 [PATCH v12 0/9] Introduce MSM-specific DSC helpers Jessica Zhang
` (7 preceding siblings ...)
2023-05-17 22:27 ` [PATCH v12 8/9] drm/msm/dsi: Use MSM and DRM DSC helper methods Jessica Zhang
@ 2023-05-17 22:27 ` Jessica Zhang
8 siblings, 0 replies; 18+ messages in thread
From: Jessica Zhang @ 2023-05-17 22:27 UTC (permalink / raw)
To: freedreno
Cc: Marijn Suijten, Konrad Dybcio, Kuogee Hsieh, Daniel Vetter,
Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul, dri-devel,
linux-arm-msm, Jessica Zhang
Currently, hdisplay is being divided by 3 for DSC. However, this
calculation only works for cases where BPP = 8.
Update hdisplay calculation to be bytes_per_line / 3, so that it
accounts for cases where BPP != 8.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
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 c950755e530f..918f46580f6d 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -952,7 +952,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
* pulse width same
*/
h_total -= hdisplay;
- hdisplay /= 3;
+ hdisplay = msm_dsc_get_bytes_per_line(msm_host->dsc) / 3;
h_total += hdisplay;
ha_end = ha_start + hdisplay;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread