summaryrefslogtreecommitdiff
path: root/glamor
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2017-07-10 12:08:29 -0700
committerEric Anholt <eric@anholt.net>2017-08-14 12:37:37 -0700
commit27500ee82e97ef8a6b3199c2d7b623523c1ee2c1 (patch)
tree50ae79a6a967fd26f0135cce5e9e706fff83da80 /glamor
parente6ab3b1109e72a1512c6b7b92dd84525ad8c8052 (diff)
glamor: Scissor Render composite operations to the bounds of the drawing.
Unlike the previous two fixes, this one introduces new GL calls and statechanges of the scissor. However, given that our Render drawing already does CPU side transformation and inefficient box upload, this shouldn't be a limiting factor for Render acceleration. Surprisingly, it improves x11perf -comppixwin10 -repeat 1 -reps 10000 on i965 by 3.21191% +/- 1.79977% (n=50). v2: Make the jump to the exit land after scissor disable. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'glamor')
-rw-r--r--glamor/glamor_render.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 52f073d05..3f982a2d2 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -1198,6 +1198,29 @@ glamor_composite_with_shader(CARD8 op,
nrect_max = MIN(nrect, GLAMOR_COMPOSITE_VBO_VERT_CNT / 4);
+ if (nrect < 100) {
+ BoxRec bounds = glamor_start_rendering_bounds();
+
+ for (int i = 0; i < nrect; i++) {
+ BoxRec box = {
+ .x1 = rects[i].x_dst,
+ .y1 = rects[i].y_dst,
+ .x2 = rects[i].x_dst + rects[i].width,
+ .y2 = rects[i].y_dst + rects[i].height,
+ };
+ glamor_bounds_union_box(&bounds, &box);
+ }
+
+ if (bounds.x1 >= bounds.x2 || bounds.y1 >= bounds.y2)
+ goto disable_va;
+
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(bounds.x1 + dest_x_off,
+ bounds.y1 + dest_y_off,
+ bounds.x2 - bounds.x1,
+ bounds.y2 - bounds.y1);
+ }
+
while (nrect) {
int mrect, rect_processed;
int vb_stride;
@@ -1279,6 +1302,8 @@ glamor_composite_with_shader(CARD8 op,
}
}
+ glDisable(GL_SCISSOR_TEST);
+disable_va:
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);