diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index a6d501425fc7a..2415a0f594aae 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -546,15 +546,11 @@ dm_dp_mst_detect(struct drm_connector *connector, static int dm_dp_mst_atomic_check(struct drm_connector *connector, struct drm_atomic_state *state) { -#ifdef HAVE_DRM_DP_ATOMIC_RELEASE_TIME_SLOTS struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); struct drm_dp_mst_topology_mgr *mst_mgr = &aconnector->mst_root->mst_mgr; struct drm_dp_mst_port *mst_port = aconnector->mst_output_port; return drm_dp_atomic_release_time_slots(state, mst_mgr, mst_port); -#else - return 0; -#endif } #endif diff --git a/drivers/gpu/drm/amd/dkms/config/config.h b/drivers/gpu/drm/amd/dkms/config/config.h index 36a1d1ab980aa..f984f2be5e8e5 100644 --- a/drivers/gpu/drm/amd/dkms/config/config.h +++ b/drivers/gpu/drm/amd/dkms/config/config.h @@ -379,6 +379,12 @@ /* drm_dp_atomic_find_time_slots() is available */ #define HAVE_DRM_DP_ATOMIC_FIND_TIME_SLOTS 1 +/* drm_dp_atomic_find_vcpi_slots() wants 5args */ +/* #undef HAVE_DRM_DP_ATOMIC_FIND_VCPI_SLOTS_5ARGS */ + +/* drm_dp_atomic_release_vcpi_slots() with drm_dp_mst_port argument is available */ +/* #undef HAVE_DRM_DP_ATOMIC_RELEASE_VCPI_SLOTS_MST_PORT */ + /* drm_dp_mst_atomic_setup_commit() is available */ /* #undef HAVE_DRM_DP_ATOMIC_SETUP_COMMIT */ @@ -386,10 +392,7 @@ /* #undef HAVE_DRM_DP_ATOMIC_WAIT_FOR_DEPENDENCIES */ /* drm_dp_atomic_release_time_slots() is available */ -/* #undef HAVE_DRM_DP_ATOMIC_RELEASE_TIME_SLOTS */ - -/* drm_dp_atomic_find_vcpi_slots() wants 5args */ -#define HAVE_DRM_DP_ATOMIC_FIND_VCPI_SLOTS_5ARGS 1 +#define HAVE_DRM_DP_ATOMIC_RELEASE_TIME_SLOTS /* struct drm_dp_aux has member named 'drm_dev' */ #define HAVE_DRM_DP_AUX_DRM_DEV 1 diff --git a/drivers/gpu/drm/amd/dkms/m4/drm-dp-atomic-funcs.m4 b/drivers/gpu/drm/amd/dkms/m4/drm-dp-atomic-funcs.m4 index c89bcdbf10edd..d50c35a4fd1bc 100644 --- a/drivers/gpu/drm/amd/dkms/m4/drm-dp-atomic-funcs.m4 +++ b/drivers/gpu/drm/amd/dkms/m4/drm-dp-atomic-funcs.m4 @@ -22,8 +22,55 @@ AC_DEFUN([AC_AMDGPU_DRM_DP_ATOMIC_FIND_VCPI_SLOTS], [ ]) ]) + dnl # -dnl # commit v6.1-rc1~27-df78f7f660cd +dnl # commit v5.19-rc6-1758-gdf78f7f660cd +dnl # drm/display/dp_mst: Call them time slots, not VCPI slots +dnl # +AC_DEFUN([AC_AMDGPU_DRM_DP_ATOMIC_RELEASE_VCPI_SLOTS], [ + AC_KERNEL_DO_BACKGROUND([ + AC_KERNEL_TRY_COMPILE([ + #if defined(HAVE_DRM_DISPLAY_DRM_DP_MST_HELPER_H) + #include + #elif defined(HAVE_DRM_DP_DRM_DP_MST_HELPER_H) + #include + #else + #include + #endif + ],[ + int ret; + ret = drm_dp_atomic_release_time_slots(NULL, NULL, NULL); + ],[ + AC_DEFINE(HAVE_DRM_DP_ATOMIC_RELEASE_TIME_SLOTS, 1, + [drm_dp_atomic_release_time_slots() is available]) + ],[ + dnl # + dnl # commit v4.20-rc4-1031-geceae1472467 + dnl # drm/dp_mst: Start tracking per-port VCPI allocations + dnl # + AC_KERNEL_TRY_COMPILE([ + #if defined(HAVE_DRM_DISPLAY_DRM_DP_MST_HELPER_H) + #include + #elif defined(HAVE_DRM_DP_DRM_DP_MST_HELPER_H) + #include + #else + #include + #endif + ],[ + int ret; + struct drm_dp_mst_port *port; + ret = drm_dp_atomic_release_vcpi_slots(NULL, NULL, port); + ],[ + AC_DEFINE(HAVE_DRM_DP_ATOMIC_RELEASE_VCPI_SLOTS_MST_PORT, 1, + [drm_dp_atomic_release_vcpi_slots() with drm_dp_mst_port argument is available]) + ]) + ]) + ]) +]) + + +dnl # +dnl # commit v5.19-rc6-1758-gdf78f7f660cd dnl # drm/display/dp_mst: Call them time slots, not VCPI slots dnl # AC_DEFUN([AC_AMDGPU_DRM_DP_ATOMIC_FIND_TIME_SLOTS], [ @@ -102,29 +149,11 @@ AC_DEFUN([AC_AMDGPU_DRM_DP_MST_ROOT_CONN_ATOMIC_CHECK], [ ]) ]) -dnl # -dnl # commit v6.1-rc1~27-df78f7f660cd -dnl # drm/display/dp_mst: Call them time slots, not VCPI slots -dnl # -AC_DEFUN([AC_AMDGPU_DRM_DP_ATOMIC_RELEASE_TIME_SLOTS], [ - AC_KERNEL_DO_BACKGROUND([ - AC_KERNEL_TRY_COMPILE([ - #include - ],[ - int ret; - ret = drm_dp_atomic_release_time_slots(NULL, NULL, NULL); - ],[ - AC_DEFINE(HAVE_DRM_DP_ATOMIC_RELEASE_TIME_SLOTS, 1, - [drm_dp_atomic_release_time_slots() is available]) - ]) - ]) -]) - AC_DEFUN([AC_AMDGPU_DRM_DP_ATOMIC_FUNCS], [ AC_AMDGPU_DRM_DP_ATOMIC_FIND_VCPI_SLOTS + AC_AMDGPU_DRM_DP_ATOMIC_RELEASE_VCPI_SLOTS AC_AMDGPU_DRM_DP_ATOMIC_FIND_TIME_SLOTS AC_AMDGPU_DRM_DP_ATOMIC_SETUP_COMMIT AC_AMDGPU_DRM_DP_ATOMIC_WAIT_FOR_DEPENDENCIES AC_AMDGPU_DRM_DP_MST_ROOT_CONN_ATOMIC_CHECK - AC_AMDGPU_DRM_DP_ATOMIC_RELEASE_TIME_SLOTS ]) diff --git a/include/kcl/backport/kcl_drm_dp_mst_helper_backport.h b/include/kcl/backport/kcl_drm_dp_mst_helper_backport.h index 7b0e5f6ed8dfd..97216b2e7e72a 100644 --- a/include/kcl/backport/kcl_drm_dp_mst_helper_backport.h +++ b/include/kcl/backport/kcl_drm_dp_mst_helper_backport.h @@ -40,6 +40,8 @@ int _kcl_drm_dp_calc_pbn_mode(int clock, int bpp, bool dsc) #define drm_dp_calc_pbn_mode _kcl_drm_dp_calc_pbn_mode #endif + +#if !defined(HAVE_DRM_DP_ATOMIC_FIND_TIME_SLOTS) #if !defined(HAVE_DRM_DP_ATOMIC_FIND_VCPI_SLOTS_5ARGS) static inline int _kcl_drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, @@ -65,7 +67,6 @@ int _kcl_drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, #define drm_dp_atomic_find_vcpi_slots _kcl_drm_dp_atomic_find_vcpi_slots #endif /* HAVE_DRM_DP_ATOMIC_FIND_VCPI_SLOTS_5ARGS */ -#if !defined(HAVE_DRM_DP_ATOMIC_FIND_TIME_SLOTS) static inline int _kcl_drm_dp_atomic_find_time_slots(struct drm_atomic_state *state, struct drm_dp_mst_topology_mgr *mgr, @@ -75,6 +76,19 @@ int _kcl_drm_dp_atomic_find_time_slots(struct drm_atomic_state *state, return drm_dp_atomic_find_vcpi_slots(state, mgr, port, pbn, pbn_div); } #define drm_dp_atomic_find_time_slots _kcl_drm_dp_atomic_find_time_slots +#endif /* HAVE_DRM_DP_ATOMIC_FIND_TIME_SLOTS */ + +#if !defined(HAVE_DRM_DP_ATOMIC_RELEASE_TIME_SLOTS) +#ifdef HAVE_DRM_DP_ATOMIC_RELEASE_VCPI_SLOTS_MST_PORT +static inline +int _kcl_drm_dp_atomic_release_time_slots(struct drm_atomic_state *state, + struct drm_dp_mst_topology_mgr *mgr, + struct drm_dp_mst_port *port) +{ + return drm_dp_atomic_release_vcpi_slots(state, mgr, port); +} +#define drm_dp_atomic_release_time_slots _kcl_drm_dp_atomic_release_time_slots +#endif #endif #ifndef HAVE_DRM_DP_MST_TOPOLOGY_MGR_RESUME_2ARGS