Skip to content

Commit

Permalink
Try to be smarter when waiting for blits to complete
Browse files Browse the repository at this point in the history
Implement pixmap ownership tracking

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
  • Loading branch information
freemangordon committed Dec 11, 2023
1 parent ace9cda commit ab20bdd
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
52 changes: 38 additions & 14 deletions src/omap_exa_pvr.c
Expand Up @@ -150,24 +150,44 @@ waitForBlitsCompleteOnDeviceMem(PixmapPtr pPixmap)
}
}

void
static void
sgxWaitPixmap(PixmapPtr pPixmap)
{
OMAPPixmapPrivPtr pixmapPriv;
PrivPixmapPtr priv;

if (!pPixmap)
return;

pixmapPriv = exaGetPixmapDriverPrivate(pPixmap);
priv = pixmapPriv->priv;

if (priv && priv->is_gpu) {
priv->is_gpu = FALSE;
waitForBlitsCompleteOnDeviceMem(pPixmap);
}
}

void
flushScanout(PixmapPtr pPixmap)
{
ScrnInfoPtr pScrn = pix2scrn(pPixmap);
OMAPPtr pOMAP = OMAPPTR(pScrn);
OMAPPixmapPrivPtr pixmapPriv = exaGetPixmapDriverPrivate(pPixmap);
OMAPPtr pOMAP = OMAPPTR(pScrn);

/* Do not wait for blits to complete on scanout buffer as omapdrm will
* wait on pvr fence anyways.
*
* BUG: It should not matter manual update or not, but for some reason
* it does. For now just wait for blits to complete on manual update
* devices until we find what's going wrong.
*/
if (pixmapPriv->bo != pOMAP->scanout || pOMAP->ManualUpdate)
waitForBlitsCompleteOnDeviceMem(pPixmap);
if (pOMAP->ManualUpdate && pixmapPriv->bo == pOMAP->scanout) {
sgxWaitPixmap(pPixmap);
drmmode_flush_scanout(pScrn);
}
}

drmmode_flush_scanout(pScrn);
void
setPixmapOnGPU(PixmapPtr pPixmap)
{
OMAPPixmapPrivPtr pixmapPriv = exaGetPixmapDriverPrivate(pPixmap);
PrivPixmapPtr priv = pixmapPriv->priv;

priv->is_gpu = TRUE;
}

static void
Expand Down Expand Up @@ -930,7 +950,9 @@ sgxDoneSolid(PixmapPtr pPixmap)
PVR_ASSERT(gsSolidOp.pPixmap == pPixmap);

sgxSolidNextBatch(pScrn, pPVR, TRUE);
sgxWaitPixmap(pPixmap);

setPixmapOnGPU(pPixmap);
flushScanout(pPixmap);

gsSolidOp.softFallback.psGC = NULL;
gsSolidOp.pPixmap = NULL;
Expand Down Expand Up @@ -1195,7 +1217,9 @@ sgxDoneCopy(PixmapPtr pPixmap)
PVR_ASSERT(gsCopy2DOp.renderOp.pDest == pPixmap);

sgxCopyNextBatch(pPixmap->drawable.pScreen, TRUE);
sgxWaitPixmap(pPixmap);

setPixmapOnGPU(pPixmap);
flushScanout(pPixmap);

gsCopy2DOp.renderOp.pSrc = NULL;
gsCopy2DOp.renderOp.pDest = NULL;
Expand Down
5 changes: 4 additions & 1 deletion src/omap_exa_pvr.h
Expand Up @@ -58,6 +58,7 @@ typedef struct PrivPixmap
{
PVR2DMEMINFO meminfo;
struct xorg_list map;
Bool is_gpu;
} PrivPixmapRec, *PrivPixmapPtr;

typedef struct BoCacheEntry
Expand Down Expand Up @@ -193,6 +194,8 @@ PVREXAPTR(ScrnInfoPtr pScrn)

void sgxUnmapPixmapBo(ScreenPtr pScreen, OMAPPixmapPrivPtr pixmapPriv);
PrivPixmapPtr sgxMapPixmapBo(ScreenPtr pScreen, OMAPPixmapPrivPtr pixmapPriv);
void sgxWaitPixmap(PixmapPtr pPixmap);

void setPixmapOnGPU(PixmapPtr pPixmap);
void flushScanout(PixmapPtr pPixmap);

#endif /* __OMAP_EXA_PVR_H__ */
3 changes: 2 additions & 1 deletion src/omap_pvr_sgx.c
Expand Up @@ -216,7 +216,8 @@ PUT_TEXTURE_IMAGE_FN_DEF(343x)
err = SGXQueueTransfer(pContext->hTransferContext, &sBlitInfo);

if (err == PVRSRV_OK) {
sgxWaitPixmap(pDstPix);
setPixmapOnGPU(pDstPix);
flushScanout(pDstPix);
return TRUE;
}

Expand Down

0 comments on commit ab20bdd

Please sign in to comment.