disp: msm: adapt crtc plane and connector atomic functions for multiple SIs

Commit ddac29b ("disp: msm: Pass the full state to crtc plane and connector
atomic functions") pass full state to crtc, plane, and connector atomic
functions and retrieve drm_crtc/plane/connector_state within the atomic
function.
This change puts macros in the callers of atomic functions to handle API
changes between kernel version 5.10 and version 5.15.

Change-Id: I8e710e33f0a149bbfaa54820a7174a05810e2da4
Signed-off-by: Bruce Hoo <bingchua@codeaurora.org>
This commit is contained in:
Bruce Hoo
2021-11-10 12:32:46 +08:00
parent a7ee8c6b1e
commit 773b0e5b64
4 changed files with 58 additions and 0 deletions

View File

@@ -22,6 +22,7 @@
#include <linux/dma-buf.h>
#include <drm/sde_drm.h>
#include <drm/msm_drm_pp.h>
#include <linux/version.h>
#include "msm_prop.h"
#include "msm_drv.h"
@@ -2703,13 +2704,20 @@ modeset_update:
return ret;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
static int sde_plane_atomic_check(struct drm_plane *plane,
struct drm_atomic_state *atomic_state)
#else
static int sde_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state)
#endif
{
int ret = 0;
struct sde_plane *psde;
struct sde_plane_state *pstate;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
struct drm_plane_state *state = drm_atomic_get_new_plane_state(atomic_state, plane);
#endif
if (!plane || !state) {
SDE_ERROR("invalid arg(s), plane %d state %d\n",
@@ -3389,8 +3397,13 @@ static void _sde_plane_atomic_disable(struct drm_plane *plane,
multirect_index, SDE_SSPP_MULTIRECT_TIME_MX);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
static void _sde_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *old_state)
#else
static void sde_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *old_state)
#endif
{
struct sde_plane *psde;
struct drm_plane_state *state;
@@ -3420,6 +3433,7 @@ static void _sde_plane_atomic_update(struct drm_plane *plane,
}
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
static void sde_plane_atomic_update(struct drm_plane *plane,
struct drm_atomic_state *atomic_state)
{
@@ -3427,6 +3441,7 @@ static void sde_plane_atomic_update(struct drm_plane *plane,
_sde_plane_atomic_update(plane, old_state);
}
#endif
void sde_plane_restore(struct drm_plane *plane)
{
@@ -3449,7 +3464,11 @@ void sde_plane_restore(struct drm_plane *plane)
SDE_DEBUG_PLANE(psde, "\n");
/* last plane state is same as current state */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
_sde_plane_atomic_update(plane, plane->state);
#else
sde_plane_atomic_update(plane, plane->state);
#endif
}
bool sde_plane_is_cache_required(struct drm_plane *plane,