get_spans: Check whether have a valid fbo before check format.

If a pixmap is a pure in-memory pixmap, we do not need to
check its format. Format checking has more overhead than
checking FBO, so we change to check fbo firtly.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2012-01-04 14:37:37 +08:00 committed by Eric Anholt
parent 057f52a04d
commit e1789893e5

View File

@ -37,6 +37,7 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
Bool fallback)
{
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *dest_pixmap_priv;
glamor_screen_private *glamor_priv =
glamor_get_screen_private(drawable->pScreen);
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
@ -47,6 +48,12 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
BoxRec *pbox;
int x_off, y_off;
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
glamor_fallback("pixmap has no fbo.\n");
goto fail;
}
if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) {
glamor_fallback("ES2 fallback.\n");
goto fail;
@ -61,9 +68,7 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
}
if (glamor_set_destination_pixmap(dest_pixmap))
goto fail;
glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
glamor_validate_pixmap(dest_pixmap);
if (!glamor_set_planemask(dest_pixmap, gc->planemask))
goto fail;