EXA/mixed: Clean up exaPrepareAccessReg_mixed() a little.
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
9623daad7c
commit
03ef00ae79
|
@ -165,10 +165,12 @@ void
|
||||||
exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
|
exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
|
||||||
{
|
{
|
||||||
ExaPixmapPriv(pPixmap);
|
ExaPixmapPriv(pPixmap);
|
||||||
|
Bool has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
|
||||||
Bool success;
|
Bool success;
|
||||||
|
|
||||||
if ((success = ExaDoPrepareAccess(pPixmap, index)) &&
|
success = ExaDoPrepareAccess(pPixmap, index);
|
||||||
pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
|
|
||||||
|
if (success && has_gpu_copy && pExaPixmap->pDamage) {
|
||||||
/* You cannot do accelerated operations while a buffer is mapped. */
|
/* You cannot do accelerated operations while a buffer is mapped. */
|
||||||
exaFinishAccess(&pPixmap->drawable, index);
|
exaFinishAccess(&pPixmap->drawable, index);
|
||||||
/* Update the gpu view of both deferred destination pixmaps and of
|
/* Update the gpu view of both deferred destination pixmaps and of
|
||||||
|
@ -176,10 +178,24 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
|
||||||
*/
|
*/
|
||||||
exaMoveInPixmap_mixed(pPixmap);
|
exaMoveInPixmap_mixed(pPixmap);
|
||||||
success = ExaDoPrepareAccess(pPixmap, index);
|
success = ExaDoPrepareAccess(pPixmap, index);
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
/* We have a gpu pixmap that can be accessed, we don't need the cpu
|
||||||
|
* copy anymore. Drivers that prefer DFS, should fail prepare
|
||||||
|
* access.
|
||||||
|
*/
|
||||||
|
DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
|
||||||
|
DamageDestroy(pExaPixmap->pDamage);
|
||||||
|
pExaPixmap->pDamage = NULL;
|
||||||
|
|
||||||
|
free(pExaPixmap->sys_ptr);
|
||||||
|
pExaPixmap->sys_ptr = NULL;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
Bool has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
|
|
||||||
ExaMigrationRec pixmaps[1];
|
ExaMigrationRec pixmaps[1];
|
||||||
|
|
||||||
/* Do we need to allocate our system buffer? */
|
/* Do we need to allocate our system buffer? */
|
||||||
|
@ -240,15 +256,6 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
|
||||||
pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
|
pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
|
||||||
pPixmap->devKind = pExaPixmap->sys_pitch;
|
pPixmap->devKind = pExaPixmap->sys_pitch;
|
||||||
pExaPixmap->use_gpu_copy = FALSE;
|
pExaPixmap->use_gpu_copy = FALSE;
|
||||||
/* We have a gpu pixmap that can be accessed, we don't need the cpu copy
|
|
||||||
* anymore. Drivers that prefer DFS, should fail prepare access. */
|
|
||||||
} else if (pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
|
|
||||||
DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
|
|
||||||
DamageDestroy(pExaPixmap->pDamage);
|
|
||||||
pExaPixmap->pDamage = NULL;
|
|
||||||
|
|
||||||
free(pExaPixmap->sys_ptr);
|
|
||||||
pExaPixmap->sys_ptr = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue