diff options
Diffstat (limited to 'src/amdgpu_kms.c')
-rw-r--r-- | src/amdgpu_kms.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c index 230a779..aedb3f0 100644 --- a/src/amdgpu_kms.c +++ b/src/amdgpu_kms.c @@ -793,32 +793,27 @@ amdgpu_dirty_update(ScrnInfoPtr scrn) Bool amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id, - DrawablePtr src_draw) + DrawablePtr src_draw, BoxPtr extents) { drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private; - RegionPtr pRegion = DamageRegion(drmmode_crtc->scanout_damage); + RegionRec region = { .extents = *extents, .data = NULL }; ScrnInfoPtr scrn = xf86_crtc->scrn; ScreenPtr pScreen = scrn->pScreen; DrawablePtr pDraw; - BoxRec extents; if (!xf86_crtc->enabled || - !drmmode_crtc->scanout[scanout_id].pixmap) - return FALSE; - - if (!RegionNotEmpty(pRegion)) + !drmmode_crtc->scanout[scanout_id].pixmap || + extents->x1 >= extents->x2 || extents->y1 >= extents->y2) return FALSE; pDraw = &drmmode_crtc->scanout[scanout_id].pixmap->drawable; - extents = *RegionExtents(pRegion); - if (!amdgpu_scanout_extents_intersect(xf86_crtc, &extents)) + if (!amdgpu_scanout_extents_intersect(xf86_crtc, extents)) return FALSE; if (drmmode_crtc->tear_free) { - amdgpu_sync_scanout_pixmaps(xf86_crtc, pRegion, scanout_id); - RegionCopy(&drmmode_crtc->scanout_last_region, pRegion); + amdgpu_sync_scanout_pixmaps(xf86_crtc, ®ion, scanout_id); + RegionCopy(&drmmode_crtc->scanout_last_region, ®ion); } - RegionEmpty(pRegion); #if XF86_CRTC_VERSION >= 4 if (xf86_crtc->driverIsPerformingTransform) { @@ -856,9 +851,9 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id, pScreen->SourceValidate = NULL; CompositePicture(PictOpSrc, src, NULL, dst, - extents.x1, extents.y1, 0, 0, extents.x1, - extents.y1, extents.x2 - extents.x1, - extents.y2 - extents.y1); + extents->x1, extents->y1, 0, 0, extents->x1, + extents->y1, extents->x2 - extents->x1, + extents->y2 - extents->y1); pScreen->SourceValidate = SourceValidate; free_dst: @@ -873,9 +868,9 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id, ValidateGC(pDraw, gc); (*gc->ops->CopyArea)(src_draw, pDraw, gc, - xf86_crtc->x + extents.x1, xf86_crtc->y + extents.y1, - extents.x2 - extents.x1, extents.y2 - extents.y1, - extents.x1, extents.y1); + xf86_crtc->x + extents->x1, xf86_crtc->y + extents->y1, + extents->x2 - extents->x1, extents->y2 - extents->y1, + extents->x1, extents->y1); FreeScratchGC(gc); } @@ -898,9 +893,12 @@ amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, { drmmode_crtc_private_ptr drmmode_crtc = event_data; ScreenPtr screen = crtc->scrn->pScreen; + RegionPtr region = DamageRegion(drmmode_crtc->scanout_damage); amdgpu_scanout_do_update(crtc, drmmode_crtc->scanout_id, - &screen->GetWindowPixmap(screen->root)->drawable); + &screen->GetWindowPixmap(screen->root)->drawable, + ®ion->extents); + RegionEmpty(region); amdgpu_scanout_update_abort(crtc, event_data); } @@ -977,6 +975,7 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info, xf86CrtcPtr xf86_crtc) { drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private; + RegionPtr region = DamageRegion(drmmode_crtc->scanout_damage); ScrnInfoPtr scrn = xf86_crtc->scrn; AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn); uintptr_t drm_queue_seq; @@ -988,8 +987,10 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info, scanout_id = drmmode_crtc->scanout_id ^ 1; if (!amdgpu_scanout_do_update(xf86_crtc, scanout_id, - &pScreen->GetWindowPixmap(pScreen->root)->drawable)) + &pScreen->GetWindowPixmap(pScreen->root)->drawable, + ®ion->extents)) return; + RegionEmpty(region); drm_queue_seq = amdgpu_drm_queue_alloc(xf86_crtc, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT, |