summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunyan He <junyan.he@linux.intel.com>2012-06-05 03:21:03 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2012-06-12 17:38:37 +0800
commit566ba215aac7c191d85410b8794d28b561e0aff5 (patch)
tree70f10ea849b0972e2931b8310822b3b63943a931
parent0bc9a5de83063976902866e4175effedd3ae5a1f (diff)
Use the direct render path for A1
Because when mask depth is 1, there is no Anti-Alias at all, in this case, the directly render can work well and it is faseter. Signed-off-by: Junyan He <junyan.he@linux.intel.com>
-rw-r--r--src/glamor_priv.h2
-rw-r--r--src/glamor_trapezoid.c33
2 files changed, 27 insertions, 8 deletions
diff --git a/src/glamor_priv.h b/src/glamor_priv.h
index 1b45a71..055077c 100644
--- a/src/glamor_priv.h
+++ b/src/glamor_priv.h
@@ -965,7 +965,7 @@ glamor_poly_line(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
#define GLAMOR_PIXMAP_DYNAMIC_UPLOAD
#ifndef GLAMOR_GLES2
#define GLAMOR_GRADIENT_SHADER
-#define GLAMOR_TRAPEZOID_SHADER
+//#define GLAMOR_TRAPEZOID_SHADER
#endif
#define GLAMOR_TEXTURED_LARGE_PIXMAP 1
#if 0
diff --git a/src/glamor_trapezoid.c b/src/glamor_trapezoid.c
index 030e490..2d26d79 100644
--- a/src/glamor_trapezoid.c
+++ b/src/glamor_trapezoid.c
@@ -1409,15 +1409,34 @@ _glamor_trapezoids(CARD8 op,
stride = PixmapBytePad(width, mask_format->depth);
#ifdef GLAMOR_TRAPEZOID_SHADER
- picture = glamor_create_mask_picture(screen, dst, mask_format,
- width, height, 1);
- if (!picture)
- return TRUE;
+ /* We seperate the render to two paths.
+ Some GL implemetation do not implement the Anti-Alias for triangles
+ and polygen's filling. So when the edge is not vertical or horizontal,
+ sawtooth will be obvious. The trapezoid is widely used to render wide
+ lines and circles. In these case, the line or circle will be divided
+ into a large number of small trapezoids to approximate it, so the sawtooth
+ at the edge will cause the result not be acceptable.
+ When the depth of the mask is 1, there is no Anti-Alias needed, so we
+ use the clip logic to generate the result directly(fast path).
+ When the depth is not 1, AA is needed and we use a shader to generate
+ a temp mask pixmap.
+ */
+ if(mask_format->depth == 1) {
+ ret = _glamor_trapezoids_with_shader(op, src, dst, mask_format,
+ x_src, y_src, ntrap, traps);
+ if(ret)
+ return TRUE;
+ } else {
+ picture = glamor_create_mask_picture(screen, dst, mask_format,
+ width, height, 1);
+ if (!picture)
+ return TRUE;
- ret = _glamor_generate_trapezoid_with_shader(screen, picture, traps, ntrap, &bounds);
+ ret = _glamor_generate_trapezoid_with_shader(screen, picture, traps, ntrap, &bounds);
- if (!ret)
- FreePicture(picture, 0);
+ if (!ret)
+ FreePicture(picture, 0);
+ }
#endif
if (!ret) {