drm/edid: add a quirk for two LG monitors to get them to work on 10bpc
Subsystems (4)
PATCH 1/3 drm/edid: add a quirk for two LG monitors to get them to work on 10bpc
The LG 27GP950 and LG 27GN950 have visible display corruption when trying to use 10bpc modes. So, to fix this, cap their maximum DSC target bitrate to 15bpp.
--- drivers/gpu/drm/drm_edid.c | 12 ++++++++++++ include/drm/drm_connector.h | 6 ++++++ 2 files changed, 18 insertions(+)
drivers/gpu/drm/drm_edid.c +12 -0
@@ -91,6 +91,8 @@ static int oui(u8 first, u8 second, u8 third)#define EDID_QUIRK_FORCE_10BPC (1 << 11)/* Non desktop display (i.e. HMD) */ #define EDID_QUIRK_NON_DESKTOP (1 << 12) +/* Cap the DSC target bitrate to 15bpp */ +#define EDID_QUIRK_CAP_DSC_15BPP (1 << 13)#define MICROSOFT_IEEE_OUI 0xca125c
@@ -151,6 +153,12 @@ static const struct edid_quirk {EDID_QUIRK ('F' ,'C' ,'M' ,13600 ,EDID_QUIRK_PREFER_LARGE_75 |EDID_QUIRK_DETAILED_IN_CM ), +/* LG 27GP950 */ +EDID_QUIRK ('G' ,'S' ,'M' ,0x5bbf ,EDID_QUIRK_CAP_DSC_15BPP ), + +/* LG 27GN950 */ +EDID_QUIRK ('G' ,'S' ,'M' ,0x5b9a ,EDID_QUIRK_CAP_DSC_15BPP ), +/* LGD panel of HP zBook 17 G2, eDP 10 bpc, but reports unknown bpc */ EDID_QUIRK('L', 'G', 'D', 764, EDID_QUIRK_FORCE_10BPC),
@@ -5511,6 +5519,7 @@ drm_reset_display_info(struct drm_connector *connector) info->mso_stream_count =0 ; info->mso_pixel_overlap =0 ; + info->max_dsc_bpp =0 ; }u32 drm_add_display_info (struct drm_connector *connector,const struct edid *edid)
@@ -5595,6 +5604,9 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi info->non_desktop = true; } +if (quirks &EDID_QUIRK_CAP_DSC_15BPP ) + info->max_dsc_bpp =15 ; +return quirks; }
include/drm/drm_connector.h +6 -0
@@ -634,6 +634,12 @@ struct drm_display_info {* @mso_pixel_overlap: eDP MSO segment pixel overlap, 0-8 pixels. */ u8 mso_pixel_overlap; + +/** +* @max_dsc_bpp: Maximum DSC target bitrate, if it is set to 0 the +* monitor's default value is used instead. +*/ +u32 max_dsc_bpp; }; int drm_display_info_set_bus_formats(struct drm_display_info *info,
Signature · 1 line
2.38.0
PATCH 2/3 drm/amd/display: use max_dsc_bpp in amdgpu_dm
Since, the quirk is handled in the DRM core now, we can use that value instead of the internal value.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++---- .../drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -4
@@ -5618,16 +5618,14 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector, {struct drm_connector *drm_connector = &aconnector->base;uint32_t link_bandwidth_kbps; -uint32_t max_dsc_target_bpp_limit_override =0 ;struct dc *dc = sink->ctx->dc;uint32_t max_supported_bw_in_kbps, timing_bw_in_kbps;uint32_t dsc_max_supported_bw_in_kbps; +uint32_t max_dsc_target_bpp_limit_override = + drm_connector->display_info.max_dsc_bpp; link_bandwidth_kbps =dc_link_bandwidth_kbps (aconnector->dc_link,dc_link_get_link_cap (aconnector->dc_link)); -if (stream->link && stream->link->local_sink) - max_dsc_target_bpp_limit_override = - stream->link->local_sink->edid_caps.panel_patch.max_dsc_target_bpp_limit;/* Set DSC policy according to dsc_clock_en */ dc_dsc_policy_set_enable_dsc_when_not_needed(
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +9 -2
@@ -670,15 +670,18 @@ static void set_dsc_configs_from_fairness_vars(struct dsc_mst_fairness_params *p int count, int k) { +struct drm_connector *drm_connector;int i;for (i =0 ; i < count; i++) { + drm_connector = ¶ms[i].aconnector->base; +memset (¶ms[i].timing->dsc_cfg,0 ,sizeof (params[i].timing->dsc_cfg));if (vars[i + k].dsc_enabled &&dc_dsc_compute_config ( params[i].sink->ctx->dc->res_pool->dscs[0 ], ¶ms[i].sink->dsc_caps.dsc_dec_caps, params[i].sink->ctx->dc->debug.dsc_min_slice_height_override, - params[i].sink->edid_caps.panel_patch.max_dsc_target_bpp_limit, + drm_connector->display_info.max_dsc_bpp,0 , params[i].timing, ¶ms[i].timing->dsc_cfg)) {
@@ -720,12 +723,16 @@ static int bpp_x16_from_pbn(struct dsc_mst_fairness_params param, int pbn)struct dc_dsc_config dsc_config;u64 kbps; +struct drm_connector *drm_connector = ¶m.aconnector->base; +uint32_t max_dsc_target_bpp_limit_override = + drm_connector->display_info.max_dsc_bpp; + kbps =div_u64 ((u64 )pbn *994 *8 *54 ,64 );dc_dsc_compute_config ( param.sink->ctx->dc->res_pool->dscs[0 ], ¶m.sink->dsc_caps.dsc_dec_caps, param.sink->ctx->dc->debug.dsc_min_slice_height_override, - param.sink->edid_caps.panel_patch.max_dsc_target_bpp_limit, + max_dsc_target_bpp_limit_override, (int ) kbps, param.timing, &dsc_config);return dsc_config.bits_per_pixel;
Signature · 1 line
2.38.0
PATCH 3/3 Revert "drm/amd/display: Limit max DSC target bpp for specific monitors"
In reply to Hamza MahfoozThis reverts commit 55eea8ef98641f6e1e1c202bd3a49a57c1dd4059.
This quirk is now handled in the DRM core, so we can drop all of the internal code that was added to handle it.
--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 35 ------------------- 1 file changed, 35 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +0 -35
@@ -41,39 +41,6 @@#include "dm_helpers.h" #include "ddc_service_types.h" -struct monitor_patch_info { -unsigned int manufacturer_id; -unsigned int product_id; -void (*patch_func)(struct dc_edid_caps *edid_caps,unsigned int param); -unsigned int patch_param; -}; -static void set_max_dsc_bpp_limit (struct dc_edid_caps *edid_caps,unsigned int param); - -static const struct monitor_patch_info monitor_patch_table[] = { -{0x6D1E ,0x5BBF , set_max_dsc_bpp_limit,15 }, -{0x6D1E ,0x5B9A , set_max_dsc_bpp_limit,15 }, -}; - -static void set_max_dsc_bpp_limit (struct dc_edid_caps *edid_caps,unsigned int param) -{ -if (edid_caps) - edid_caps->panel_patch.max_dsc_target_bpp_limit = param; -} - -static int amdgpu_dm_patch_edid_caps (struct dc_edid_caps *edid_caps) -{ -int i, ret =0 ; - -for (i =0 ; i <ARRAY_SIZE (monitor_patch_table); i++) -if ((edid_caps->manufacturer_id == monitor_patch_table[i].manufacturer_id) - && (edid_caps->product_id == monitor_patch_table[i].product_id)) { - monitor_patch_table[i].patch_func (edid_caps, monitor_patch_table[i].patch_param); - ret++; - } - -return ret; -} -/* dm_helpers_parse_edid_caps * * Parse edid caps
@@ -148,8 +115,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(kfree (sads);kfree (sadb); -amdgpu_dm_patch_edid_caps (edid_caps); -return result; }
Signature · 1 line
2.38.0
Re: [PATCH 3/3] Revert "drm/amd/display: Limit max DSC target bpp for specific monitors"
Series is
Harry
Quoted 63 lines · Hamza Mahfooz
This reverts commit
55eea8ef98641f6e1e1c202bd3a49a57c1dd4059.This quirk is now handled in the DRM core, so we can drop all of the internal code that was added to handle it.
Signed-off-by Hamza Mahfooz <[email protected]>--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 35 ------------------- 1 file changed, 35 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +0
-35@@ -41,39 +41,6 @@#include "dm_helpers.h" #include "ddc_service_types.h" -struct monitor_patch_info { -unsigned int manufacturer_id; -unsigned int product_id; -void (*patch_func)(struct dc_edid_caps *edid_caps,unsigned int param); -unsigned int patch_param; -}; -static void set_max_dsc_bpp_limit (struct dc_edid_caps *edid_caps,unsigned int param); - -static const struct monitor_patch_info monitor_patch_table[] = { -{0x6D1E ,0x5BBF , set_max_dsc_bpp_limit,15 }, -{0x6D1E ,0x5B9A , set_max_dsc_bpp_limit,15 }, -}; - -static void set_max_dsc_bpp_limit (struct dc_edid_caps *edid_caps,unsigned int param) -{ -if (edid_caps) - edid_caps->panel_patch.max_dsc_target_bpp_limit = param; -} - -static int amdgpu_dm_patch_edid_caps (struct dc_edid_caps *edid_caps) -{ -int i, ret =0 ; - -for (i =0 ; i <ARRAY_SIZE (monitor_patch_table); i++) -if ((edid_caps->manufacturer_id == monitor_patch_table[i].manufacturer_id) - && (edid_caps->product_id == monitor_patch_table[i].product_id)) { - monitor_patch_table[i].patch_func (edid_caps, monitor_patch_table[i].patch_param); - ret++; - } - -return ret; -} -/* dm_helpers_parse_edid_caps * * Parse edid caps @@ -148,8 +115,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(kfree (sads);kfree (sadb); -amdgpu_dm_patch_edid_caps (edid_caps); -return result; }
Re: [PATCH 3/3] Revert "drm/amd/display: Limit max DSC target bpp for specific monitors"
@Daniel Vetter
, @Dave Airlie
Any objections taking this through the AMD tree or would you rather it landed via drm-misc?
Thanks,
Alex
Quoted 72 lines · Harry Wentland
Series is
Reviewed-by Harry Wentland <[email protected]>Harry
Quoted 63 lines · Hamza Mahfooz
This reverts commit
55eea8ef98641f6e1e1c202bd3a49a57c1dd4059.This quirk is now handled in the DRM core, so we can drop all of the internal code that was added to handle it.
Signed-off-by Hamza Mahfooz <[email protected]>--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 35 ------------------- 1 file changed, 35 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +0
-35@@ -41,39 +41,6 @@#include "dm_helpers.h" #include "ddc_service_types.h" -struct monitor_patch_info { -unsigned int manufacturer_id; -unsigned int product_id; -void (*patch_func)(struct dc_edid_caps *edid_caps,unsigned int param); -unsigned int patch_param; -}; -static void set_max_dsc_bpp_limit (struct dc_edid_caps *edid_caps,unsigned int param); - -static const struct monitor_patch_info monitor_patch_table[] = { -{0x6D1E ,0x5BBF , set_max_dsc_bpp_limit,15 }, -{0x6D1E ,0x5B9A , set_max_dsc_bpp_limit,15 }, -}; - -static void set_max_dsc_bpp_limit (struct dc_edid_caps *edid_caps,unsigned int param) -{ -if (edid_caps) - edid_caps->panel_patch.max_dsc_target_bpp_limit = param; -} - -static int amdgpu_dm_patch_edid_caps (struct dc_edid_caps *edid_caps) -{ -int i, ret =0 ; - -for (i =0 ; i <ARRAY_SIZE (monitor_patch_table); i++) -if ((edid_caps->manufacturer_id == monitor_patch_table[i].manufacturer_id) - && (edid_caps->product_id == monitor_patch_table[i].product_id)) { - monitor_patch_table[i].patch_func (edid_caps, monitor_patch_table[i].patch_param); - ret++; - } - -return ret; -} -/* dm_helpers_parse_edid_caps * * Parse edid caps @@ -148,8 +115,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(kfree (sads);kfree (sadb); -amdgpu_dm_patch_edid_caps (edid_caps); -return result; }