OSDN Git Service

drm/vc4: kms: Remove async modeset semaphore
authorMaxime Ripard <maxime@cerno.tech>
Fri, 4 Dec 2020 15:11:37 +0000 (16:11 +0100)
committerMaxime Ripard <maxime@cerno.tech>
Tue, 15 Dec 2020 10:36:13 +0000 (11:36 +0100)
Now that we have proper ordering guaranteed by the previous patch, the
semaphore is redundant and can be removed.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20201204151138.1739736-7-maxime@cerno.tech
drivers/gpu/drm/vc4/vc4_crtc.c
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_kms.c

index ea710be..ee4f657 100644 (file)
@@ -697,7 +697,6 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb)
                container_of(cb, struct vc4_async_flip_state, cb);
        struct drm_crtc *crtc = flip_state->crtc;
        struct drm_device *dev = crtc->dev;
-       struct vc4_dev *vc4 = to_vc4_dev(dev);
        struct drm_plane *plane = crtc->primary;
 
        vc4_plane_async_set_fb(plane, flip_state->fb);
@@ -729,8 +728,6 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb)
        }
 
        kfree(flip_state);
-
-       up(&vc4->async_modeset);
 }
 
 /* Implements async (non-vblank-synced) page flips.
@@ -745,7 +742,6 @@ static int vc4_async_page_flip(struct drm_crtc *crtc,
                               uint32_t flags)
 {
        struct drm_device *dev = crtc->dev;
-       struct vc4_dev *vc4 = to_vc4_dev(dev);
        struct drm_plane *plane = crtc->primary;
        int ret = 0;
        struct vc4_async_flip_state *flip_state;
@@ -774,15 +770,6 @@ static int vc4_async_page_flip(struct drm_crtc *crtc,
        flip_state->crtc = crtc;
        flip_state->event = event;
 
-       /* Make sure all other async modesetes have landed. */
-       ret = down_interruptible(&vc4->async_modeset);
-       if (ret) {
-               drm_framebuffer_put(fb);
-               vc4_bo_dec_usecnt(bo);
-               kfree(flip_state);
-               return ret;
-       }
-
        /* Save the current FB before it's replaced by the new one in
         * drm_atomic_set_fb_for_plane(). We'll need the old FB in
         * vc4_async_page_flip_complete() to decrement the BO usecnt and keep
index fc06297..6db4c94 100644 (file)
@@ -214,8 +214,6 @@ struct vc4_dev {
                struct work_struct reset_work;
        } hangcheck;
 
-       struct semaphore async_modeset;
-
        struct drm_modeset_lock ctm_state_lock;
        struct drm_private_obj ctm_manager;
        struct drm_private_obj hvs_channels;
index 5d81b90..48d07ea 100644 (file)
@@ -418,8 +418,6 @@ vc4_atomic_complete_commit(struct drm_atomic_state *state)
                clk_set_min_rate(hvs->core_clk, 0);
 
        drm_atomic_state_put(state);
-
-       up(&vc4->async_modeset);
 }
 
 static void commit_work(struct work_struct *work)
@@ -477,26 +475,17 @@ static int vc4_atomic_commit(struct drm_device *dev,
                             struct drm_atomic_state *state,
                             bool nonblock)
 {
-       struct vc4_dev *vc4 = to_vc4_dev(dev);
        int ret;
 
        if (state->async_update) {
-               ret = down_interruptible(&vc4->async_modeset);
-               if (ret)
-                       return ret;
-
                ret = drm_atomic_helper_prepare_planes(dev, state);
-               if (ret) {
-                       up(&vc4->async_modeset);
+               if (ret)
                        return ret;
-               }
 
                drm_atomic_helper_async_commit(dev, state);
 
                drm_atomic_helper_cleanup_planes(dev, state);
 
-               up(&vc4->async_modeset);
-
                return 0;
        }
 
@@ -512,21 +501,14 @@ static int vc4_atomic_commit(struct drm_device *dev,
 
        INIT_WORK(&state->commit_work, commit_work);
 
-       ret = down_interruptible(&vc4->async_modeset);
-       if (ret)
-               return ret;
-
        ret = drm_atomic_helper_prepare_planes(dev, state);
-       if (ret) {
-               up(&vc4->async_modeset);
+       if (ret)
                return ret;
-       }
 
        if (!nonblock) {
                ret = drm_atomic_helper_wait_for_fences(dev, state, true);
                if (ret) {
                        drm_atomic_helper_cleanup_planes(dev, state);
-                       up(&vc4->async_modeset);
                        return ret;
                }
        }
@@ -1008,8 +990,6 @@ int vc4_kms_load(struct drm_device *dev)
                vc4->load_tracker_enabled = true;
        }
 
-       sema_init(&vc4->async_modeset, 1);
-
        /* Set support for vblank irq fast disable, before drm_vblank_init() */
        dev->vblank_disable_immediate = true;