]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/tidss: crtc: Implement destroy_state
authorMaxime Ripard <mripard@kernel.org>
Tue, 2 Sep 2025 08:32:49 +0000 (10:32 +0200)
committerMaxime Ripard <mripard@kernel.org>
Tue, 30 Sep 2025 09:56:42 +0000 (11:56 +0200)
The tidss crtc driver implements its own state, with its own
implementation of reset and duplicate_state, but uses the default
destroy_state helper.

This somewhat works for now because the drm_crtc_state field in
tidss_crtc_state is the first field so the offset is 0, but it's pretty
fragile and it should really have its own destroy_state implementation.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/r/20250902-drm-state-readout-v1-21-14ad5315da3f@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20250902-drm-state-readout-v1-21-14ad5315da3f@kernel.org
drivers/gpu/drm/tidss/tidss_crtc.c

index db7c5e4225e6247047087a35a2e6422950fc0111..eb431a238b11d22349d61f0e17f05994f50d5f2f 100644 (file)
@@ -343,6 +343,15 @@ static void tidss_crtc_disable_vblank(struct drm_crtc *crtc)
        tidss_runtime_put(tidss);
 }
 
+static void tidss_crtc_destroy_state(struct drm_crtc *crtc,
+                                    struct drm_crtc_state *state)
+{
+       struct tidss_crtc_state *tstate = to_tidss_crtc_state(state);
+
+       __drm_atomic_helper_crtc_destroy_state(&tstate->base);
+       kfree(tstate);
+}
+
 static void tidss_crtc_reset(struct drm_crtc *crtc)
 {
        struct tidss_crtc_state *tstate;
@@ -398,7 +407,7 @@ static const struct drm_crtc_funcs tidss_crtc_funcs = {
        .set_config = drm_atomic_helper_set_config,
        .page_flip = drm_atomic_helper_page_flip,
        .atomic_duplicate_state = tidss_crtc_duplicate_state,
-       .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+       .atomic_destroy_state = tidss_crtc_destroy_state,
        .enable_vblank = tidss_crtc_enable_vblank,
        .disable_vblank = tidss_crtc_disable_vblank,
 };