From f14564b1e54b29ecc3f835007449790169750811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= Date: Thu, 18 Jun 2026 05:51:38 +0000 Subject: [PATCH 1/2] Tentative fix for NVIDIA 470.256.02 driver for Linux 7.2-rc1 (part 1) Rename drm_atomic_state -> drm_atomic_commit rename; created using: rg -l atomic_state | xargs sed -i 's/atomic_state/atomic_commit/g; s/ATOMIC_STATE/ATOMIC_COMMIT/g; s/atomic_commit_alloc/atomic_state_alloc/g; s/atomic_commit_clear/atomic_state_clear/g; s/atomic_commit_free/atomic_state_free/g;' --- conftest.sh | 46 ++++++++++++++++----------------- nvidia-drm/nvidia-drm-crtc.c | 12 ++++----- nvidia-drm/nvidia-drm-modeset.c | 38 +++++++++++++-------------- nvidia-drm/nvidia-drm-modeset.h | 12 ++++----- nvidia-drm/nvidia-drm.Kbuild | 6 ++--- 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/conftest.sh b/conftest.sh index 294d6e5..07e821e 100755 --- a/conftest.sh +++ b/conftest.sh @@ -1927,7 +1927,7 @@ compile_test() { # Determine if the DRM atomic modesetting subsystem is usable # # Added by commit 036ef5733ba4 - # ("drm/atomic: Allow drivers to subclass drm_atomic_state, v3") in + # ("drm/atomic: Allow drivers to subclass drm_atomic_commit, v3") in # v4.2 (2018-05-18). # # Make conftest more robust by adding test for @@ -3010,23 +3010,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_DRM_MASTER_DROP_HAS_FROM_RELEASE_ARG" "" "types" ;; - drm_atomic_state_ref_counting) + drm_atomic_commit_ref_counting) # - # Determine if functions drm_atomic_state_get/put() are + # Determine if functions drm_atomic_commit_get/put() are # present. # # Added by commit 0853695c3ba4 ("drm: Add reference counting to - # drm_atomic_state") in v4.10 (2016-10-14) + # drm_atomic_commit") in v4.10 (2016-10-14) # CODE=" #if defined(NV_DRM_DRM_ATOMIC_H_PRESENT) #include #endif - void conftest_drm_atomic_state_get(void) { - drm_atomic_state_get(); + void conftest_drm_atomic_commit_get(void) { + drm_atomic_commit_get(); }" - compile_check_conftest "$CODE" "NV_DRM_ATOMIC_STATE_REF_COUNTING_PRESENT" "" "functions" + compile_check_conftest "$CODE" "NV_DRM_ATOMIC_COMMIT_REF_COUNTING_PRESENT" "" "functions" ;; vm_ops_fault_removed_vma_arg) @@ -3627,7 +3627,7 @@ compile_test() { CODE=" #include void conftest_drm_atomic_helper_swap_state_has_stall_arg( - struct drm_atomic_state *state, + struct drm_atomic_commit *state, bool stall) { (void)drm_atomic_helper_swap_state(state, stall); }" @@ -3646,7 +3646,7 @@ compile_test() { CODE=" #include int conftest_drm_atomic_helper_swap_state_return_int( - struct drm_atomic_state *state, + struct drm_atomic_commit *state, bool stall) { return drm_atomic_helper_swap_state(state, stall); }" @@ -4554,10 +4554,10 @@ compile_test() { compile_check_conftest "$CODE" "NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS" "" "types" ;; - drm_crtc_atomic_check_has_atomic_state_arg) + drm_crtc_atomic_check_has_atomic_commit_arg) # # Determine if drm_crtc_helper_funcs::atomic_check takes 'state' - # argument of 'struct drm_atomic_state' type. + # argument of 'struct drm_atomic_commit' type. # # The commit 29b77ad7b9ca ("drm/atomic: Pass the full state to CRTC # atomic_check") passed the full atomic state to @@ -4573,10 +4573,10 @@ compile_test() { #include static const struct drm_crtc_helper_funcs *funcs; - typeof(*funcs->atomic_check) conftest_drm_crtc_atomic_check_has_atomic_state_arg; + typeof(*funcs->atomic_check) conftest_drm_crtc_atomic_check_has_atomic_commit_arg; - int conftest_drm_crtc_atomic_check_has_atomic_state_arg( - struct drm_crtc *crtc, struct drm_atomic_state *state) { + int conftest_drm_crtc_atomic_check_has_atomic_commit_arg( + struct drm_crtc *crtc, struct drm_atomic_commit *state) { return 0; }" > conftest$$.c @@ -4585,9 +4585,9 @@ compile_test() { if [ -f conftest$$.o ]; then rm -f conftest$$.o - echo "#define NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG" | append_conftest "types" + echo "#define NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_COMMIT_ARG" | append_conftest "types" else - echo "#undef NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG" | append_conftest "types" + echo "#undef NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_COMMIT_ARG" | append_conftest "types" fi ;; @@ -4716,10 +4716,10 @@ compile_test() { compile_check_conftest "$CODE" "NV_FOLLOW_PFN_PRESENT" "" "functions" ;; - drm_plane_atomic_check_has_atomic_state_arg) + drm_plane_atomic_check_has_atomic_commit_arg) # # Determine if drm_plane_helper_funcs::atomic_check takes 'state' - # argument of 'struct drm_atomic_state' type. + # argument of 'struct drm_atomic_commit' type. # # The commit 7c11b99a8e58 ("drm/atomic: Pass the full state to # planes atomic_check") passed the full atomic state to @@ -4735,10 +4735,10 @@ compile_test() { #include static const struct drm_plane_helper_funcs *funcs; - typeof(*funcs->atomic_check) conftest_drm_plane_atomic_check_has_atomic_state_arg; + typeof(*funcs->atomic_check) conftest_drm_plane_atomic_check_has_atomic_commit_arg; - int conftest_drm_plane_atomic_check_has_atomic_state_arg( - struct drm_plane *plane, struct drm_atomic_state *state) { + int conftest_drm_plane_atomic_check_has_atomic_commit_arg( + struct drm_plane *plane, struct drm_atomic_commit *state) { return 0; }" > conftest$$.c @@ -4747,9 +4747,9 @@ compile_test() { if [ -f conftest$$.o ]; then rm -f conftest$$.o - echo "#define NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG" | append_conftest "types" + echo "#define NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_COMMIT_ARG" | append_conftest "types" else - echo "#undef NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG" | append_conftest "types" + echo "#undef NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_COMMIT_ARG" | append_conftest "types" fi ;; diff --git a/nvidia-drm/nvidia-drm-crtc.c b/nvidia-drm/nvidia-drm-crtc.c index 69db1cb..c74f168 100644 --- a/nvidia-drm/nvidia-drm-crtc.c +++ b/nvidia-drm/nvidia-drm-crtc.c @@ -288,15 +288,15 @@ static bool __is_async_flip_requested(const struct drm_plane *plane, return false; } -#if defined(NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG) +#if defined(NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_COMMIT_ARG) static int nv_drm_plane_atomic_check(struct drm_plane *plane, - struct drm_atomic_state *state) + struct drm_atomic_commit *state) #else static int nv_drm_plane_atomic_check(struct drm_plane *plane, struct drm_plane_state *plane_state) #endif { -#if defined(NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG) +#if defined(NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_COMMIT_ARG) struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state, plane); #endif @@ -599,15 +599,15 @@ static int head_modeset_config_attach_connector( * the 'nv_drm_crtc_state::req_config', that is fine because 'nv_drm_crtc_state' * will be discarded if ->atomic_check() fails. */ -#if defined(NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG) +#if defined(NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_COMMIT_ARG) static int nv_drm_crtc_atomic_check(struct drm_crtc *crtc, - struct drm_atomic_state *state) + struct drm_atomic_commit *state) #else static int nv_drm_crtc_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *crtc_state) #endif { -#if defined(NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG) +#if defined(NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_COMMIT_ARG) struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); #endif diff --git a/nvidia-drm/nvidia-drm-modeset.c b/nvidia-drm/nvidia-drm-modeset.c index 640b341..28e30ee 100644 --- a/nvidia-drm/nvidia-drm-modeset.c +++ b/nvidia-drm/nvidia-drm-modeset.c @@ -42,23 +42,23 @@ #include #include -struct nv_drm_atomic_state { +struct nv_drm_atomic_commit { struct NvKmsKapiRequestedModeSetConfig config; - struct drm_atomic_state base; + struct drm_atomic_commit base; }; -static inline struct nv_drm_atomic_state *to_nv_atomic_state( - struct drm_atomic_state *state) +static inline struct nv_drm_atomic_commit *to_nv_atomic_commit( + struct drm_atomic_commit *state) { - return container_of(state, struct nv_drm_atomic_state, base); + return container_of(state, struct nv_drm_atomic_commit, base); } -struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev) +struct drm_atomic_commit *nv_drm_atomic_state_alloc(struct drm_device *dev) { - struct nv_drm_atomic_state *nv_state = + struct nv_drm_atomic_commit *nv_state = nv_drm_calloc(1, sizeof(*nv_state)); - if (nv_state == NULL || drm_atomic_state_init(dev, &nv_state->base) < 0) { + if (nv_state == NULL || drm_atomic_commit_init(dev, &nv_state->base) < 0) { nv_drm_free(nv_state); return NULL; } @@ -66,16 +66,16 @@ struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev) return &nv_state->base; } -void nv_drm_atomic_state_clear(struct drm_atomic_state *state) +void nv_drm_atomic_state_clear(struct drm_atomic_commit *state) { - drm_atomic_state_default_clear(state); + drm_atomic_commit_default_clear(state); } -void nv_drm_atomic_state_free(struct drm_atomic_state *state) +void nv_drm_atomic_state_free(struct drm_atomic_commit *state) { - struct nv_drm_atomic_state *nv_state = - to_nv_atomic_state(state); - drm_atomic_state_default_release(state); + struct nv_drm_atomic_commit *nv_state = + to_nv_atomic_commit(state); + drm_atomic_commit_default_release(state); nv_drm_free(nv_state); } @@ -252,12 +252,12 @@ static int __nv_drm_get_syncpt_data( */ static int nv_drm_atomic_apply_modeset_config(struct drm_device *dev, - struct drm_atomic_state *state, + struct drm_atomic_commit *state, bool commit) { struct nv_drm_device *nv_dev = to_nv_device(dev); struct NvKmsKapiRequestedModeSetConfig *requested_config = - &(to_nv_atomic_state(state)->config); + &(to_nv_atomic_commit(state)->config); struct NvKmsKapiModeSetReplyConfig reply_config = { }; struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state, *new_crtc_state; @@ -328,7 +328,7 @@ nv_drm_atomic_apply_modeset_config(struct drm_device *dev, } int nv_drm_atomic_check(struct drm_device *dev, - struct drm_atomic_state *state) + struct drm_atomic_commit *state) { int ret = 0; @@ -395,7 +395,7 @@ static void __nv_drm_handle_flip_event(struct nv_drm_crtc *nv_crtc) } int nv_drm_atomic_commit(struct drm_device *dev, - struct drm_atomic_state *state, + struct drm_atomic_commit *state, bool nonblock) { int ret = -EBUSY; @@ -571,7 +571,7 @@ int nv_drm_atomic_commit(struct drm_device *dev, done: -#if defined(NV_DRM_ATOMIC_STATE_REF_COUNTING_PRESENT) +#if defined(NV_DRM_ATOMIC_COMMIT_REF_COUNTING_PRESENT) /* * If ref counting is present, state will be freed when the caller * drops its reference after we return. diff --git a/nvidia-drm/nvidia-drm-modeset.h b/nvidia-drm/nvidia-drm-modeset.h index 8cf25ad..6b7e759 100644 --- a/nvidia-drm/nvidia-drm-modeset.h +++ b/nvidia-drm/nvidia-drm-modeset.h @@ -30,17 +30,17 @@ #include "nvkms-kapi.h" struct drm_device; -struct drm_atomic_state; +struct drm_atomic_commit; -struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev); -void nv_drm_atomic_state_clear(struct drm_atomic_state *state); -void nv_drm_atomic_state_free(struct drm_atomic_state *state); +struct drm_atomic_commit *nv_drm_atomic_state_alloc(struct drm_device *dev); +void nv_drm_atomic_state_clear(struct drm_atomic_commit *state); +void nv_drm_atomic_state_free(struct drm_atomic_commit *state); int nv_drm_atomic_check(struct drm_device *dev, - struct drm_atomic_state *state); + struct drm_atomic_commit *state); int nv_drm_atomic_commit(struct drm_device *dev, - struct drm_atomic_state *state, bool nonblock); + struct drm_atomic_commit *state, bool nonblock); void nv_drm_handle_flip_occurred(struct nv_drm_device *nv_dev, diff --git a/nvidia-drm/nvidia-drm.Kbuild b/nvidia-drm/nvidia-drm.Kbuild index af3f4af..fd31a04 100644 --- a/nvidia-drm/nvidia-drm.Kbuild +++ b/nvidia-drm/nvidia-drm.Kbuild @@ -62,7 +62,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_reinit_primary_mode_group NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages_remote NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_gem_object_lookup -NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_atomic_state_ref_counting +NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_atomic_commit_ref_counting NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_has_gem_prime_res_obj NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_atomic_helper_connector_dpms NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_connector_funcs_have_mode_in_name @@ -110,9 +110,9 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_master_set_has_int_return_type 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_crtc_atomic_check_has_atomic_commit_arg NV_CONFTEST_TYPE_COMPILE_TESTS += drm_gem_object_vmap_has_map_arg -NV_CONFTEST_TYPE_COMPILE_TESTS += drm_plane_atomic_check_has_atomic_state_arg +NV_CONFTEST_TYPE_COMPILE_TESTS += drm_plane_atomic_check_has_atomic_commit_arg NV_CONFTEST_TYPE_COMPILE_TESTS += drm_device_has_pdev NV_CONFTEST_TYPE_COMPILE_TESTS += drm_mode_config_has_allow_fb_modifiers NV_CONFTEST_TYPE_COMPILE_TESTS += dma_resv_add_fence