From 4d506c23c9a628204fa23607931557b07ada3e31 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Wed, 22 Jun 2016 17:16:24 +0900 Subject: present: Separate checks for flips vs unflips v2 All unflip checks apply to flips as well, but not vice versa. v2: Add comment above amdgpu_present_check_unflip (Alex) Reviewed-by: Alex Deucher --- src/amdgpu_present.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c index c0b2f17..edfccb1 100644 --- a/src/amdgpu_present.c +++ b/src/amdgpu_present.c @@ -211,15 +211,13 @@ amdgpu_present_flush(WindowPtr window) } /* - * Test to see if page flipping is possible on the target crtc + * Test to see if unflipping is possible + * + * These tests have to pass for flips as well */ static Bool -amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, - Bool sync_flip) +amdgpu_present_check_unflip(ScrnInfoPtr scrn) { - ScreenPtr screen = window->drawable.pScreen; - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - AMDGPUInfoPtr info = AMDGPUPTR(scrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int num_crtcs_on; int i; @@ -227,15 +225,6 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, if (!scrn->vtSema) return FALSE; - if (!info->allowPageFlip) - return FALSE; - - if (info->hwcursor_disabled) - return FALSE; - - if (info->drmmode.dri2_flipping) - return FALSE; - for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) { drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private; @@ -253,6 +242,29 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, return num_crtcs_on > 0; } +/* + * Test to see if page flipping is possible on the target crtc + */ +static Bool +amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, + Bool sync_flip) +{ + ScreenPtr screen = window->drawable.pScreen; + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + AMDGPUInfoPtr info = AMDGPUPTR(scrn); + + if (!info->allowPageFlip) + return FALSE; + + if (info->hwcursor_disabled) + return FALSE; + + if (info->drmmode.dri2_flipping) + return FALSE; + + return amdgpu_present_check_unflip(scrn); +} + /* * Once the flip has been completed on all CRTCs, notify the * extension code telling it when that happened @@ -333,7 +345,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id) PixmapPtr pixmap = screen->GetScreenPixmap(screen); int i; - if (!amdgpu_present_check_flip(NULL, screen->root, pixmap, TRUE)) + if (!amdgpu_present_check_unflip(scrn)) goto modeset; event = calloc(1, sizeof(struct amdgpu_present_vblank_event)); -- cgit v1.2.3