drm/i915: Grab intel_display from the encoder to avoid potential oopsies
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 7 Nov 2024 16:11:14 +0000 (18:11 +0200)
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Tue, 12 Nov 2024 09:08:06 +0000 (11:08 +0200)
Grab the intel_display from 'encoder' rather than 'state'
in the encoder hooks to avoid the massive footgun that is
intel_sanitize_encoder(), which passes NULL as the 'state'
argument to encoder .disable() and .post_disable().

TODO: figure out how to actually fix intel_sanitize_encoder()...

Fixes: ab0b0eb5c85c ("drm/i915/tv: convert to struct intel_display")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241107161123.16269-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
(cherry picked from commit dc3806d9eb66d0105f8d55d462d4ef681d9eac59)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/display/intel_tv.c

index 581844d1db9ae58bc6ecdffbc1b6f4881debe712..5fee4be645924cfe4ec65442dd6d03f9da8f9854 100644 (file)
@@ -928,7 +928,7 @@ intel_enable_tv(struct intel_atomic_state *state,
                const struct intel_crtc_state *pipe_config,
                const struct drm_connector_state *conn_state)
 {
-       struct intel_display *display = to_intel_display(state);
+       struct intel_display *display = to_intel_display(encoder);
 
        /* Prevents vblank waits from timing out in intel_tv_detect_type() */
        intel_crtc_wait_for_next_vblank(to_intel_crtc(pipe_config->uapi.crtc));
@@ -942,7 +942,7 @@ intel_disable_tv(struct intel_atomic_state *state,
                 const struct intel_crtc_state *old_crtc_state,
                 const struct drm_connector_state *old_conn_state)
 {
-       struct intel_display *display = to_intel_display(state);
+       struct intel_display *display = to_intel_display(encoder);
 
        intel_de_rmw(display, TV_CTL, TV_ENC_ENABLE, 0);
 }