Check last flip window instead of screen root before flipping

A significant amount of time can pass between the X call into
check_flip for a window and when amdgpu_present_flip actually occurs.
To ensure that flipping is still possible there was an additional check
performed on screen->root in amdgpu_present_flip - but what should
be checked instead is the window itself. This only really worked before
because X ensures that the window has the same dimensions as the screen
to allow for present extension flipping.

This patch tracks the flip window between calls to check_flip and flip
and uses that window instead of screen->root.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
This commit is contained in:
Nicholas Kazlauskas
2018-11-13 09:08:01 -05:00
committed by Michel Daenzer
parent 13c94a373b
commit 2d18b37159
2 changed files with 6 additions and 2 deletions

View File

@@ -301,6 +301,7 @@ typedef struct {
int group_bytes;
/* kms pageflipping */
WindowPtr flip_window;
Bool allowPageFlip;
/* cursor size */

View File

@@ -273,6 +273,8 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
if (num_crtcs_on == 0)
return FALSE;
info->flip_window = window;
return TRUE;
}
@@ -313,13 +315,12 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
PixmapPtr pixmap, Bool sync_flip)
{
xf86CrtcPtr xf86_crtc = crtc->devPrivate;
ScreenPtr screen = crtc->pScreen;
ScrnInfoPtr scrn = xf86_crtc->scrn;
AMDGPUInfoPtr info = AMDGPUPTR(scrn);
struct amdgpu_present_vblank_event *event;
Bool ret = FALSE;
if (!amdgpu_present_check_flip(crtc, screen->root, pixmap, sync_flip))
if (!amdgpu_present_check_flip(crtc, info->flip_window , pixmap, sync_flip))
return ret;
event = calloc(1, sizeof(struct amdgpu_present_vblank_event));
@@ -360,6 +361,8 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
FLIP_ASYNC : FLIP_VSYNC;
int i;
info->flip_window = NULL;
if (!amdgpu_present_check_unflip(scrn))
goto modeset;