st/xorg: split up shared Done call

The two users of composite (Composite and Solid) now call a new
xorg_composite_done() from their Done functions, while CopyDone
is directly implemented on top of xorg_renderer.c.
This commit is contained in:
Keith Whitwell 2009-11-26 10:34:28 +00:00
parent b4ea1eb871
commit fa799f81de
3 changed files with 99 additions and 53 deletions

View file

@ -582,3 +582,13 @@ void xorg_solid(struct exa_context *exa,
x0, y0, x1, y1, exa->solid_color); x0, y0, x1, y1, exa->solid_color);
} }
void
xorg_composite_done(struct exa_context *exa)
{
renderer_draw_flush(exa->renderer);
exa->transform.has_src = FALSE;
exa->transform.has_mask = FALSE;
exa->has_solid_color = FALSE;
exa->num_bound_samplers = 0;
}

View file

@ -29,4 +29,8 @@ void xorg_solid(struct exa_context *exa,
struct exa_pixmap_priv *pixmap, struct exa_pixmap_priv *pixmap,
int x0, int y0, int x1, int y1); int x0, int y0, int x1, int y1);
void
xorg_composite_done(struct exa_context *exa);
#endif #endif

View file

@ -149,20 +149,6 @@ exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp, int *picture_
} }
} }
static void
xorg_exa_common_done(struct exa_context *exa)
{
renderer_draw_flush(exa->renderer);
exa->copy.src = NULL;
exa->copy.dst = NULL;
pipe_surface_reference(&exa->copy.src_surface, NULL);
pipe_surface_reference(&exa->copy.dst_surface, NULL);
exa->transform.has_src = FALSE;
exa->transform.has_mask = FALSE;
exa->has_solid_color = FALSE;
exa->num_bound_samplers = 0;
}
/* /*
* Static exported EXA functions * Static exported EXA functions
@ -180,6 +166,11 @@ ExaMarkSync(ScreenPtr pScreen)
return 1; return 1;
} }
/***********************************************************************
* Screen upload/download
*/
static Bool static Bool
ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst, ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst,
int dst_pitch) int dst_pitch)
@ -329,29 +320,9 @@ ExaFinishAccess(PixmapPtr pPix, int index)
} }
} }
static void /***********************************************************************
ExaDone(PixmapPtr pPixmap) * Solid Fills
{ */
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
struct exa_context *exa = ms->exa;
if (!priv)
return;
xorg_exa_common_done(exa);
}
static void
ExaDoneComposite(PixmapPtr pPixmap)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa = ms->exa;
xorg_exa_common_done(exa);
}
static Bool static Bool
ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
@ -400,6 +371,25 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1)
xorg_solid(exa, priv, x0, y0, x1, y1) ; xorg_solid(exa, priv, x0, y0, x1, y1) ;
} }
static void
ExaDoneSolid(PixmapPtr pPixmap)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
struct exa_context *exa = ms->exa;
if (!priv)
return;
xorg_composite_done(exa);
}
/***********************************************************************
* Copy Blits
*/
static Bool static Bool
ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
int ydir, int alu, Pixel planeMask) int ydir, int alu, Pixel planeMask)
@ -492,6 +482,26 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
} }
} }
static void
ExaDoneCopy(PixmapPtr pPixmap)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
struct exa_context *exa = ms->exa;
if (!priv)
return;
renderer_draw_flush(exa->renderer);
exa->copy.src = NULL;
exa->copy.dst = NULL;
pipe_surface_reference(&exa->copy.src_surface, NULL);
pipe_surface_reference(&exa->copy.dst_surface, NULL);
}
static Bool static Bool
picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture) picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture)
@ -528,6 +538,30 @@ picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture)
return FALSE; return FALSE;
} }
/***********************************************************************
* Composite entrypoints
*/
static Bool
ExaCheckComposite(int op,
PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa = ms->exa;
boolean accelerated = xorg_composite_accelerated(op,
pSrcPicture,
pMaskPicture,
pDstPicture);
#if DEBUG_PRINT
debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n",
op, pSrcPicture, pMaskPicture, pDstPicture, accelerated);
#endif
return exa->accel && accelerated;
}
static Bool static Bool
ExaPrepareComposite(int op, PicturePtr pSrcPicture, ExaPrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture,
@ -624,25 +658,23 @@ ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
dstX, dstY, width, height); dstX, dstY, width, height);
} }
static Bool
ExaCheckComposite(int op,
PicturePtr pSrcPicture, PicturePtr pMaskPicture, static void
PicturePtr pDstPicture) ExaDoneComposite(PixmapPtr pPixmap)
{ {
ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum]; ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn); modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa = ms->exa; struct exa_context *exa = ms->exa;
boolean accelerated = xorg_composite_accelerated(op,
pSrcPicture, xorg_composite_done(exa);
pMaskPicture,
pDstPicture);
#if DEBUG_PRINT
debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n",
op, pSrcPicture, pMaskPicture, pDstPicture, accelerated);
#endif
return exa->accel && accelerated;
} }
/***********************************************************************
* Pixmaps
*/
static void * static void *
ExaCreatePixmap(ScreenPtr pScreen, int size, int align) ExaCreatePixmap(ScreenPtr pScreen, int size, int align)
{ {
@ -935,10 +967,10 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
pExa->MarkSync = ExaMarkSync; pExa->MarkSync = ExaMarkSync;
pExa->PrepareSolid = ExaPrepareSolid; pExa->PrepareSolid = ExaPrepareSolid;
pExa->Solid = ExaSolid; pExa->Solid = ExaSolid;
pExa->DoneSolid = ExaDone; pExa->DoneSolid = ExaDoneSolid;
pExa->PrepareCopy = ExaPrepareCopy; pExa->PrepareCopy = ExaPrepareCopy;
pExa->Copy = ExaCopy; pExa->Copy = ExaCopy;
pExa->DoneCopy = ExaDone; pExa->DoneCopy = ExaDoneCopy;
pExa->CheckComposite = ExaCheckComposite; pExa->CheckComposite = ExaCheckComposite;
pExa->PrepareComposite = ExaPrepareComposite; pExa->PrepareComposite = ExaPrepareComposite;
pExa->Composite = ExaComposite; pExa->Composite = ExaComposite;