glamor: For non-supported fill style fallback to fbFill.

The previous implementation will just skip the rendering
which is not good.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2011-06-10 16:01:40 +08:00
parent b60e6cb66d
commit d7f8b888d0
4 changed files with 37 additions and 33 deletions

View File

@ -621,15 +621,17 @@ glamor_finish_access_gc(GCPtr gc)
glamor_finish_access(&gc->stipple->drawable); glamor_finish_access(&gc->stipple->drawable);
} }
void Bool
glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple, glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,
int x, int y, int width, int height, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned char alu, unsigned long planemask,
unsigned long fg_pixel, unsigned long bg_pixel, unsigned long fg_pixel, unsigned long bg_pixel,
int stipple_x, int stipple_y) int stipple_x, int stipple_y)
{ {
ErrorF("stubbed out stipple depth %d\n", pixmap->drawable.depth); glamor_fallback("stubbed out stipple depth %d\n", pixmap->drawable.depth);
glamor_solid_fail_region(pixmap, x, y, width, height); return FALSE;
// ErrorF("stubbed out stipple depth %d\n", pixmap->drawable.depth);
// glamor_solid_fail_region(pixmap, x, y, width, height);
} }
GCOps glamor_gc_ops = { GCOps glamor_gc_ops = {

View File

@ -42,23 +42,23 @@ glamor_fill(DrawablePtr drawable,
{ {
PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(drawable); PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(drawable);
int x_off, y_off; int x_off, y_off;
glamor_get_drawable_deltas(drawable, dst_pixmap, &x_off, &y_off); glamor_get_drawable_deltas(drawable, dst_pixmap, &x_off, &y_off);
switch (gc->fillStyle) { switch (gc->fillStyle) {
case FillSolid: case FillSolid:
glamor_solid(dst_pixmap, if (!glamor_solid(dst_pixmap,
x + x_off, x + x_off,
y + y_off, y + y_off,
width, width,
height, height,
gc->alu, gc->alu,
gc->planemask, gc->planemask,
gc->fgPixel); gc->fgPixel))
goto fail;
break; break;
case FillStippled: case FillStippled:
case FillOpaqueStippled: case FillOpaqueStippled:
glamor_stipple(dst_pixmap, if (!glamor_stipple(dst_pixmap,
gc->stipple, gc->stipple,
x+ x_off, x+ x_off,
y + y_off, y + y_off,
@ -69,10 +69,12 @@ glamor_fill(DrawablePtr drawable,
gc->fgPixel, gc->fgPixel,
gc->bgPixel, gc->bgPixel,
gc->patOrg.x + x_off, gc->patOrg.x + x_off,
gc->patOrg.y + y_off); gc->patOrg.y + y_off))
goto fail;
return;
break; break;
case FillTiled: case FillTiled:
glamor_tile(dst_pixmap, if (!glamor_tile(dst_pixmap,
gc->tile.pixmap, gc->tile.pixmap,
x + x_off, x + x_off,
y + y_off, y + y_off,
@ -81,12 +83,12 @@ glamor_fill(DrawablePtr drawable,
gc->alu, gc->alu,
gc->planemask, gc->planemask,
drawable->x + x - gc->patOrg.x, drawable->x + x - gc->patOrg.x,
drawable->y + y - gc->patOrg.y); drawable->y + y - gc->patOrg.y))
goto fail;
break; break;
} }
return; return;
#if 0 fail:
fail:
glamor_fallback("glamor_fill()"); glamor_fallback("glamor_fill()");
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access_gc(gc)) { if (glamor_prepare_access_gc(gc)) {
@ -95,7 +97,6 @@ glamor_fill(DrawablePtr drawable,
} }
glamor_finish_access(drawable); glamor_finish_access(drawable);
} }
#endif
return; return;
} }
@ -140,7 +141,7 @@ glamor_init_solid_shader(ScreenPtr screen)
glGetUniformLocationARB(glamor_priv->solid_prog, "color"); glGetUniformLocationARB(glamor_priv->solid_prog, "color");
} }
void Bool
glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned long fg_pixel) unsigned char alu, unsigned long planemask, unsigned long fg_pixel)
{ {
@ -154,12 +155,12 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
float vertices[4][2]; float vertices[4][2];
if (!glamor_set_destination_pixmap(pixmap)) if (!glamor_set_destination_pixmap(pixmap))
return; goto fail;
glamor_set_alu(alu); glamor_set_alu(alu);
if (!glamor_set_planemask(pixmap, planemask)) { if (!glamor_set_planemask(pixmap, planemask)) {
ErrorF("Failedto set planemask in glamor_solid.\n"); ErrorF("Failedto set planemask in glamor_solid.\n");
goto fail; goto fail;
} }
glUseProgramObjectARB(glamor_priv->solid_prog); glUseProgramObjectARB(glamor_priv->solid_prog);
glamor_get_color_4f_from_pixel(pixmap, fg_pixel, color); glamor_get_color_4f_from_pixel(pixmap, fg_pixel, color);
@ -188,9 +189,11 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glUseProgramObjectARB(0); glUseProgramObjectARB(0);
return TRUE;
fail: fail:
glamor_set_alu(GXcopy); glamor_set_alu(GXcopy);
glamor_set_planemask(pixmap, ~0); glamor_set_planemask(pixmap, ~0);
return FALSE;
} }
/* Highlight places where we're doing it wrong. */ /* Highlight places where we're doing it wrong. */

View File

@ -350,7 +350,7 @@ const Bool glamor_get_drawable_location(const DrawablePtr drawable);
void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap, void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap,
int *x, int *y); int *x, int *y);
Bool glamor_create_gc(GCPtr gc); Bool glamor_create_gc(GCPtr gc);
void glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple, Bool glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,
int x, int y, int width, int height, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned char alu, unsigned long planemask,
unsigned long fg_pixel, unsigned long bg_pixel, unsigned long fg_pixel, unsigned long bg_pixel,
@ -376,7 +376,7 @@ void glamor_fill(DrawablePtr drawable,
int y, int y,
int width, int width,
int height); int height);
void glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, Bool glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned char alu, unsigned long planemask,
unsigned long fg_pixel); unsigned long fg_pixel);
void glamor_solid_fail_region(PixmapPtr pixmap, void glamor_solid_fail_region(PixmapPtr pixmap,
@ -456,7 +456,7 @@ void glamor_composite_rects(CARD8 op,
int nrect, glamor_composite_rect_t *rects); int nrect, glamor_composite_rect_t *rects);
/* glamor_tile.c */ /* glamor_tile.c */
void glamor_tile(PixmapPtr pixmap, PixmapPtr tile, Bool glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
int x, int y, int width, int height, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned char alu, unsigned long planemask,
int tile_x, int tile_y); int tile_x, int tile_y);

View File

@ -72,7 +72,7 @@ glamor_init_tile_shader(ScreenPtr screen)
glUseProgramObjectARB(0); glUseProgramObjectARB(0);
} }
void Bool
glamor_tile(PixmapPtr pixmap, PixmapPtr tile, glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
int x, int y, int width, int height, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned char alu, unsigned long planemask,
@ -93,7 +93,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
float source_texcoords[4][2]; float source_texcoords[4][2];
if (glamor_priv->tile_prog == 0) { if (glamor_priv->tile_prog == 0) {
ErrorF("Tiling unsupported\n"); glamor_fallback("Tiling unsupported\n");
goto fail; goto fail;
} }
@ -101,7 +101,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
goto fail; goto fail;
if (tile_priv->tex == 0) { if (tile_priv->tex == 0) {
ErrorF("Non-texture tile pixmap\n"); glamor_fallback("Non-texture tile pixmap\n");
goto fail; goto fail;
} }
@ -167,9 +167,8 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glamor_set_alu(GXcopy); glamor_set_alu(GXcopy);
glamor_set_planemask(pixmap, ~0); glamor_set_planemask(pixmap, ~0);
return; return TRUE;
fail: fail:
glamor_solid_fail_region(pixmap, x, y, width, height); return FALSE;
return;
} }