Add new version glamor_poly_fill_rect without internal fallback.

If need fallback, this new version just returns FALSE without
doing anything. It's the caller's responsibility to implement
fallback method.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2011-11-11 10:26:00 +08:00 committed by Eric Anholt
parent ba1b3b5324
commit 9b6a484df0
3 changed files with 27 additions and 7 deletions

View File

@ -85,4 +85,8 @@ extern _X_EXPORT Bool glamor_fill_spans_nf(DrawablePtr drawable,
int n, DDXPointPtr points,
int *widths, int sorted);
extern _X_EXPORT Bool glamor_poly_fill_rect_nf(DrawablePtr drawable,
GCPtr gc,
int nrect,
xRectangle * prect);

View File

@ -144,7 +144,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
GLfloat color[4];
float vertices[8];
GLfloat xscale, yscale;
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
if (!pixmap_priv || !GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
glamor_fallback("dest %p has no fbo.\n", pixmap);
goto fail;
}

View File

@ -37,9 +37,9 @@
* GC PolyFillRect implementation, taken straight from fb_fill.c
*/
void
glamor_poly_fill_rect(DrawablePtr drawable,
GCPtr gc, int nrect, xRectangle * prect)
static Bool
_glamor_poly_fill_rect(DrawablePtr drawable,
GCPtr gc, int nrect, xRectangle * prect, Bool fallback)
{
int fullX1, fullX2, fullY1, fullY2;
int xorg, yorg;
@ -87,13 +87,14 @@ glamor_poly_fill_rect(DrawablePtr drawable,
if (x1 >= x2 || y1 >= y2)
continue;
if (!glamor_fill(drawable, gc, x1, y1, x2 - x1,
y2 - y1, TRUE))
y2 - y1, fallback))
goto fail;
}
}
return;
return TRUE;
fail:
if (!fallback) return FALSE;
glamor_fallback(" to %p (%c)\n",
drawable, glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
@ -103,5 +104,20 @@ glamor_poly_fill_rect(DrawablePtr drawable,
}
glamor_finish_access(drawable);
}
return;
return TRUE;
}
void
glamor_poly_fill_rect(DrawablePtr drawable,
GCPtr gc, int nrect, xRectangle * prect)
{
_glamor_poly_fill_rect(drawable, gc, nrect, prect, TRUE);
}
Bool
glamor_poly_fill_rect_nf(DrawablePtr drawable,
GCPtr gc, int nrect, xRectangle * prect)
{
return _glamor_poly_fill_rect(drawable, gc, nrect, prect, FALSE);
}