[PATCH 3/3] glamor: Don't optimize out scissor updates in CopyArea.

Eric Anholt eric at anholt.net
Tue Dec 30 14:54:29 PST 2014


This possibly is a minor hit for immediate mode renderers (no
difference on copypixin100 on my hsw, n=12), but it gives important
information about drawing bounds to a deferred renderer (3.1x
improvement in copypixwin100 on vc4).

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 glamor/glamor_copy.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index 2522adf..50d4580 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -315,7 +315,6 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
     struct copy_args args;
     glamor_program *prog;
     const glamor_facet *copy_facet;
-    Bool set_scissor;
     int n;
 
     glamor_make_current(glamor_priv);
@@ -367,9 +366,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
 
     glamor_get_drawable_deltas(src, src_pixmap, &src_off_x, &src_off_y);
 
-    set_scissor = src_priv->type == GLAMOR_TEXTURE_LARGE;
-    if (set_scissor)
-        glEnable(GL_SCISSOR_TEST);
+    glEnable(GL_SCISSOR_TEST);
 
     glamor_pixmap_loop(src_priv, src_box_x, src_box_y) {
         BoxPtr src_box = glamor_pixmap_box_at(src_priv, src_box_x, src_box_y);
@@ -385,11 +382,10 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
             glamor_set_destination_drawable(dst, dst_box_x, dst_box_y, FALSE, FALSE,
                                             prog->matrix_uniform, &dst_off_x, &dst_off_y);
 
-            if (set_scissor)
-                glScissor(dst_off_x - args.dx,
-                          dst_off_y - args.dy,
-                          src_box->x2 - src_box->x1,
-                          src_box->y2 - src_box->y1);
+            glScissor(dst_off_x - args.dx,
+                      dst_off_y - args.dy,
+                      src_box->x2 - src_box->x1,
+                      src_box->y2 - src_box->y1);
 
             if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
                 glDrawArrays(GL_QUADS, 0, nbox * 4);
@@ -400,8 +396,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
             }
         }
     }
-    if (set_scissor)
-        glDisable(GL_SCISSOR_TEST);
+    glDisable(GL_SCISSOR_TEST);
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
 
     return TRUE;
-- 
2.1.3



More information about the xorg-devel mailing list