EXA/mixed: Handle results of software fallbacks in DamageReport hook.
This is more elegant and probably also slightly more correct than doing it at FinishAccess time. Signed-off-by: Michel Dänzer <daenzer@vmware.com> Acked-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
08bf26c28f
commit
0c1f43c0f3
|
@ -425,9 +425,6 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
|
|||
/* We always hide the devPrivate.ptr. */
|
||||
pPixmap->devPrivate.ptr = NULL;
|
||||
|
||||
if (pExaScr->finish_access)
|
||||
pExaScr->finish_access(pPixmap, index);
|
||||
|
||||
if (!pExaScr->info->FinishAccess || !exaPixmapHasGpuCopy(pPixmap))
|
||||
return;
|
||||
|
||||
|
@ -981,7 +978,6 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
pExaScr->do_move_in_pixmap = exaMoveInPixmap_mixed;
|
||||
pExaScr->do_move_out_pixmap = NULL;
|
||||
pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed;
|
||||
pExaScr->finish_access = exaFinishAccess_mixed;
|
||||
} else {
|
||||
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
|
||||
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver);
|
||||
|
@ -991,7 +987,6 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
pExaScr->do_move_in_pixmap = NULL;
|
||||
pExaScr->do_move_out_pixmap = NULL;
|
||||
pExaScr->prepare_access_reg = NULL;
|
||||
pExaScr->finish_access = NULL;
|
||||
}
|
||||
} else {
|
||||
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
|
||||
|
@ -1002,7 +997,6 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
pExaScr->do_move_in_pixmap = exaMoveInPixmap_classic;
|
||||
pExaScr->do_move_out_pixmap = exaMoveOutPixmap_classic;
|
||||
pExaScr->prepare_access_reg = exaPrepareAccessReg_classic;
|
||||
pExaScr->finish_access = NULL;
|
||||
}
|
||||
if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
|
||||
LogMessage(X_INFO, "EXA(%d): Offscreen pixmap area of %lu bytes\n",
|
||||
|
|
|
@ -134,10 +134,32 @@ exaMoveInPixmap_mixed(PixmapPtr pPixmap)
|
|||
exaDoMigration(pixmaps, 1, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure)
|
||||
{
|
||||
PixmapPtr pPixmap = closure;
|
||||
ExaPixmapPriv(pPixmap);
|
||||
|
||||
/* Move back results of software rendering on system memory copy of mixed driver
|
||||
* pixmap (see exaPrepareAccessReg_mixed).
|
||||
*
|
||||
* Defer moving the destination back into the driver pixmap, to try and save
|
||||
* overhead on multiple subsequent software fallbacks.
|
||||
*/
|
||||
if (!pExaPixmap->use_gpu_copy && exaPixmapHasGpuCopy(pPixmap)) {
|
||||
ExaScreenPriv(pPixmap->drawable.pScreen);
|
||||
|
||||
if (pExaScr->deferred_mixed_pixmap &&
|
||||
pExaScr->deferred_mixed_pixmap != pPixmap)
|
||||
exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
|
||||
pExaScr->deferred_mixed_pixmap = pPixmap;
|
||||
}
|
||||
}
|
||||
|
||||
/* With mixed pixmaps, if we fail to get direct access to the driver pixmap, we
|
||||
* use the DownloadFromScreen hook to retrieve contents to a copy in system
|
||||
* memory, perform software rendering on that and move back the results with the
|
||||
* UploadToScreen hook (see exaFinishAccess_mixed).
|
||||
* UploadToScreen hook (see exaDamageReport_mixed).
|
||||
*/
|
||||
void
|
||||
exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
|
||||
|
@ -172,8 +194,9 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
|
|||
Bool as_dst = pixmaps[0].as_dst;
|
||||
|
||||
/* Set up damage tracking */
|
||||
pExaPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
|
||||
TRUE, pPixmap->drawable.pScreen,
|
||||
pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
|
||||
DamageReportNonEmpty, TRUE,
|
||||
pPixmap->drawable.pScreen,
|
||||
pPixmap);
|
||||
|
||||
DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
|
||||
|
@ -224,29 +247,3 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
|
|||
}
|
||||
}
|
||||
|
||||
/* Move back results of software rendering on system memory copy of mixed driver
|
||||
* pixmap (see exaPrepareAccessReg_mixed).
|
||||
*
|
||||
* Defer moving the destination back into the driver pixmap, to try and save
|
||||
* overhead on multiple consequent software fallbacks.
|
||||
*/
|
||||
void exaFinishAccess_mixed(PixmapPtr pPixmap, int index)
|
||||
{
|
||||
ExaPixmapPriv(pPixmap);
|
||||
|
||||
if (pExaPixmap->pDamage && !pExaPixmap->use_gpu_copy &&
|
||||
exaPixmapHasGpuCopy(pPixmap)) {
|
||||
DamageRegionProcessPending(&pPixmap->drawable);
|
||||
|
||||
if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) {
|
||||
ExaScreenPriv(pPixmap->drawable.pScreen);
|
||||
|
||||
if (pExaScr->deferred_mixed_pixmap &&
|
||||
pExaScr->deferred_mixed_pixmap != pPixmap)
|
||||
exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
|
||||
pExaScr->deferred_mixed_pixmap = pPixmap;
|
||||
pPixmap->devKind = pExaPixmap->fb_pitch;
|
||||
} else
|
||||
exaMoveInPixmap_mixed(pPixmap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
|
|||
pExaPixmap->sys_ptr = malloc((pPixmap->drawable.bitsPerPixel + 7) / 8);
|
||||
|
||||
/* Set up damage tracking */
|
||||
pExaPixmap->pDamage = DamageCreate(NULL, NULL,
|
||||
pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
|
||||
DamageReportNonEmpty, TRUE,
|
||||
pPixmap->drawable.pScreen,
|
||||
pPixmap);
|
||||
|
|
|
@ -177,7 +177,6 @@ typedef struct {
|
|||
void (*do_move_in_pixmap) (PixmapPtr pPixmap);
|
||||
void (*do_move_out_pixmap) (PixmapPtr pPixmap);
|
||||
void (*prepare_access_reg)(PixmapPtr pPixmap, int index, RegionPtr pReg);
|
||||
void (*finish_access)(PixmapPtr pPixmap, int index);
|
||||
|
||||
Bool swappedOut;
|
||||
enum ExaMigrationHeuristic migration;
|
||||
|
@ -620,10 +619,10 @@ void
|
|||
exaMoveInPixmap_mixed(PixmapPtr pPixmap);
|
||||
|
||||
void
|
||||
exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg);
|
||||
exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure);
|
||||
|
||||
void
|
||||
exaFinishAccess_mixed(PixmapPtr pPixmap, int index);
|
||||
exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg);
|
||||
|
||||
/* exa_render.c */
|
||||
Bool
|
||||
|
|
Loading…
Reference in New Issue
Block a user