Skip to content

Commit

Permalink
drm/amdkcl: fake drm_dp_atomic_release_time_slots()
Browse files Browse the repository at this point in the history
It's caused by df78f7f
"drm/display/dp_mst: Call them time slots, not VCPI slots"

Signed-off-by: Asher Song <Asher.Song@amd.com>
Reviewed-by: Perry Yuan <Perry.Yuan@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Leslie Shi <Yuliang.Shi@amd.com>
Reviewed-by: bobzhou <bob.zhou@amd.com>
  • Loading branch information
Asher Song authored and bobzhou committed Apr 17, 2023
1 parent 8a8ce23 commit 166c089
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 29 deletions.
4 changes: 0 additions & 4 deletions drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 7 additions & 4 deletions drivers/gpu/drm/amd/dkms/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,17 +379,20 @@
/* 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 */

/* drm_dp_mst_atomic_wait_for_dependencies() is available */
/* #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
Expand Down
69 changes: 49 additions & 20 deletions drivers/gpu/drm/amd/dkms/m4/drm-dp-atomic-funcs.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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 <drm/display/drm_dp_mst_helper.h>
#elif defined(HAVE_DRM_DP_DRM_DP_MST_HELPER_H)
#include <drm/dp/drm_dp_mst_helper.h>
#else
#include <drm/drm_dp_mst_helper.h>
#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 <drm/display/drm_dp_mst_helper.h>
#elif defined(HAVE_DRM_DP_DRM_DP_MST_HELPER_H)
#include <drm/dp/drm_dp_mst_helper.h>
#else
#include <drm/drm_dp_mst_helper.h>
#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], [
Expand Down Expand Up @@ -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 <drm/drm_dp_mst_helper.h>
],[
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
])
16 changes: 15 additions & 1 deletion include/kcl/backport/kcl_drm_dp_mst_helper_backport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 166c089

Please sign in to comment.