diff --git a/kernel/conftest.sh b/kernel/conftest.sh index 4b6a9ed..25a8afa 100755 --- a/kernel/conftest.sh +++ b/kernel/conftest.sh @@ -4408,6 +4408,38 @@ compile_test() { fi ;; + drm_plane_atomic_update_has_atomic_state_arg) + # + # Determine if drm_plane_helper_funcs::atomic_update takes 'state' + # argument of 'struct drm_atomic_state' type. + # + # The commit 977697e20b3d ("drm/atomic: Pass the full state to + # planes atomic disable and update") passed the full atomic state to + # drm_crtc_helper_funcs::atomic_update() and atomic_disable(). + # + echo "$CONFTEST_PREAMBLE + #include + #include + #include + #include + #include + void conftest_drm_plane_helper_atomic_update_has_atomic_state_arg( + struct drm_plane *plane, struct drm_atomic_state *state) { + const struct drm_plane_helper_funcs *funcs = plane->helper_private; + funcs->atomic_update(plane, state); + }" > conftest$$.c + + $CC $CFLAGS -Werror=incompatible-pointer-types -c conftest$$.c > /dev/null 2>&1 + rm -f conftest$$.c + + if [ -f conftest$$.o ]; then + rm -f conftest$$.o + echo "#define NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG" | append_conftest "types" + else + echo "#undef NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG" | append_conftest "types" + fi + ;; + drm_gem_object_vmap_has_map_arg) # # Determine if drm_gem_object_funcs::vmap takes 'map' diff --git a/kernel/nvidia-drm/nvidia-drm-crtc.c b/kernel/nvidia-drm/nvidia-drm-crtc.c index 8abd1f3..d5e5cfd 100644 --- a/kernel/nvidia-drm/nvidia-drm-crtc.c +++ b/kernel/nvidia-drm/nvidia-drm-crtc.c @@ -131,13 +131,21 @@ plane_req_config_update(struct drm_plane_state *plane_state, } static int nv_drm_plane_atomic_check(struct drm_plane *plane, +#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG) + struct drm_atomic_state *state) +#else struct drm_plane_state *plane_state) +#endif { int i; struct drm_crtc *crtc; struct drm_crtc_state *crtc_state; NvKmsKapiPlaneType type; +#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG) + struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state, + plane); +#endif if (NV_DRM_WARN(!drm_plane_type_to_nvkms_plane_type(plane->type, &type))) { goto done; } @@ -166,12 +174,20 @@ done: } static void nv_drm_plane_atomic_update(struct drm_plane *plane, +#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG) + struct drm_atomic_state *old_state) +#else struct drm_plane_state *old_state) +#endif { } static void nv_drm_plane_atomic_disable(struct drm_plane *plane, +#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG) + struct drm_atomic_state *old_state) +#else struct drm_plane_state *old_state) +#endif { } diff --git a/kernel/nvidia-drm/nvidia-drm.Kbuild b/kernel/nvidia-drm/nvidia-drm.Kbuild index 885ab49..2cb0f9f 100644 --- a/kernel/nvidia-drm/nvidia-drm.Kbuild +++ b/kernel/nvidia-drm/nvidia-drm.Kbuild @@ -100,4 +100,5 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_gem_free_object NV_CONFTEST_TYPE_COMPILE_TESTS += drm_prime_pages_to_sg_has_drm_device_arg NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_gem_prime_callbacks NV_CONFTEST_TYPE_COMPILE_TESTS += drm_crtc_atomic_check_has_atomic_state_arg +NV_CONFTEST_TYPE_COMPILE_TESTS += drm_plane_atomic_update_has_atomic_state_arg NV_CONFTEST_TYPE_COMPILE_TESTS += drm_gem_object_vmap_has_map_arg -- 2.30.2