[PATCH xserver 3/3] glamor: Scissor Render composite operations to the bounds of the drawing.

Keith Packard keithp at keithp.com
Tue Aug 1 22:18:43 UTC 2017


Eric Anholt <eric at anholt.net> writes:

> 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).
>
> Signed-off-by: Eric Anholt <eric at anholt.net>
> ---
>  glamor/glamor_render.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
> index 52f073d0578b..413c4a7f8e8a 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;

You might as well branch after the glDisable(GL_SCISSOR_TEST) to make it
symmetrical here?

> +
> +        glEnable(GL_SCISSOR_TEST);
> +        glScissor(bounds.x1 + dest_x_off,
> +                  bounds.y1 + dest_y_off,
> +                  bounds.x2 - bounds.x1,
> +                  bounds.y2 - bounds.y1);
> +    }

I think that's right; have you tested in a composited window to make
sure the offset is correct?

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20170801/87ec9e6d/attachment.sig>


More information about the xorg-devel mailing list