]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm: Add acquire ctx parameter to ->set_config
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 22 Mar 2017 21:50:57 +0000 (22:50 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 29 Mar 2017 07:56:25 +0000 (09:56 +0200)
Surprisingly a lot of legacy drivers roll their own, for
runtime pm and because vmwgfx.

Also make nouveau's set_config static while at it.

Cc: Sinclair Yeh <syeh@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170322215058.8671-19-daniel.vetter@ffwll.ch
17 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/drm_plane_helper.c
drivers/gpu/drm/gma500/gma_display.c
drivers/gpu/drm/gma500/gma_display.h
drivers/gpu/drm/nouveau/dispnv04/crtc.c
drivers/gpu/drm/nouveau/nouveau_display.h
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
include/drm/drm_atomic_helper.h
include/drm/drm_crtc.h
include/drm/drm_crtc_helper.h

index 7b4fe91d3aecd82ea6ecb6b747bfc51118ca232b..ce15721caddab9dcd622de06294da70f80ff10f8 100644 (file)
@@ -333,7 +333,8 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,
        return 0;
 }
 
-int amdgpu_crtc_set_config(struct drm_mode_set *set)
+int amdgpu_crtc_set_config(struct drm_mode_set *set,
+                          struct drm_modeset_acquire_ctx *ctx)
 {
        struct drm_device *dev;
        struct amdgpu_device *adev;
@@ -350,7 +351,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set)
        if (ret < 0)
                return ret;
 
-       ret = drm_crtc_helper_set_config(set);
+       ret = drm_crtc_helper_set_config(set, ctx);
 
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
                if (crtc->enabled)
index 8573a818323f6e5dbfa2c90cde9ba8156e703e22..db8f8dda209c7880b0ede9e79268a7c9726b3b5c 100644 (file)
@@ -590,7 +590,8 @@ int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool tile
 /* amdgpu_display.c */
 void amdgpu_print_display_setup(struct drm_device *dev);
 int amdgpu_modeset_create_props(struct amdgpu_device *adev);
-int amdgpu_crtc_set_config(struct drm_mode_set *set);
+int amdgpu_crtc_set_config(struct drm_mode_set *set,
+                          struct drm_modeset_acquire_ctx *ctx);
 int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,
                                 struct drm_framebuffer *fb,
                                 struct drm_pending_vblank_event *event,
index 5771def4cef0aad99240487de313bddcd8e23782..c137e39fc5068be004d99292082148bb7d7aa83c 100644 (file)
@@ -2265,6 +2265,7 @@ static int update_output_state(struct drm_atomic_state *state,
 /**
  * drm_atomic_helper_set_config - set a new config from userspace
  * @set: mode set configuration
+ * @ctx: lock acquisition context
  *
  * Provides a default crtc set_config handler using the atomic driver interface.
  *
@@ -2277,7 +2278,8 @@ static int update_output_state(struct drm_atomic_state *state,
  * Returns:
  * Returns 0 on success, negative errno numbers on failure.
  */
-int drm_atomic_helper_set_config(struct drm_mode_set *set)
+int drm_atomic_helper_set_config(struct drm_mode_set *set,
+                                struct drm_modeset_acquire_ctx *ctx)
 {
        struct drm_atomic_state *state;
        struct drm_crtc *crtc = set->crtc;
index 3553d8232649883fc2f4733909f031294fd6bdb2..b3f9f178375d1a81a2e38192042ae5c6e72d30d7 100644 (file)
@@ -465,7 +465,7 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
 
        fb = set->fb;
 
-       ret = crtc->funcs->set_config(set);
+       ret = crtc->funcs->set_config(set, ctx);
        if (ret == 0) {
                crtc->primary->crtc = crtc;
                crtc->primary->fb = fb;
index 8aa8c10841217445117e34e49c423c878e76237d..4afdf7902eda7d4a50c2ac0bacb30ca40ec3f31d 100644 (file)
@@ -476,6 +476,7 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
 /**
  * drm_crtc_helper_set_config - set a new config from userspace
  * @set: mode set configuration
+ * @ctx: lock acquire context, not used here
  *
  * The drm_crtc_helper_set_config() helper function implements the of
  * &drm_crtc_funcs.set_config callback for drivers using the legacy CRTC
@@ -510,7 +511,8 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
  * Returns:
  * Returns 0 on success, negative errno numbers on failure.
  */
-int drm_crtc_helper_set_config(struct drm_mode_set *set)
+int drm_crtc_helper_set_config(struct drm_mode_set *set,
+                              struct drm_modeset_acquire_ctx *ctx)
 {
        struct drm_device *dev;
        struct drm_crtc **save_encoder_crtcs, *new_crtc;
index 775e94c30368add267a28a3e316031829aa3e69e..b84a295230fcd4ba7f7493a53d219e5c2ae93d4b 100644 (file)
@@ -371,7 +371,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
         * drm_mode_setplane() already handles the basic refcounting for the
         * framebuffers involved in this operation.
         */
-       ret = crtc->funcs->set_config(&set);
+       ret = crtc->funcs->set_config(&set, ctx);
 
        kfree(connector_list);
        return ret;
index d1c5642b1c1e3d3bc21d48f025af3083aac80d7b..93ff46535c046bb0bb698af909a68481033574ab 100644 (file)
@@ -514,17 +514,18 @@ void gma_crtc_destroy(struct drm_crtc *crtc)
        kfree(gma_crtc);
 }
 
-int gma_crtc_set_config(struct drm_mode_set *set)
+int gma_crtc_set_config(struct drm_mode_set *set,
+                       struct drm_modeset_acquire_ctx *ctx)
 {
        struct drm_device *dev = set->crtc->dev;
        struct drm_psb_private *dev_priv = dev->dev_private;
        int ret;
 
        if (!dev_priv->rpm_enabled)
-               return drm_crtc_helper_set_config(set);
+               return drm_crtc_helper_set_config(set, ctx);
 
        pm_runtime_forbid(&dev->pdev->dev);
-       ret = drm_crtc_helper_set_config(set);
+       ret = drm_crtc_helper_set_config(set, ctx);
        pm_runtime_allow(&dev->pdev->dev);
 
        return ret;
index e72dd08b701bb7830005e371cbc424b5b3ab37cc..166e608923dbd589077f993432d6daa0499d0d25 100644 (file)
@@ -79,7 +79,8 @@ extern void gma_crtc_prepare(struct drm_crtc *crtc);
 extern void gma_crtc_commit(struct drm_crtc *crtc);
 extern void gma_crtc_disable(struct drm_crtc *crtc);
 extern void gma_crtc_destroy(struct drm_crtc *crtc);
-extern int gma_crtc_set_config(struct drm_mode_set *set);
+extern int gma_crtc_set_config(struct drm_mode_set *set,
+                              struct drm_modeset_acquire_ctx *ctx);
 
 extern void gma_crtc_save(struct drm_crtc *crtc);
 extern void gma_crtc_restore(struct drm_crtc *crtc);
index ab7b69c11d40fab09c710c9a3cde981aa9863990..43ab560de7f98884a4c5f018805093b9af69f7d6 100644 (file)
@@ -1031,8 +1031,9 @@ nv04_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
        return 0;
 }
 
-int
-nouveau_crtc_set_config(struct drm_mode_set *set)
+static int
+nouveau_crtc_set_config(struct drm_mode_set *set,
+                       struct drm_modeset_acquire_ctx *ctx)
 {
        struct drm_device *dev;
        struct nouveau_drm *drm;
@@ -1049,7 +1050,7 @@ nouveau_crtc_set_config(struct drm_mode_set *set)
        if (ret < 0 && ret != -EACCES)
                return ret;
 
-       ret = drm_crtc_helper_set_config(set);
+       ret = drm_crtc_helper_set_config(set, ctx);
 
        drm = nouveau_drm(dev);
 
index 8b33e1db247e01bd7fa6edfdb6b29e92187cc694..e1d772d394887eb91cbc09672169ccd7becf2393 100644 (file)
@@ -88,7 +88,6 @@ int  nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
 
 void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
 
-int nouveau_crtc_set_config(struct drm_mode_set *set);
 #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
 extern int nouveau_backlight_init(struct drm_device *);
 extern void nouveau_backlight_exit(struct drm_device *);
index 31020db573d5665131fb5dc67948624c784f3492..146297a702ab0fe95752fa72e581f86c1d917954 100644 (file)
@@ -624,7 +624,8 @@ cleanup:
 }
 
 static int
-radeon_crtc_set_config(struct drm_mode_set *set)
+radeon_crtc_set_config(struct drm_mode_set *set,
+                      struct drm_modeset_acquire_ctx *ctx)
 {
        struct drm_device *dev;
        struct radeon_device *rdev;
@@ -641,7 +642,7 @@ radeon_crtc_set_config(struct drm_mode_set *set)
        if (ret < 0)
                return ret;
 
-       ret = drm_crtc_helper_set_config(set);
+       ret = drm_crtc_helper_set_config(set, ctx);
 
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
                if (crtc->enabled)
index 3806148e1bdb5e40985045cd1ecf4dfa1222f898..08a66f0db2ec2cc762a31ebca72bce97b7daf124 100644 (file)
@@ -208,7 +208,8 @@ static int vmw_ldu_add_active(struct vmw_private *vmw_priv,
        return 0;
 }
 
-static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
+static int vmw_ldu_crtc_set_config(struct drm_mode_set *set,
+                                  struct drm_modeset_acquire_ctx *ctx)
 {
        struct vmw_private *dev_priv;
        struct vmw_legacy_display_unit *ldu;
index 53cf3be7a902dac82bb22d2ff2ee43a5b4e38cbe..e9d3c4b92df7f2b80c51987d572e5f1c533f029b 100644 (file)
@@ -248,7 +248,8 @@ static int vmw_sou_backing_alloc(struct vmw_private *dev_priv,
        return ret;
 }
 
-static int vmw_sou_crtc_set_config(struct drm_mode_set *set)
+static int vmw_sou_crtc_set_config(struct drm_mode_set *set,
+                                  struct drm_modeset_acquire_ctx *ctx)
 {
        struct vmw_private *dev_priv;
        struct vmw_screen_object_unit *sou;
index 85e12309cb71b17be1527eef7ca1effb3c6b9020..b2c9d6ce7ce42d899afe3997951bd260ebcb629c 100644 (file)
@@ -509,7 +509,8 @@ out_srf_unref:
  * RETURNS:
  * 0 on success, error code otherwise
  */
-static int vmw_stdu_crtc_set_config(struct drm_mode_set *set)
+static int vmw_stdu_crtc_set_config(struct drm_mode_set *set,
+                                   struct drm_modeset_acquire_ctx *ctx)
 {
        struct vmw_private *dev_priv;
        struct vmw_framebuffer *vfb;
index 9675cacb72a392433d42156a8a98eaf942af9f80..fd395dc050ee36c56b38ff4e26ac30cffa988b14 100644 (file)
@@ -100,7 +100,8 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane,
                                    struct drm_modeset_acquire_ctx *ctx);
 int __drm_atomic_helper_disable_plane(struct drm_plane *plane,
                struct drm_plane_state *plane_state);
-int drm_atomic_helper_set_config(struct drm_mode_set *set);
+int drm_atomic_helper_set_config(struct drm_mode_set *set,
+                                struct drm_modeset_acquire_ctx *ctx);
 int __drm_atomic_helper_set_config(struct drm_mode_set *set,
                struct drm_atomic_state *state);
 
index 1a525ce66468df8fd8b11fbbfe4fc23174142841..2be2192b13733cf2b6b714bea65ce56cab868f7e 100644 (file)
@@ -347,7 +347,8 @@ struct drm_crtc_funcs {
         *
         * 0 on success or a negative error code on failure.
         */
-       int (*set_config)(struct drm_mode_set *set);
+       int (*set_config)(struct drm_mode_set *set,
+                         struct drm_modeset_acquire_ctx *ctx);
 
        /**
         * @page_flip:
index 7506a60df8b12155471341e9b4840aa69454cf3c..43505c7b2b3ffe2ef9d4bf33904e3c36c7bf186e 100644 (file)
@@ -44,7 +44,8 @@
 #include <drm/drm_modeset_helper.h>
 
 void drm_helper_disable_unused_functions(struct drm_device *dev);
-int drm_crtc_helper_set_config(struct drm_mode_set *set);
+int drm_crtc_helper_set_config(struct drm_mode_set *set,
+                              struct drm_modeset_acquire_ctx *ctx);
 bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
                              struct drm_display_mode *mode,
                              int x, int y,