Pass extents to amdgpu_scanout_do_update

Preparation for following change, no functional change intended yet.

(Ported from radeon commit 65e0c5ea1b4adff21d673dbf54af99704c429627)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Michel Dänzer
2017-08-18 16:46:18 +09:00
committed by Michel Dänzer
parent cc1dfb88eb
commit d8e8f0107b
3 changed files with 24 additions and 22 deletions

View File

@@ -341,7 +341,7 @@ Bool amdgpu_dri3_screen_init(ScreenPtr screen);
/* amdgpu_kms.c */
Bool amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
DrawablePtr src_draw);
DrawablePtr src_draw, BoxPtr extents);
void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
, RegionPtr pBSRegion

View File

@@ -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, &region, scanout_id);
RegionCopy(&drmmode_crtc->scanout_last_region, &region);
}
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,
&region->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,
&region->extents))
return;
RegionEmpty(region);
drm_queue_seq = amdgpu_drm_queue_alloc(xf86_crtc,
AMDGPU_DRM_QUEUE_CLIENT_DEFAULT,

View File

@@ -771,7 +771,8 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
*x = *y = 0;
amdgpu_scanout_do_update(crtc, scanout_id,
&screen->GetWindowPixmap(screen->root)->drawable);
&screen->GetWindowPixmap(screen->root)->drawable,
box);
amdgpu_glamor_finish(scrn);
}
}