drm/amd/display: fix PSR-SU/DSC interoperability support
Subsystems (3)
PATCH v2 1/1 drm/amd/display: fix PSR-SU/DSC interoperability support
Currently, there are issues with enabling PSR-SU + DSC. This stems from the fact that DSC imposes a slice height on transmitted video data and we are not conforming to that slice height in PSR-SU regions. So, pass slice_height into su_y_granularity to feed the DSC slice height into PSR-SU code.
---
v2: move code to modules/power.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 3 ++ .../amd/display/modules/power/power_helpers.c | 35 +++++++++++++++++++ .../amd/display/modules/power/power_helpers.h | 3 ++ 3 files changed, 41 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +3 -0
@@ -122,6 +122,9 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream) psr_config.allow_multi_disp_optimizations = (amdgpu_dc_feature_mask &DC_PSR_ALLOW_MULTI_DISP_OPT ); +if (!psr_su_set_y_granularity (dc, link, stream, &psr_config)) +return false; + ret =dc_link_setup_psr (link, stream, &psr_config, &psr_context); }
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +35 -0
@@ -916,3 +916,38 @@ bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s {return context && context->stream_count ==1 &&dc_is_embedded_signal (stream->signal); } + +bool psr_su_set_y_granularity (struct dc *dc,struct dc_link *link, +struct dc_stream_state *stream, +struct psr_config *config) +{ +uint16_t pic_height; +uint8_t slice_height; + +if (!dc->caps.edp_dsc_support || + link->panel_config.dsc.disable_dsc_edp || + !link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT || + !stream->timing.dsc_cfg.num_slices_v) +return true; + + pic_height = stream->timing.v_addressable + + stream->timing.v_border_top + stream->timing.v_border_bottom; + slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v; + +if (slice_height) { +if (config->su_y_granularity && + (slice_height % config->su_y_granularity)) { +WARN (1 , +"%s: dsc: %d, slice_height: %d, num_slices_v: %d\n" , + __func__, + stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported, + slice_height, + stream->timing.dsc_cfg.num_slices_v); +return false; + } + + config->su_y_granularity = slice_height; + } + +return true; +}
drivers/gpu/drm/amd/display/modules/power/power_helpers.h +3 -0
@@ -59,4 +59,7 @@ void mod_power_calc_psr_configs(struct psr_config *psr_config, const struct dc_stream_state *stream);bool mod_power_only_edp (const struct dc_state *context,const struct dc_stream_state *stream); +bool psr_su_set_y_granularity (struct dc *dc,struct dc_link *link, +struct dc_stream_state *stream, +struct psr_config *config);#endif /* MODULES_POWER_POWER_HELPERS_H_ */
Signature · 1 line
2.38.1
Harry Wentland
maintainerQuoted 39 lines · Hamza Mahfooz
Currently, there are issues with enabling PSR-SU + DSC. This stems from the fact that DSC imposes a slice height on transmitted video data and we are not conforming to that slice height in PSR-SU regions. So, pass
slice_heightintosu_y_granularityto feed the DSC slice height into PSR-SU code.Signed-off-by Hamza Mahfooz <[email protected]>---
v2: move code to modules/power.--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 3 ++ .../amd/display/modules/power/power_helpers.c | 35 +++++++++++++++++++ .../amd/display/modules/power/power_helpers.h | 3 ++ 3 files changed, 41 insertions(+)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +3
-0@@ -122,6 +122,9 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream) psr_config.allow_multi_disp_optimizations = (amdgpu_dc_feature_mask &DC_PSR_ALLOW_MULTI_DISP_OPT ); +if (!psr_su_set_y_granularity (dc, link, stream, &psr_config)) +return false; + ret =dc_link_setup_psr (link, stream, &psr_config, &psr_context); }drivers/gpu/drm/amd/display/modules/power/power_helpers.c +2
-0@@ -916,3 +916,38 @@ bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s {return context && context->stream_count ==1 &&dc_is_embedded_signal (stream->signal); } + +bool psr_su_set_y_granularity(struct dc *dc, struct dc_link *link,
drivers/gpu/drm/amd/display/modules/power/power_helpers.c bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s · line 930
Quoted 10 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +10
-0+struct dc_stream_state *stream, + struct psr_config *config) +{ + uint16_t pic_height; +uint8_t slice_height; + +if (!dc->caps.edp_dsc_support || + link->panel_config.dsc.disable_dsc_edp || + !link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT || + !stream->timing.dsc_cfg.num_slices_v)
I'm not sure this condition is correct. We can have DSC but not eDP DSC support.
drivers/gpu/drm/amd/display/modules/power/power_helpers.c bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s · line 940
Quoted 10 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +10
-0+return true; + + pic_height = stream->timing.v_addressable + + stream->timing.v_border_top + stream->timing.v_border_bottom; + slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v; + +if (slice_height) { +if (config->su_y_granularity && + (slice_height % config->su_y_granularity)) { + WARN(1,
We don't use WARN in display/dc or display/modules. DC_LOG_WARNING might be better, or log it in the caller.
Harry
Quoted 25 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +13
-0+"%s: dsc: %d, slice_height: %d, num_slices_v: %d\n" , + __func__, + stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported, + slice_height, + stream->timing.dsc_cfg.num_slices_v); +return false; + } + + config->su_y_granularity = slice_height; + } + +return true; +}drivers/gpu/drm/amd/display/modules/power/power_helpers.h +3
-0@@ -59,4 +59,7 @@ void mod_power_calc_psr_configs(struct psr_config *psr_config, const struct dc_stream_state *stream);bool mod_power_only_edp (const struct dc_state *context,const struct dc_stream_state *stream); +bool psr_su_set_y_granularity (struct dc *dc,struct dc_link *link, +struct dc_stream_state *stream, +struct psr_config *config);#endif /* MODULES_POWER_POWER_HELPERS_H_ */
Quoted 47 lines · Harry Wentland
Quoted 44 lines · Hamza Mahfooz
Currently, there are issues with enabling PSR-SU + DSC. This stems from the fact that DSC imposes a slice height on transmitted video data and we are not conforming to that slice height in PSR-SU regions. So, pass
slice_heightintosu_y_granularityto feed the DSC slice height into PSR-SU code.Signed-off-by Hamza Mahfooz <[email protected]>---
v2: move code to modules/power.--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 3 ++ .../amd/display/modules/power/power_helpers.c | 35 +++++++++++++++++++ .../amd/display/modules/power/power_helpers.h | 3 ++ 3 files changed, 41 insertions(+)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +3
-0@@ -122,6 +122,9 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream) psr_config.allow_multi_disp_optimizations = (amdgpu_dc_feature_mask &DC_PSR_ALLOW_MULTI_DISP_OPT ); +if (!psr_su_set_y_granularity (dc, link, stream, &psr_config)) +return false; + ret =dc_link_setup_psr (link, stream, &psr_config, &psr_context); }drivers/gpu/drm/amd/display/modules/power/power_helpers.c +7
-0@@ -916,3 +916,38 @@ bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s {return context && context->stream_count ==1 &&dc_is_embedded_signal (stream->signal); } + +bool psr_su_set_y_granularity (struct dc *dc,struct dc_link *link, +struct dc_stream_state *stream, +struct psr_config *config) +{ +uint16_t pic_height; +uint8_t slice_height;
Quoted 9 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s · line 930
Quoted 5 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +5
-0+ +if (!dc->caps.edp_dsc_support || + link->panel_config.dsc.disable_dsc_edp || + !link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT || + !stream->timing.dsc_cfg.num_slices_v)I'm not sure this condition is correct. We can have DSC but not eDP DSC support.
AFAIK PSR-SU displays use eDP exclusively, so we shouldn't have to worry about this case.
Quoted 42 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s · line 940
Quoted 10 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +10
-0+return true; + + pic_height = stream->timing.v_addressable + + stream->timing.v_border_top + stream->timing.v_border_bottom; + slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v; + +if (slice_height) { +if (config->su_y_granularity && + (slice_height % config->su_y_granularity)) { + WARN(1,We don't use WARN in display/dc or display/modules.
DC_LOG_WARNINGmight be better, or log it in the caller.Harry
Quoted 25 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +13
-0+"%s: dsc: %d, slice_height: %d, num_slices_v: %d\n" , + __func__, + stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported, + slice_height, + stream->timing.dsc_cfg.num_slices_v); +return false; + } + + config->su_y_granularity = slice_height; + } + +return true; +}drivers/gpu/drm/amd/display/modules/power/power_helpers.h +3
-0@@ -59,4 +59,7 @@ void mod_power_calc_psr_configs(struct psr_config *psr_config, const struct dc_stream_state *stream);bool mod_power_only_edp (const struct dc_state *context,const struct dc_stream_state *stream); +bool psr_su_set_y_granularity (struct dc *dc,struct dc_link *link, +struct dc_stream_state *stream, +struct psr_config *config);#endif /* MODULES_POWER_POWER_HELPERS_H_ */
Signature · 1 line
Hamza
Leo Li
maintainerQuoted 59 lines · Hamza Mahfooz
Quoted 48 lines · Harry Wentland
Quoted 45 lines · Hamza Mahfooz
Currently, there are issues with enabling PSR-SU + DSC. This stems from the fact that DSC imposes a slice height on transmitted video data and we are not conforming to that slice height in PSR-SU regions. So, pass
slice_heightintosu_y_granularityto feed the DSC slice height into PSR-SU code.Signed-off-by Hamza Mahfooz <[email protected]>---
v2: move code to modules/power.
---.../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 3 ++ .../amd/display/modules/power/power_helpers.c | 35 +++++++++++++++++++ .../amd/display/modules/power/power_helpers.h | 3 ++ 3 files changed, 41 insertions(+)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +0
-0@@ -122,6 +122,9 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream)psr_config.allow_multi_disp_optimizations = (
amdgpu_dc_feature_mask&DC_PSR_ALLOW_MULTI_DISP_OPT); + if (!psr_su_set_y_granularity(dc, link, stream,&psr_config)) + return false;
+
ret =dc_link_setup_psr(link, stream, &psr_config, &psr_context); }drivers/gpu/drm/amd/display/modules/power/power_helpers.c +0
-0@@ -916,3 +916,38 @@ bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s { return context && context->stream_count == 1 && dc_is_embedded_signal(stream->signal);}
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +8
-0+ +bool psr_su_set_y_granularity (struct dc *dc,struct dc_link *link, + struct dc_stream_state *stream, + struct psr_config *config) +{ + uint16_t pic_height; + uint8_t slice_height; +Quoted 9 lines
Quoted 5 lines
+ if (!dc->caps.edp_dsc_support ||
+link->panel_config.dsc.disable_dsc_edp||
+ !link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT || + !stream->timing.dsc_cfg.num_slices_v)I'm not sure this condition is correct. We can have DSC but not eDP DSC support.
Quoted 1 line
AFAIK PSR-SU displays use eDP exclusively, so we shouldn't have to worry about this case.
Right, the dc_link here should only be eDP. I suppose that isn't quite clear.
Maybe add this as part of the condition?
if (!(link->connector_signal & SIGNAL_TYPE_EDP))
return true;
Thanks,
Leo
Quoted 45 lines
Quoted 44 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s · line 940
Quoted 11 lines
+ return true;
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +9
-0+ + pic_height = stream->timing.v_addressable + + stream->timing.v_border_top + stream->timing.v_border_bottom; + slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v; + + if (slice_height) { + if (config->su_y_granularity && + (slice_height % config->su_y_granularity)) { + WARN(1,We don't use WARN in display/dc or display/modules.
DC_LOG_WARNINGmight be better, or log it in the caller.Harry
Quoted 26 lines
+ "%s: dsc: %d,
slice_height: %d,num_slices_v: %d\n", +__func__,
+stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported, +slice_height,
+stream->timing.dsc_cfg.num_slices_v);
+ return false;
+ }drivers/gpu/drm/amd/display/modules/power/power_helpers.c +6
-0+ + config->su_y_granularity = slice_height; + } + + return true; +}drivers/gpu/drm/amd/display/modules/power/power_helpers.h +3
-0@@ -59,4 +59,7 @@ void mod_power_calc_psr_configs(struct psr_config *psr_config, const struct dc_stream_state *stream); bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_state *stream); +bool psr_su_set_y_granularity (struct dc *dc,struct dc_link *link, + struct dc_stream_state *stream, + struct psr_config *config);#endif /*
MODULES_POWER_POWER_HELPERS_H_*/
Harry Wentland
maintainerQuoted 60 lines · Leo Li
Quoted 56 lines · Hamza Mahfooz
Quoted 54 lines · Harry Wentland
Quoted 37 lines · Hamza Mahfooz
Currently, there are issues with enabling PSR-SU + DSC. This stems from the fact that DSC imposes a slice height on transmitted video data and we are not conforming to that slice height in PSR-SU regions. So, pass
slice_heightintosu_y_granularityto feed the DSC slice height into PSR-SU code.Signed-off-by Hamza Mahfooz <[email protected]>---
v2: move code to modules/power.
---.../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 3 ++ .../amd/display/modules/power/power_helpers.c | 35 +++++++++++++++++++ .../amd/display/modules/power/power_helpers.h | 3 ++ 3 files changed, 41 insertions(+)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +0
-0@@ -122,6 +122,9 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream)psr_config.allow_multi_disp_optimizations = (
amdgpu_dc_feature_mask&DC_PSR_ALLOW_MULTI_DISP_OPT); + if (!psr_su_set_y_granularity(dc, link, stream,&psr_config)) + return false;
+
ret =dc_link_setup_psr(link, stream, &psr_config, &psr_context); }drivers/gpu/drm/amd/display/modules/power/power_helpers.c +2
-0@@ -916,3 +916,38 @@ bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s { return context && context->stream_count == 1 && dc_is_embedded_signal(stream->signal); } + +bool psr_su_set_y_granularity(struct dc *dc, struct dc_link *link,drivers/gpu/drm/amd/display/modules/power/power_helpers.c bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s · line 930
Quoted 10 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +10
-0+ struct dc_stream_state *stream, + struct psr_config *config) +{ + uint16_t pic_height; + uint8_t slice_height; + + if (!dc->caps.edp_dsc_support || + link->panel_config.dsc.disable_dsc_edp || + !link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT || + !stream->timing.dsc_cfg.num_slices_v)I'm not sure this condition is correct. We can have DSC but not eDP DSC support.
Quoted 5 lines
Quoted 1 line
AFAIK PSR-SU displays use eDP exclusively, so we shouldn't have to worry about this case.
Right, the
dc_linkhere should only be eDP. I suppose that isn't quite clear.
Right, I was thinking of DSC but PSR-SU is eDP only.
Harry
Quoted 52 lines
Maybe add this as part of the condition?
if (!(link->connector_signal &
SIGNAL_TYPE_EDP))
return true;Thanks,
LeoQuoted 44 lines
Quoted 43 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s · line 940
Quoted 11 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +10
-0+ return true; + + pic_height = stream->timing.v_addressable + + stream->timing.v_border_top + stream->timing.v_border_bottom; + slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v; + + if (slice_height) { + if (config->su_y_granularity && + (slice_height % config->su_y_granularity)) { + WARN(1,We don't use WARN in display/dc or display/modules.
DC_LOG_WARNINGmight be better, or log it in the caller.Harry
Quoted 25 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +13
-0+ "%s: dsc: %d, slice_height: %d, num_slices_v: %d\n", + __func__, + stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported, + slice_height, + stream->timing.dsc_cfg.num_slices_v); + return false; + } + + config->su_y_granularity = slice_height; + } + + return true; +}drivers/gpu/drm/amd/display/modules/power/power_helpers.h +3
-0@@ -59,4 +59,7 @@ void mod_power_calc_psr_configs(struct psr_config *psr_config, const struct dc_stream_state *stream); bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_state *stream); +bool psr_su_set_y_granularity (struct dc *dc,struct dc_link *link, + struct dc_stream_state *stream, + struct psr_config *config); #endif /* MODULES_POWER_POWER_HELPERS_H_ */