mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
render: export TriStrip and TriFan to the drivers
Rather than perform an intermediate copy and expand the strip and the fan into a triangle list (thereby tripling the number of edges that the driver needs to process), allow the backend to hook directly into the appropriate Composite function. In order to extend the PictureScreen, without needlessly bumping the ABI, we move the existing copy implementations to mipict.c and assign those by default. To notify the ddx that the new entry points are available, we introduce PICTURE_SCREEN_VERSION. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
This commit is contained in:
committed by
Aaron Plattner
parent
9b26e6bc8d
commit
525d4172b2
@@ -569,6 +569,64 @@ miRenderPixelToColor (PictFormatPtr format,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
miTriStrip (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pDst,
|
||||
PictFormatPtr maskFormat,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
int npoints,
|
||||
xPointFixed *points)
|
||||
{
|
||||
xTriangle *tris, *tri;
|
||||
int ntri;
|
||||
|
||||
ntri = npoints - 2;
|
||||
tris = malloc(ntri * sizeof (xTriangle));
|
||||
if (!tris)
|
||||
return;
|
||||
|
||||
for (tri = tris; npoints >= 3; npoints--, points++, tri++)
|
||||
{
|
||||
tri->p1 = points[0];
|
||||
tri->p2 = points[1];
|
||||
tri->p3 = points[2];
|
||||
}
|
||||
CompositeTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
|
||||
free(tris);
|
||||
}
|
||||
|
||||
void
|
||||
miTriFan (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pDst,
|
||||
PictFormatPtr maskFormat,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
int npoints,
|
||||
xPointFixed *points)
|
||||
{
|
||||
xTriangle *tris, *tri;
|
||||
xPointFixed *first;
|
||||
int ntri;
|
||||
|
||||
ntri = npoints - 2;
|
||||
tris = malloc(ntri * sizeof (xTriangle));
|
||||
if (!tris)
|
||||
return;
|
||||
|
||||
first = points++;
|
||||
for (tri = tris; npoints >= 3; npoints--, points++, tri++)
|
||||
{
|
||||
tri->p1 = *first;
|
||||
tri->p2 = points[0];
|
||||
tri->p3 = points[1];
|
||||
}
|
||||
CompositeTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
|
||||
free(tris);
|
||||
}
|
||||
|
||||
Bool
|
||||
miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||
{
|
||||
@@ -602,5 +660,8 @@ miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||
ps->AddTraps = 0; /* requires DDX support */
|
||||
ps->AddTriangles = 0; /* requires DDX support */
|
||||
|
||||
ps->TriStrip = miTriStrip; /* converts call to CompositeTriangles */
|
||||
ps->TriFan = miTriFan;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user