diff options
author | Zhigang Gong <zhigang.gong@linux.intel.com> | 2012-04-09 20:20:45 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@linux.intel.com> | 2012-04-12 15:53:06 +0800 |
commit | 1dbda06d004981593c863b9b2b6907ac676ddf03 (patch) | |
tree | 13400b22657d6c3d8c7cdcd7ae51a625a88def9e | |
parent | ee34aeb5150e73cf360bc2d142e94b9a8ecd6102 (diff) |
glamor_polyfillrect: Optimize fallback path.
Download/upload required region only.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r-- | src/glamor_fill.c | 40 | ||||
-rw-r--r-- | src/glamor_polyfillrect.c | 4 |
2 files changed, 40 insertions, 4 deletions
diff --git a/src/glamor_fill.c b/src/glamor_fill.c index 4cee485..3c171d4 100644 --- a/src/glamor_fill.c +++ b/src/glamor_fill.c @@ -33,6 +33,10 @@ glamor_fill(DrawablePtr drawable, { PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(drawable); int off_x, off_y; + PixmapPtr sub_pixmap = NULL; + glamor_access_t sub_pixmap_access; + DrawablePtr saved_drawable = NULL; + int saved_x, saved_y; glamor_get_drawable_deltas(drawable, dst_pixmap, &off_x, &off_y); @@ -82,7 +86,26 @@ glamor_fill(DrawablePtr drawable, && glamor_ddx_fallback_check_gc(gc)) return FALSE; } + /* Is it possible to set the access as WO? */ + sub_pixmap_access = GLAMOR_ACCESS_RW; + + sub_pixmap = glamor_get_sub_pixmap(dst_pixmap, x + off_x, + y + off_y, width, height, + sub_pixmap_access); + + if (sub_pixmap != NULL) { + if (gc->fillStyle != FillSolid) { + gc->patOrg.x += (drawable->x - x); + gc->patOrg.y += (drawable->y - y); + } + saved_drawable = drawable; + drawable = &sub_pixmap->drawable; + saved_x = x; + saved_y = y; + x = 0; + y = 0; + } if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) { if (glamor_prepare_access_gc(gc)) { fbFill(drawable, gc, x, y, width, height); @@ -90,6 +113,23 @@ glamor_fill(DrawablePtr drawable, } glamor_finish_access(drawable, GLAMOR_ACCESS_RW); } + + if (sub_pixmap != NULL) { + struct pixman_box16 box; + int dx, dy; + if (gc->fillStyle != FillSolid) { + gc->patOrg.x -= (saved_drawable->x - saved_x); + gc->patOrg.y -= (saved_drawable->y - saved_y); + } + + x = saved_x; + y = saved_y; + + glamor_put_sub_pixmap(sub_pixmap, dst_pixmap, + x + off_x, y + off_y, + width, height, sub_pixmap_access); + } + return TRUE; } diff --git a/src/glamor_polyfillrect.c b/src/glamor_polyfillrect.c index 61e707f..18f4fed 100644 --- a/src/glamor_polyfillrect.c +++ b/src/glamor_polyfillrect.c @@ -47,10 +47,6 @@ _glamor_poly_fill_rect(DrawablePtr drawable, glamor_priv = glamor_get_screen_private(drawable->pScreen); - if (gc->fillStyle != FillSolid && gc->fillStyle != FillTiled) { - goto fail; - } - xorg = drawable->x; yorg = drawable->y; |