From 7d7f742677407231b322b22f55a4b52eb7e4fe8e Mon Sep 17 00:00:00 2001 From: Yifan Zhang Date: Fri, 10 Jun 2022 20:43:25 +0800 Subject: [PATCH] drm/amdkcl: Check if display_info->edid_hdmi_rgb444_dc_modes is defined Check if display_info->edid_hdmi_rgb444_dc_modes is defined introduced in v4.9-rc1-522171951761153172c75b94ae1f4bc9ab631745 Signed-off-by: Yifan Zhang Signed-off-by: Ma Jun Change-Id: Ic2659a288fae2af696cf2c3d20c3e97491341c5f --- .../gpu/drm/amd/amdgpu/amdgpu_connectors.c | 4 ++++ drivers/gpu/drm/amd/dkms/config/config.h | 3 +++ .../gpu/drm/amd/dkms/m4/drm-display-info.m4 | 20 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index df8c7f25e61b3..29003b3b5fc5c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -206,7 +206,11 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector) /* Check if bpc is within clock limit. Try to degrade gracefully otherwise */ if ((bpc == 12) && (mode_clock * 3/2 > max_tmds_clock)) { +#ifndef HAVE_DRM_DISPLAY_INFO_EDID_HDMI_RGB444_DC_MODES if ((connector->display_info.edid_hdmi_dc_modes & DRM_EDID_HDMI_DC_30) && +#else + if ((connector->display_info.edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_30) && +#endif (mode_clock * 5/4 <= max_tmds_clock)) bpc = 10; else diff --git a/drivers/gpu/drm/amd/dkms/config/config.h b/drivers/gpu/drm/amd/dkms/config/config.h index 9fbcdef2b828d..d151b0d7be264 100644 --- a/drivers/gpu/drm/amd/dkms/config/config.h +++ b/drivers/gpu/drm/amd/dkms/config/config.h @@ -300,6 +300,9 @@ /* drm_dev_unplug() is available */ #define HAVE_DRM_DEV_UNPLUG 1 +/* display_info->edid_hdmi_rgb444_dc_modes is available */ +/* #undef HAVE_DRM_DISPLAY_INFO_EDID_HDMI_RGB444_DC_MODES */ + /* display_info->hdmi.scdc.scrambling are available */ #define HAVE_DRM_DISPLAY_INFO_HDMI_SCDC_SCRAMBLING 1 diff --git a/drivers/gpu/drm/amd/dkms/m4/drm-display-info.m4 b/drivers/gpu/drm/amd/dkms/m4/drm-display-info.m4 index 6caf2e897645b..30a3f0e477d72 100644 --- a/drivers/gpu/drm/amd/dkms/m4/drm-display-info.m4 +++ b/drivers/gpu/drm/amd/dkms/m4/drm-display-info.m4 @@ -30,6 +30,25 @@ AC_DEFUN([AC_AMDGPU_DRM_DISPLAY_INFO_MAX_TMDS_CLOCK], [ ]) ]) +dnl # +dnl # commit v4.9-rc1-522171951761153172c75b94ae1f4bc9ab631745 +dnl # drm: Extract drm_connector.[hc] +dnl # +AC_DEFUN([AC_AMDGPU_DRM_DISPLAY_INFO_EDID_HDMI_RGB444_DC_MODES], [ + AC_KERNEL_DO_BACKGROUND([ + AC_KERNEL_TRY_COMPILE([ + #include + ], [ + struct drm_display_info *display_info = NULL; + display_info->edid_hdmi_rgb444_dc_modes = 0; + ], [ + AC_DEFINE(HAVE_DRM_DISPLAY_INFO_EDID_HDMI_RGB444_DC_MODES, 1, + [display_info->edid_hdmi_rgb444_dc_modes is available]) + ]) + ]) +]) + + dnl # dnl # commit v5.6-rc2-1062-ga1d11d1efe4d dnl # drm/edid: Add function to parse EDID descriptors for monitor range @@ -52,5 +71,6 @@ AC_DEFUN([AC_AMDGPU_DRM_DISPLAY_INFO_MONITOR_RANGE], [ AC_DEFUN([AC_AMDGPU_DRM_DISPLAY_INFO], [ AC_AMDGPU_DRM_DISPLAY_INFO_HDMI_SCDC_SCRAMBLING AC_AMDGPU_DRM_DISPLAY_INFO_MAX_TMDS_CLOCK + AC_AMDGPU_DRM_DISPLAY_INFO_EDID_HDMI_RGB444_DC_MODES AC_AMDGPU_DRM_DISPLAY_INFO_MONITOR_RANGE ])