diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2015-05-01 19:02:36 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2015-06-11 18:55:35 +0900 |
commit | 49f5b0bc301414df049e00d226034e3d6e56421b (patch) | |
tree | 3f62962e2187fe2ffaf6fd5770731ba22999e4ca /src/radeon_dri2.c | |
parent | afab7839fc15722dbaa7203d00fe7f6ce5336b9d (diff) |
Don't attempt a DRI2/Present page flip while the other one is flipping
Fixes corrupted display and hangs when switching between DRI2 and DRI3
fullscreen apps, e.g. a compositor using DRI3 and a fullscreen app using
DRI2 or vice versa.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/radeon_dri2.c')
-rw-r--r-- | src/radeon_dri2.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c index a1f01455..7587a0cc 100644 --- a/src/radeon_dri2.c +++ b/src/radeon_dri2.c @@ -584,6 +584,7 @@ static void radeon_dri2_flip_event_handler(ScrnInfoPtr scrn, uint32_t frame, uint64_t usec, void *event_data) { + RADEONInfoPtr info = RADEONPTR(scrn); DRI2FrameEventPtr flip = event_data; unsigned tv_sec, tv_usec; DrawablePtr drawable; @@ -627,6 +628,7 @@ radeon_dri2_flip_event_handler(ScrnInfoPtr scrn, uint32_t frame, uint64_t usec, DRI2SwapComplete(flip->client, drawable, frame, tv_sec, tv_usec, DRI2_FLIP_COMPLETE, flip->event_complete, flip->event_data); + info->drmmode.dri2_flipping = FALSE; break; default: xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: unknown vblank event received\n", __func__); @@ -644,6 +646,7 @@ radeon_dri2_schedule_flip(ScrnInfoPtr scrn, ClientPtr client, DRI2BufferPtr back, DRI2SwapEventPtr func, void *data, unsigned int target_msc) { + RADEONInfoPtr info = RADEONPTR(scrn); struct dri2_buffer_priv *back_priv; struct radeon_bo *bo; DRI2FrameEventPtr flip_info; @@ -670,11 +673,16 @@ radeon_dri2_schedule_flip(ScrnInfoPtr scrn, ClientPtr client, back_priv = back->driverPrivate; bo = radeon_get_pixmap_bo(back_priv->pixmap); - return radeon_do_pageflip(scrn, client, bo->handle, - RADEON_DRM_QUEUE_ID_DEFAULT, flip_info, - ref_crtc_hw_id, - radeon_dri2_flip_event_handler, - radeon_dri2_flip_event_abort); + if (radeon_do_pageflip(scrn, client, bo->handle, + RADEON_DRM_QUEUE_ID_DEFAULT, flip_info, + ref_crtc_hw_id, + radeon_dri2_flip_event_handler, + radeon_dri2_flip_event_abort)) { + info->drmmode.dri2_flipping = TRUE; + return TRUE; + } + + return FALSE; } static Bool @@ -742,8 +750,11 @@ static Bool can_flip(ScrnInfoPtr pScrn, DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr back) { + RADEONInfoPtr info = RADEONPTR(pScrn); + return draw->type == DRAWABLE_WINDOW && - RADEONPTR(pScrn)->allowPageFlip && + info->allowPageFlip && + !info->drmmode.present_flipping && pScrn->vtSema && DRI2CanFlip(draw) && can_exchange(pScrn, draw, front, back); |