Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drm/vc4: Partial revert of 4441 #4478

Merged
merged 8 commits into from Jul 26, 2021
13 changes: 13 additions & 0 deletions drivers/gpu/drm/vc4/vc4_crtc.c
Expand Up @@ -781,6 +781,7 @@ 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);
Expand Down Expand Up @@ -812,6 +813,8 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb)
}

kfree(flip_state);

up(&vc4->async_modeset);
}

/* Implements async (non-vblank-synced) page flips.
Expand All @@ -826,6 +829,7 @@ 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;
Expand Down Expand Up @@ -854,6 +858,15 @@ 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
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/vc4/vc4_drv.h
Expand Up @@ -216,6 +216,8 @@ 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;
Expand Down