drm/msm: Don't subclass drm_atomic_state anymore
authorArchit Taneja <architt@codeaurora.org>
Wed, 21 Feb 2018 14:37:24 +0000 (09:37 -0500)
committerRob Clark <robdclark@gmail.com>
Sun, 3 Jun 2018 20:49:00 +0000 (16:49 -0400)
With the addition of "private_objs" in drm_atomic_state, we no longer
need to subclass drm_atomic_state to store state of share resources
that don't perfectly fit within planes/crtc/connector state information.
We can now save this state within drm_atomic_state itself using
the private objects.

Remove the infrastructure that allowed subclassing of drm_atomic_state
in the driver.

Changes in v3:
- Added to the msm atomic helper patch set
Changes in v4:
- None

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h
drivers/gpu/drm/msm/msm_atomic.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_kms.h

index 6ada098dba0b3e5921c0baa41f945ccdacdf450d..6e12e275debae437877f566cefbe4d909e1b7f97 100644 (file)
@@ -70,42 +70,6 @@ static int mdp5_hw_init(struct msm_kms *kms)
        return 0;
 }
 
-struct mdp5_state *mdp5_get_state(struct drm_atomic_state *s)
-{
-       struct msm_drm_private *priv = s->dev->dev_private;
-       struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms));
-       struct msm_kms_state *state = to_kms_state(s);
-       struct mdp5_state *new_state;
-       int ret;
-
-       if (state->state)
-               return state->state;
-
-       ret = drm_modeset_lock(&mdp5_kms->state_lock, s->acquire_ctx);
-       if (ret)
-               return ERR_PTR(ret);
-
-       new_state = kmalloc(sizeof(*mdp5_kms->state), GFP_KERNEL);
-       if (!new_state)
-               return ERR_PTR(-ENOMEM);
-
-       /* Copy state: */
-       new_state->hwpipe = mdp5_kms->state->hwpipe;
-       new_state->hwmixer = mdp5_kms->state->hwmixer;
-       if (mdp5_kms->smp)
-               new_state->smp = mdp5_kms->state->smp;
-
-       state->state = new_state;
-
-       return new_state;
-}
-
-static void mdp5_swap_state(struct msm_kms *kms, struct drm_atomic_state *state)
-{
-       struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
-       swap(to_kms_state(state)->state, mdp5_kms->state);
-}
-
 /* Global/shared object state funcs */
 
 /*
@@ -315,7 +279,6 @@ static const struct mdp_kms_funcs kms_funcs = {
                .irq             = mdp5_irq,
                .enable_vblank   = mdp5_enable_vblank,
                .disable_vblank  = mdp5_disable_vblank,
-               .swap_state      = mdp5_swap_state,
                .prepare_commit  = mdp5_prepare_commit,
                .complete_commit = mdp5_complete_commit,
                .wait_for_crtc_commit_done = mdp5_wait_for_crtc_commit_done,
@@ -815,8 +778,6 @@ static void mdp5_destroy(struct platform_device *pdev)
 
        drm_atomic_private_obj_fini(&mdp5_kms->glob_state);
        drm_modeset_lock_fini(&mdp5_kms->glob_state_lock);
-
-       kfree(mdp5_kms->state);
 }
 
 static int construct_pipes(struct mdp5_kms *mdp5_kms, int cnt,
@@ -969,13 +930,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
        mdp5_kms->dev = dev;
        mdp5_kms->pdev = pdev;
 
-       drm_modeset_lock_init(&mdp5_kms->state_lock);
-       mdp5_kms->state = kzalloc(sizeof(*mdp5_kms->state), GFP_KERNEL);
-       if (!mdp5_kms->state) {
-               ret = -ENOMEM;
-               goto fail;
-       }
-
        ret = mdp5_global_obj_init(mdp5_kms);
        if (ret)
                goto fail;
index 76f0ddfca32238366d9a8585114565850823f71b..854dfd30e829256ed4922a1eb05bef4ab7733c1b 100644 (file)
@@ -28,8 +28,6 @@
 #include "mdp5_ctl.h"
 #include "mdp5_smp.h"
 
-struct mdp5_state;
-
 struct mdp5_kms {
        struct mdp_kms base;
 
@@ -49,12 +47,6 @@ struct mdp5_kms {
        struct mdp5_cfg_handler *cfg;
        uint32_t caps;  /* MDP capabilities (MDP_CAP_XXX bits) */
 
-       /**
-        * Global atomic state.  Do not access directly, use mdp5_get_state()
-        */
-       struct mdp5_state *state;
-       struct drm_modeset_lock state_lock;
-
        /*
         * Global private object state, Do not access directly, use
         * mdp5_global_get_state()
@@ -88,20 +80,6 @@ struct mdp5_kms {
 };
 #define to_mdp5_kms(x) container_of(x, struct mdp5_kms, base)
 
-/* Global atomic state for tracking resources that are shared across
- * multiple kms objects (planes/crtcs/etc).
- *
- * For atomic updates which require modifying global state,
- */
-struct mdp5_state {
-       struct mdp5_hw_pipe_state hwpipe;
-       struct mdp5_hw_mixer_state hwmixer;
-       struct mdp5_smp_state smp;
-};
-
-struct mdp5_state *__must_check
-mdp5_get_state(struct drm_atomic_state *s);
-
 /* Global private object state for tracking resources that are shared across
  * multiple kms objects (planes/crtcs/etc).
  */
index bf5f8c39f34d2cb2bf53409acf69797bc9a95c75..9d0a0ca1f0cb9e21d28a1ae58350c6b2a7758955 100644 (file)
@@ -224,11 +224,7 @@ int msm_atomic_commit(struct drm_device *dev,
         * This is the point of no return - everything below never fails except
         * when the hw goes bonghits. Which means we can commit the new state on
         * the software side now.
-        *
-        * swap driver private state while still holding state_lock
         */
-       if (to_kms_state(state)->state)
-               priv->kms->funcs->swap_state(priv->kms, state);
 
        /*
         * Everything below can be run asynchronously without the need to grab
@@ -262,30 +258,3 @@ error:
        drm_atomic_helper_cleanup_planes(dev, state);
        return ret;
 }
-
-struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev)
-{
-       struct msm_kms_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
-
-       if (!state || drm_atomic_state_init(dev, &state->base) < 0) {
-               kfree(state);
-               return NULL;
-       }
-
-       return &state->base;
-}
-
-void msm_atomic_state_clear(struct drm_atomic_state *s)
-{
-       struct msm_kms_state *state = to_kms_state(s);
-       drm_atomic_state_default_clear(&state->base);
-       kfree(state->state);
-       state->state = NULL;
-}
-
-void msm_atomic_state_free(struct drm_atomic_state *state)
-{
-       kfree(to_kms_state(state)->state);
-       drm_atomic_state_default_release(state);
-       kfree(state);
-}
index 30cd514d8f7c7ad697b3e3d52b45091375ea097d..1c89195da4fff718e8bbf1597d2153ec6c5110f8 100644 (file)
@@ -42,9 +42,6 @@ static const struct drm_mode_config_funcs mode_config_funcs = {
        .output_poll_changed = drm_fb_helper_output_poll_changed,
        .atomic_check = drm_atomic_helper_check,
        .atomic_commit = msm_atomic_commit,
-       .atomic_state_alloc = msm_atomic_state_alloc,
-       .atomic_state_clear = msm_atomic_state_clear,
-       .atomic_state_free = msm_atomic_state_free,
 };
 
 #ifdef CONFIG_DRM_MSM_REGISTER_LOGGING
index aaa329dc020ece445a5334329ae8ab34f68c8035..dfd92947de2c88a7b3e0c9e963ba202093215aec 100644 (file)
@@ -40,8 +40,6 @@ struct msm_kms_funcs {
        irqreturn_t (*irq)(struct msm_kms *kms);
        int (*enable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
        void (*disable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
-       /* swap global atomic state: */
-       void (*swap_state)(struct msm_kms *kms, struct drm_atomic_state *state);
        /* modeset, bracketing atomic_commit(): */
        void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
        void (*complete_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
@@ -80,18 +78,6 @@ struct msm_kms {
        struct msm_gem_address_space *aspace;
 };
 
-/**
- * Subclass of drm_atomic_state, to allow kms backend to have driver
- * private global state.  The kms backend can do whatever it wants
- * with the ->state ptr.  On ->atomic_state_clear() the ->state ptr
- * is kfree'd and set back to NULL.
- */
-struct msm_kms_state {
-       struct drm_atomic_state base;
-       void *state;
-};
-#define to_kms_state(x) container_of(x, struct msm_kms_state, base)
-
 static inline void msm_kms_init(struct msm_kms *kms,
                const struct msm_kms_funcs *funcs)
 {