summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>2018-11-13 09:08:01 -0500
committerMichel Daenzer <michel@daenzer.net>2018-11-30 15:40:34 +0000
commit2d18b37159edc526c73a36143fe9b5d6b75e610a (patch)
tree8c3080f9635cca6270bc0cf0f5bb0c59efc75e08
parent13c94a373b4858a2d2aa14c22b5f98d53c84c0d9 (diff)
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>
-rw-r--r--src/amdgpu_drv.h1
-rw-r--r--src/amdgpu_present.c7
2 files changed, 6 insertions, 2 deletions
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 44c769f..ed9241b 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -301,6 +301,7 @@ typedef struct {
int group_bytes;
/* kms pageflipping */
+ WindowPtr flip_window;
Bool allowPageFlip;
/* cursor size */
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index f9e07a5..85b2e67 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -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;