Add new version glamor_fillspans without internal fallback.

For the purpose of incrementally intergration of existing intel
driver, for the GC operations we may don't want to use glamor's
internal fallback which is in general much slower than the
implementation in intel driver. If the parameter "fallback" is
false when call the glamor_fillspans, then if glamor found it
can't accelerate it then it will just return a FALSE rather than
fallback to a slow path.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2011-11-09 16:09:03 +08:00 committed by Eric Anholt
parent b861aad8e2
commit ba1b3b5324
6 changed files with 41 additions and 10 deletions

View File

@ -79,3 +79,10 @@ extern _X_EXPORT void glamor_egl_free_screen(int scrnIndex, int flags);
extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen);
extern _X_EXPORT void glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap);
#endif
extern _X_EXPORT Bool glamor_fill_spans_nf(DrawablePtr drawable,
GCPtr gc,
int n, DDXPointPtr points,
int *widths, int sorted);

View File

@ -34,7 +34,7 @@
Bool
glamor_fill(DrawablePtr drawable,
GCPtr gc, int x, int y, int width, int height)
GCPtr gc, int x, int y, int width, int height, Bool fallback)
{
PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(drawable);
int off_x, off_y;
@ -80,7 +80,9 @@ glamor_fill(DrawablePtr drawable,
break;
}
return TRUE;
fail:
if (!fallback) return FALSE;
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access_gc(gc)) {
fbFill(drawable, gc, x, y, width, height);
@ -89,7 +91,6 @@ glamor_fill(DrawablePtr drawable,
glamor_finish_access(drawable);
}
return TRUE;
}
void

View File

@ -30,10 +30,10 @@
*/
#include "glamor_priv.h"
void
glamor_fill_spans(DrawablePtr drawable,
static Bool
_glamor_fill_spans(DrawablePtr drawable,
GCPtr gc,
int n, DDXPointPtr points, int *widths, int sorted)
int n, DDXPointPtr points, int *widths, int sorted, Bool fallback)
{
DDXPointPtr ppt;
int nbox;
@ -66,12 +66,15 @@ glamor_fill_spans(DrawablePtr drawable,
if (x2 <= x1)
continue;
glamor_fill(drawable, gc, x1, y, x2 - x1, 1);
if (!glamor_fill(drawable, gc, x1, y, x2 - x1, 1, fallback))
goto fail;
pbox++;
}
}
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)) {
@ -82,4 +85,24 @@ glamor_fill_spans(DrawablePtr drawable,
}
glamor_finish_access(drawable);
}
return TRUE;
}
void
glamor_fill_spans(DrawablePtr drawable,
GCPtr gc,
int n, DDXPointPtr points, int *widths, int sorted)
{
_glamor_fill_spans(drawable, gc, n, points, widths, sorted, TRUE);
}
Bool
glamor_fill_spans_nf(DrawablePtr drawable,
GCPtr gc,
int n, DDXPointPtr points, int *widths, int sorted)
{
return _glamor_fill_spans(drawable, gc, n, points, widths, sorted, FALSE);
}

View File

@ -690,7 +690,7 @@ glamor_glyphs_via_mask(CARD8 op,
}
gc = GetScratchGC(mask_pixmap->drawable.depth, screen);
ValidateGC(&mask_pixmap->drawable, gc);
glamor_fill(&mask_pixmap->drawable, gc, 0, 0, width, height);
glamor_fill(&mask_pixmap->drawable, gc, 0, 0, width, height, TRUE);
FreeScratchGC(gc);
x = -extents.x1;
y = -extents.y1;

View File

@ -87,7 +87,7 @@ glamor_poly_fill_rect(DrawablePtr drawable,
if (x1 >= x2 || y1 >= y2)
continue;
if (!glamor_fill(drawable, gc, x1, y1, x2 - x1,
y2 - y1))
y2 - y1, TRUE))
goto fail;
}
}

View File

@ -370,7 +370,7 @@ int glamor_gl_get_version(void);
/* glamor_fill.c */
Bool glamor_fill(DrawablePtr drawable,
GCPtr gc, int x, int y, int width, int height);
GCPtr gc, int x, int y, int width, int height, Bool fallback);
Bool glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask,
unsigned long fg_pixel);