From 1a3c1167ddc8d22b25bb9141bcc14fb9a8dba32f Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 11 Oct 2024 02:54:38 +0000 Subject: [PATCH] drm/amd/display: Add HDR workaround for specific eDP From Alex Hung 487f6450bcb920ba1d58954c9e1ab969533b5da8 in linux-6.6.y/6.6.55 05af800704ee7187d9edd461ec90f3679b1c4aba in mainline linux --- sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++++++++- .../pci/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 4 ++++ sys/dev/pci/drm/amd/display/dc/dc_types.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c index a74f6e9489e..0c871c9338c 100644 --- a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6157,12 +6157,21 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT || stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST || stream->signal == SIGNAL_TYPE_EDP) { + const struct dc_edid_caps *edid_caps; + unsigned int disable_colorimetry = 0; + + if (aconnector->dc_sink) { + edid_caps = &aconnector->dc_sink->edid_caps; + disable_colorimetry = edid_caps->panel_patch.disable_colorimetry; + } + // // should decide stream support vsc sdp colorimetry capability // before building vsc info packet // stream->use_vsc_sdp_for_colorimetry = stream->link->dpcd_caps.dpcd_rev.raw >= 0x14 && - stream->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED; + stream->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED && + !disable_colorimetry; if (stream->out_transfer_func->tf == TRANSFER_FUNCTION_GAMMA22) tf = TRANSFER_FUNC_GAMMA_22; diff --git a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index 05bcc928713..23a0bc96a52 100644 --- a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -71,6 +71,10 @@ static void apply_edid_quirks(struct edid *edid, struct dc_edid_caps *edid_caps) DRM_DEBUG_DRIVER("Clearing DPCD 0x317 on monitor with panel id %X\n", panel_id); edid_caps->panel_patch.remove_sink_ext_caps = true; break; + case drm_edid_encode_panel_id('S', 'D', 'C', 0x4154): + DRM_DEBUG_DRIVER("Disabling VSC on monitor with panel id %X\n", panel_id); + edid_caps->panel_patch.disable_colorimetry = true; + break; default: return; } diff --git a/sys/dev/pci/drm/amd/display/dc/dc_types.h b/sys/dev/pci/drm/amd/display/dc/dc_types.h index cc173ecf78e..6eaa02a8034 100644 --- a/sys/dev/pci/drm/amd/display/dc/dc_types.h +++ b/sys/dev/pci/drm/amd/display/dc/dc_types.h @@ -190,6 +190,7 @@ struct dc_panel_patch { unsigned int skip_avmute; unsigned int mst_start_top_delay; unsigned int remove_sink_ext_caps; + unsigned int disable_colorimetry; }; struct dc_edid_caps { -- 2.20.1