[Glamor] [PATCH] Fallback to pixman when trapezoid mask is big.
junyan.he at linux.intel.com
junyan.he at linux.intel.com
Sun Aug 5 15:22:24 PDT 2012
From: Junyan He <junyan.he at linux.intel.com>
The trapezoid generating speed of the shader is relatively
slower when the trapezoid area is big. We fallback when
the trapezoid's width and height is bigger than 300 pixels.
Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
src/glamor_priv.h | 2 +-
src/glamor_trapezoid.c | 14 +++++++++-----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/glamor_priv.h b/src/glamor_priv.h
index 11d09c4..1830b56 100644
--- a/src/glamor_priv.h
+++ b/src/glamor_priv.h
@@ -1016,7 +1016,7 @@ glamor_composite_rectangles(CARD8 op,
#define GLAMOR_PIXMAP_DYNAMIC_UPLOAD
#define GLAMOR_GRADIENT_SHADER
-//#define GLAMOR_TRAPEZOID_SHADER
+#define GLAMOR_TRAPEZOID_SHADER
#define GLAMOR_TEXTURED_LARGE_PIXMAP 1
#define WALKAROUND_LARGE_TEXTURE_MAP
#if 0
diff --git a/src/glamor_trapezoid.c b/src/glamor_trapezoid.c
index 7813d82..3b49fe6 100644
--- a/src/glamor_trapezoid.c
+++ b/src/glamor_trapezoid.c
@@ -1666,16 +1666,20 @@ _glamor_trapezoids(CARD8 op,
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) {
+ 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 {
- /* The precise mode is that we sample the trapezoid on the centre points of
- an (2*n+1)x(2*n-1) subpixel grid. It is computationally expensive in shader
- and we use inside area ratio to replace it if the polymode == Imprecise. */
- if(dst->polyMode == PolyModeImprecise) {
+ if (ntrap == 1 && width > 300 && height > 300) {
+ /* The shader speed is relative slower than pixman when generating big chunk
+ trapezoid mask. We fallback to pixman to improve the performance. */
+ ;
+ } else if (dst->polyMode == PolyModeImprecise) {
+ /* The precise mode is that we sample the trapezoid on the centre points of
+ an (2*n+1)x(2*n-1) subpixel grid. It is computationally expensive in shader
+ and we use inside area ratio to replace it if the polymode == Imprecise. */
picture = glamor_create_mask_picture(screen, dst, mask_format,
width, height, 1);
if (!picture)
--
1.7.11.2
More information about the Glamor
mailing list