]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Convert bandwidth state to global state
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 20 Jan 2020 17:47:25 +0000 (19:47 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 31 Jan 2020 15:00:44 +0000 (17:00 +0200)
Now that we have the more formal global state thing let's
use if for memory bandwidth tracking. No real difference
to the current private object usage since we already
tried to avoid taking the single serializing lock needlessly.
But since we're going to roll the global state out to more
things probably a good idea to unify the approaches a bit.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200120174728.21095-16-ville.syrjala@linux.intel.com
Reviewed-by: Imre Deak <imre.deak@intel.com>
drivers/gpu/drm/i915/display/intel_bw.c
drivers/gpu/drm/i915/display/intel_bw.h
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/i915_drv.h

index 9c40ad52dd73a348d469773f086d31d6ce568549..26fa94329eda531d750ebd6239f178d46457b132 100644 (file)
@@ -377,10 +377,9 @@ static struct intel_bw_state *
 intel_atomic_get_bw_state(struct intel_atomic_state *state)
 {
        struct drm_i915_private *dev_priv = to_i915(state->base.dev);
-       struct drm_private_state *bw_state;
+       struct intel_global_state *bw_state;
 
-       bw_state = drm_atomic_get_private_obj_state(&state->base,
-                                                   &dev_priv->bw_obj);
+       bw_state = intel_atomic_get_global_obj_state(state, &dev_priv->bw_obj);
        if (IS_ERR(bw_state))
                return ERR_CAST(bw_state);
 
@@ -395,7 +394,7 @@ int intel_bw_atomic_check(struct intel_atomic_state *state)
        unsigned int data_rate, max_data_rate;
        unsigned int num_active_planes;
        struct intel_crtc *crtc;
-       int i;
+       int i, ret;
 
        /* FIXME earlier gens need some checks too */
        if (INTEL_GEN(dev_priv) < 11)
@@ -437,6 +436,10 @@ int intel_bw_atomic_check(struct intel_atomic_state *state)
        if (!bw_state)
                return 0;
 
+       ret = intel_atomic_lock_global_state(&bw_state->base);
+       if (ret)
+               return ret;
+
        data_rate = intel_bw_data_rate(dev_priv, bw_state);
        num_active_planes = intel_bw_num_active_planes(dev_priv, bw_state);
 
@@ -454,7 +457,8 @@ int intel_bw_atomic_check(struct intel_atomic_state *state)
        return 0;
 }
 
-static struct drm_private_state *intel_bw_duplicate_state(struct drm_private_obj *obj)
+static struct intel_global_state *
+intel_bw_duplicate_state(struct intel_global_obj *obj)
 {
        struct intel_bw_state *state;
 
@@ -462,18 +466,16 @@ static struct drm_private_state *intel_bw_duplicate_state(struct drm_private_obj
        if (!state)
                return NULL;
 
-       __drm_atomic_helper_private_obj_duplicate_state(obj, &state->base);
-
        return &state->base;
 }
 
-static void intel_bw_destroy_state(struct drm_private_obj *obj,
-                                  struct drm_private_state *state)
+static void intel_bw_destroy_state(struct intel_global_obj *obj,
+                                  struct intel_global_state *state)
 {
        kfree(state);
 }
 
-static const struct drm_private_state_funcs intel_bw_funcs = {
+static const struct intel_global_state_funcs intel_bw_funcs = {
        .atomic_duplicate_state = intel_bw_duplicate_state,
        .atomic_destroy_state = intel_bw_destroy_state,
 };
@@ -486,13 +488,8 @@ int intel_bw_init(struct drm_i915_private *dev_priv)
        if (!state)
                return -ENOMEM;
 
-       drm_atomic_private_obj_init(&dev_priv->drm, &dev_priv->bw_obj,
-                                   &state->base, &intel_bw_funcs);
+       intel_atomic_global_obj_init(dev_priv, &dev_priv->bw_obj,
+                                    &state->base, &intel_bw_funcs);
 
        return 0;
 }
-
-void intel_bw_cleanup(struct drm_i915_private *dev_priv)
-{
-       drm_atomic_private_obj_fini(&dev_priv->bw_obj);
-}
index 20b9ad241802d7869ed259d0c32e77fb506a3739..a8aa7624c5aaf3db7030cc3ad47b0c124a6a7ade 100644 (file)
@@ -9,13 +9,14 @@
 #include <drm/drm_atomic.h>
 
 #include "intel_display.h"
+#include "intel_global_state.h"
 
 struct drm_i915_private;
 struct intel_atomic_state;
 struct intel_crtc_state;
 
 struct intel_bw_state {
-       struct drm_private_state base;
+       struct intel_global_state base;
 
        unsigned int data_rate[I915_MAX_PIPES];
        u8 num_active_planes[I915_MAX_PIPES];
@@ -25,7 +26,6 @@ struct intel_bw_state {
 
 void intel_bw_init_hw(struct drm_i915_private *dev_priv);
 int intel_bw_init(struct drm_i915_private *dev_priv);
-void intel_bw_cleanup(struct drm_i915_private *dev_priv);
 int intel_bw_atomic_check(struct intel_atomic_state *state);
 void intel_bw_crtc_update(struct intel_bw_state *bw_state,
                          const struct intel_crtc_state *crtc_state);
index 63a3e96cbaf5a9c7830f66a4b6cf49e4453cc366..9f20c7dd116bc816846d2acb4c6f628c040296b8 100644 (file)
@@ -18822,8 +18822,6 @@ void intel_modeset_driver_remove(struct drm_i915_private *i915)
 
        intel_gmbus_teardown(i915);
 
-       intel_bw_cleanup(i915);
-
        destroy_workqueue(i915->flip_wq);
        destroy_workqueue(i915->modeset_wq);
 
index 3ed48371f3dac3c3847997f9ee6239ae3fc0c918..2d4c0b5a2b8e54a2c20ad477c5b8ef0818b2c2f5 100644 (file)
@@ -1249,7 +1249,7 @@ struct drm_i915_private {
                u8 num_planes;
        } max_bw[6];
 
-       struct drm_private_obj bw_obj;
+       struct intel_global_obj bw_obj;
 
        struct intel_runtime_pm runtime_pm;