glamor: Implement delayed solid filling.

When we need to solid fill an entire pixmap with a specific color,
we do not need to draw it immediately. We can defer it to the
following occasions:

1. The pixmap will be used as source, then we can just use a shader
   to instead of one copyarea.
2. The pixmap will be used as target, then we can do the filling
   just before drawing new pixel onto it. The filling and drawing
   will have the same target texture, we can save one time of
   fbo context switching.

Actually, for the 2nd case, we have opportunity to further optimize
it. We can just fill the untouched region.

By applying this patch, the cairo-trace for the firefox-planet-gnome's
rendering time decrease to 14seconds from 16 seconds.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2011-07-20 13:06:23 +08:00
commit 5c4d53c512
10 changed files with 247 additions and 78 deletions

View file

@ -98,6 +98,7 @@ glamor_set_screen_pixmap_texture(ScreenPtr screen, int w, int h, unsigned int te
glamor_set_pixmap_texture(pixmap, w, h, tex);
glamor_priv->screen_fbo = pixmap_priv->fb;
pixmap_priv->pending_op.type = GLAMOR_PENDING_NONE;
}
@ -119,7 +120,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
if (w > 32767 || h > 32767)
return NullPixmap;
if (!glamor_check_fbo_width_height(w,h)
if (!glamor_check_fbo_width_height(w,h)
|| !glamor_check_fbo_depth(depth)
|| usage == GLAMOR_CREATE_PIXMAP_CPU) {
/* MESA can only support upto MAX_WIDTH*MAX_HEIGHT fbo.
@ -201,6 +202,7 @@ glamor_create_screen_pixmap(ScreenPtr screen, int w, int h, int depth,
pixmap_priv->gl_fbo = 1;
pixmap_priv->gl_tex = 1;
pixmap_priv->container = pixmap;
pixmap_priv->pending_op.type = GLAMOR_PENDING_NONE;
screen->CreatePixmap = glamor_create_pixmap;
return pixmap;
@ -369,6 +371,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_init_putimage_shaders(screen);
glamor_init_finish_access_shaders(screen);
glamor_glyphs_init(screen);
glamor_pixmap_init(screen);
return TRUE;