drm: Allow drivers to modify plane_state in prepare_fb/cleanup_fb
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 18 Aug 2016 18:00:16 +0000 (19:00 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 19 Aug 2016 08:58:55 +0000 (10:58 +0200)
The drivers have to modify the atomic plane state during the prepare_fb
callback so they track allocations, reservations and dependencies for
this atomic operation involving this fb. In particular, how else do we
set the plane->fence from the framebuffer!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160818180017.20508-1-chris@chris-wilson.co.uk
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
drivers/gpu/drm/omapdrm/omap_plane.c
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
drivers/gpu/drm/tegra/dc.c
include/drm/drm_modeset_helper_vtables.h

index 146809a97a073171788cf7e4b9d9f9cc44d0acd1..72e6b7dd457b180f85c53438e32f1fc0e804297c 100644 (file)
@@ -755,7 +755,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 }
 
 static int atmel_hlcdc_plane_prepare_fb(struct drm_plane *p,
-                                       const struct drm_plane_state *new_state)
+                                       struct drm_plane_state *new_state)
 {
        /*
         * FIXME: we should avoid this const -> non-const cast but it's
@@ -780,7 +780,7 @@ static int atmel_hlcdc_plane_prepare_fb(struct drm_plane *p,
 }
 
 static void atmel_hlcdc_plane_cleanup_fb(struct drm_plane *p,
-                               const struct drm_plane_state *old_state)
+                                        struct drm_plane_state *old_state)
 {
        /*
         * FIXME: we should avoid this const -> non-const cast but it's
index e50467a0deb0451aa9c5723f8c97806f21add3d2..2a3e92976700c49e10412db30903ac94c285d6b3 100644 (file)
@@ -171,13 +171,13 @@ static void fsl_dcu_drm_plane_atomic_update(struct drm_plane *plane,
 
 static void
 fsl_dcu_drm_plane_cleanup_fb(struct drm_plane *plane,
-                            const struct drm_plane_state *new_state)
+                            struct drm_plane_state *new_state)
 {
 }
 
 static int
 fsl_dcu_drm_plane_prepare_fb(struct drm_plane *plane,
-                            const struct drm_plane_state *new_state)
+                            struct drm_plane_state *new_state)
 {
        return 0;
 }
index eaa3df75fc5c2de11f8dc07d1e9bd0a45b7db8d5..943f708a9dd1e412e5ed0f212d5b7b4815664a06 100644 (file)
@@ -818,14 +818,14 @@ static void ade_disable_channel(struct ade_plane *aplane)
 }
 
 static int ade_plane_prepare_fb(struct drm_plane *plane,
-                               const struct drm_plane_state *new_state)
+                               struct drm_plane_state *new_state)
 {
        /* do nothing */
        return 0;
 }
 
 static void ade_plane_cleanup_fb(struct drm_plane *plane,
-                                const struct drm_plane_state *old_state)
+                                struct drm_plane_state *old_state)
 {
        /* do nothing */
 }
index 3902e57d9df5b275c2a6af8d168dde8dbe601a7d..54bbb9c70a7555e7f189ce63ea57f956e1a6cab3 100644 (file)
@@ -13976,7 +13976,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
  */
 int
 intel_prepare_plane_fb(struct drm_plane *plane,
-                      const struct drm_plane_state *new_state)
+                      struct drm_plane_state *new_state)
 {
        struct drm_device *dev = plane->dev;
        struct drm_framebuffer *fb = new_state->fb;
@@ -14058,7 +14058,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
  */
 void
 intel_cleanup_plane_fb(struct drm_plane *plane,
-                      const struct drm_plane_state *old_state)
+                      struct drm_plane_state *old_state)
 {
        struct drm_device *dev = plane->dev;
        struct intel_plane_state *old_intel_state;
index c29a429cbc45f4902ee23a4204587e7b355df701..b37b8ef0c745ae4b0b583d9a0264efe6e5134eb0 100644 (file)
@@ -1225,9 +1225,9 @@ void intel_finish_page_flip_cs(struct drm_i915_private *dev_priv, int pipe);
 void intel_finish_page_flip_mmio(struct drm_i915_private *dev_priv, int pipe);
 void intel_check_page_flip(struct drm_i915_private *dev_priv, int pipe);
 int intel_prepare_plane_fb(struct drm_plane *plane,
-                          const struct drm_plane_state *new_state);
+                          struct drm_plane_state *new_state);
 void intel_cleanup_plane_fb(struct drm_plane *plane,
-                           const struct drm_plane_state *old_state);
+                           struct drm_plane_state *old_state);
 int intel_plane_atomic_get_property(struct drm_plane *plane,
                                    const struct drm_plane_state *state,
                                    struct drm_property *property,
index 9f96dfe67769938aedc3a2b561642cb47b7673b2..7c9626d92019780ff83386e1b89cf5db53d14daf 100644 (file)
@@ -99,7 +99,7 @@ static const struct drm_plane_funcs mdp4_plane_funcs = {
 };
 
 static int mdp4_plane_prepare_fb(struct drm_plane *plane,
-               const struct drm_plane_state *new_state)
+                                struct drm_plane_state *new_state)
 {
        struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane);
        struct mdp4_kms *mdp4_kms = get_kms(plane);
@@ -113,7 +113,7 @@ static int mdp4_plane_prepare_fb(struct drm_plane *plane,
 }
 
 static void mdp4_plane_cleanup_fb(struct drm_plane *plane,
-               const struct drm_plane_state *old_state)
+                                 struct drm_plane_state *old_state)
 {
        struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane);
        struct mdp4_kms *mdp4_kms = get_kms(plane);
index a02a24e75ba647dd4e1c8379fc7aa530432fb307..ba8f43278a44e0c576f548b799ec6c5d0cc79ba4 100644 (file)
@@ -250,7 +250,7 @@ static const struct drm_plane_funcs mdp5_plane_funcs = {
 };
 
 static int mdp5_plane_prepare_fb(struct drm_plane *plane,
-               const struct drm_plane_state *new_state)
+                                struct drm_plane_state *new_state)
 {
        struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
        struct mdp5_kms *mdp5_kms = get_kms(plane);
@@ -264,7 +264,7 @@ static int mdp5_plane_prepare_fb(struct drm_plane *plane,
 }
 
 static void mdp5_plane_cleanup_fb(struct drm_plane *plane,
-               const struct drm_plane_state *old_state)
+                                 struct drm_plane_state *old_state)
 {
        struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
        struct mdp5_kms *mdp5_kms = get_kms(plane);
index 4c7727e6be7c45edabbb2cf83bdc1d7690e0c280..66ac8c40db2614966af3992b561feb43dec5ab10 100644 (file)
@@ -60,7 +60,7 @@ to_omap_plane_state(struct drm_plane_state *state)
 }
 
 static int omap_plane_prepare_fb(struct drm_plane *plane,
-                                const struct drm_plane_state *new_state)
+                                struct drm_plane_state *new_state)
 {
        if (!new_state->fb)
                return 0;
@@ -69,7 +69,7 @@ static int omap_plane_prepare_fb(struct drm_plane *plane,
 }
 
 static void omap_plane_cleanup_fb(struct drm_plane *plane,
-                                 const struct drm_plane_state *old_state)
+                                 struct drm_plane_state *old_state)
 {
        if (old_state->fb)
                omap_framebuffer_unpin(old_state->fb);
index ec8ad005835cbb8b196b0340f8cf33c3ff1f1003..f417b49991dd8e45499b4d40224c3810d9107501 100644 (file)
@@ -567,7 +567,7 @@ static void vop_plane_destroy(struct drm_plane *plane)
 }
 
 static int vop_plane_prepare_fb(struct drm_plane *plane,
-                               const struct drm_plane_state *new_state)
+                               struct drm_plane_state *new_state)
 {
        if (plane->state->fb)
                drm_framebuffer_reference(plane->state->fb);
@@ -576,7 +576,7 @@ static int vop_plane_prepare_fb(struct drm_plane *plane,
 }
 
 static void vop_plane_cleanup_fb(struct drm_plane *plane,
-                                const struct drm_plane_state *old_state)
+                                struct drm_plane_state *old_state)
 {
        if (old_state->fb)
                drm_framebuffer_unreference(old_state->fb);
index 8495bd01b5449e886c723b285199a37cf8e8a520..a02730f908615fac245c62aee326d61e5b94302d 100644 (file)
@@ -481,13 +481,13 @@ static const struct drm_plane_funcs tegra_primary_plane_funcs = {
 };
 
 static int tegra_plane_prepare_fb(struct drm_plane *plane,
-                                 const struct drm_plane_state *new_state)
+                                 struct drm_plane_state *new_state)
 {
        return 0;
 }
 
 static void tegra_plane_cleanup_fb(struct drm_plane *plane,
-                                  const struct drm_plane_state *old_fb)
+                                  struct drm_plane_state *old_fb)
 {
 }
 
index 686feec6b4c844ccebaaa6d43685119ea2299476..6c8d3dad66ec0f15bb1dbbc68d862042d63e2ae0 100644 (file)
@@ -855,7 +855,7 @@ struct drm_plane_helper_funcs {
         * everything else must complete successfully.
         */
        int (*prepare_fb)(struct drm_plane *plane,
-                         const struct drm_plane_state *new_state);
+                         struct drm_plane_state *new_state);
        /**
         * @cleanup_fb:
         *
@@ -866,7 +866,7 @@ struct drm_plane_helper_funcs {
         * transitional plane helpers, but it is optional.
         */
        void (*cleanup_fb)(struct drm_plane *plane,
-                          const struct drm_plane_state *old_state);
+                          struct drm_plane_state *old_state);
 
        /**
         * @atomic_check: