drm/i915/display: move restore state and ctx under display sub-struct
authorJani Nikula <jani.nikula@intel.com>
Wed, 9 Nov 2022 14:42:09 +0000 (16:42 +0200)
committerJani Nikula <jani.nikula@intel.com>
Thu, 17 Nov 2022 14:12:56 +0000 (16:12 +0200)
Move display suspend/resume and display reset modeset state and ctx
members under drm_i915_private display sub-struct.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221109144209.3624739-4-jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display_core.h
drivers/gpu/drm/i915/i915_drv.h

index a087b40a898099399c85f23bd23a913f1a25bf84..126f021dd7bdf3e516fa690cbbecab40960a85eb 100644 (file)
@@ -891,7 +891,7 @@ static bool gpu_reset_clobbers_display(struct drm_i915_private *dev_priv)
 
 void intel_display_prepare_reset(struct drm_i915_private *dev_priv)
 {
-       struct drm_modeset_acquire_ctx *ctx = &dev_priv->reset_ctx;
+       struct drm_modeset_acquire_ctx *ctx = &dev_priv->display.restore.reset_ctx;
        struct drm_atomic_state *state;
        int ret;
 
@@ -947,13 +947,13 @@ void intel_display_prepare_reset(struct drm_i915_private *dev_priv)
                return;
        }
 
-       dev_priv->modeset_restore_state = state;
+       dev_priv->display.restore.modeset_state = state;
        state->acquire_ctx = ctx;
 }
 
 void intel_display_finish_reset(struct drm_i915_private *i915)
 {
-       struct drm_modeset_acquire_ctx *ctx = &i915->reset_ctx;
+       struct drm_modeset_acquire_ctx *ctx = &i915->display.restore.reset_ctx;
        struct drm_atomic_state *state;
        int ret;
 
@@ -964,7 +964,7 @@ void intel_display_finish_reset(struct drm_i915_private *i915)
        if (!test_bit(I915_RESET_MODESET, &to_gt(i915)->reset.flags))
                return;
 
-       state = fetch_and_zero(&i915->modeset_restore_state);
+       state = fetch_and_zero(&i915->display.restore.modeset_state);
        if (!state)
                goto unlock;
 
@@ -2444,7 +2444,7 @@ int intel_display_suspend(struct drm_device *dev)
                drm_err(&dev_priv->drm, "Suspending crtc's failed with %i\n",
                        ret);
        else
-               dev_priv->modeset_restore_state = state;
+               dev_priv->display.restore.modeset_state = state;
        return ret;
 }
 
@@ -8900,14 +8900,14 @@ void i830_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe)
 void intel_display_resume(struct drm_device *dev)
 {
        struct drm_i915_private *i915 = to_i915(dev);
-       struct drm_atomic_state *state = i915->modeset_restore_state;
+       struct drm_atomic_state *state = i915->display.restore.modeset_state;
        struct drm_modeset_acquire_ctx ctx;
        int ret;
 
        if (!HAS_DISPLAY(i915))
                return;
 
-       i915->modeset_restore_state = NULL;
+       i915->display.restore.modeset_state = NULL;
        if (state)
                state->acquire_ctx = &ctx;
 
index 7eb705a0fa196b0f52862f5b7c20a05281acaee9..57ddce3ba02b397eeb21bb59bef53b139b85c81b 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/workqueue.h>
 
 #include <drm/drm_connector.h>
+#include <drm/drm_modeset_lock.h>
 
 #include "intel_cdclk.h"
 #include "intel_display.h"
@@ -410,6 +411,12 @@ struct intel_display {
                unsigned long mask;
        } quirks;
 
+       struct {
+               /* restore state for suspend/resume and display reset */
+               struct drm_atomic_state *modeset_state;
+               struct drm_modeset_acquire_ctx reset_ctx;
+       } restore;
+
        struct {
                enum {
                        I915_SAGV_UNKNOWN = 0,
index fdf330a29ec0577fbe64eaf83c67cb9d28bee816..2f074d7e0d31d17744ee2c72013a05fcca2d1404 100644 (file)
@@ -287,9 +287,6 @@ struct drm_i915_private {
 
        unsigned long gem_quirks;
 
-       struct drm_atomic_state *modeset_restore_state;
-       struct drm_modeset_acquire_ctx reset_ctx;
-
        struct i915_gem_mm mm;
 
        bool mchbar_need_disable;