[PATCH 23/27] glamor: Improve the performance of line fallbacks.

Markus Wick markus at selfnet.de
Wed Mar 12 14:01:30 PDT 2014


Is there a generic mi fallback for all poly_lines? If not, I'd suggest 
to move this logic into mi itself.

Am 2014-03-11 22:30, schrieb Eric Anholt:
> If the lines aren't solid-filled vert/horiz solid-filled rectangles,
> we fall back.  libreoffice has some diagonal lines, and the
> performance of the fallback path was atrocious.  Just fall back to
> mi's spans instead, so that we don't do an upload/download.
> 
> Improves x11perf -seg100 by 863.652% +/- 9.8968% (n=5)
> 
> Signed-off-by: Eric Anholt <eric at anholt.net>
> ---
>  glamor/glamor_polylines.c | 27 ++++++++++++++-------------
>  1 file changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/glamor/glamor_polylines.c b/glamor/glamor_polylines.c
> index 697fc9e..1adf45d 100644
> --- a/glamor/glamor_polylines.c
> +++ b/glamor/glamor_polylines.c
> @@ -51,8 +51,9 @@ _glamor_poly_lines(DrawablePtr drawable, GCPtr gc,
> int mode, int n,
>          /* This ends up in miSetSpans, which is accelerated as well as 
> we
>           * can hope X wide lines will be.
>           */
> -        goto wide_line;
> +        goto fail;
>      }
> +
>      if (gc->lineStyle != LineSolid) {
>          glamor_fallback("non-solid fill line style %d\n", 
> gc->lineStyle);
>          goto fail;
> @@ -104,19 +105,19 @@ _glamor_poly_lines(DrawablePtr drawable, GCPtr
> gc, int mode, int n,
>          && glamor_ddx_fallback_check_gc(gc))
>          return FALSE;
> 
> -    if (gc->lineWidth == 0) {
> -        if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
> -            glamor_prepare_access_gc(gc)) {
> -            fbPolyLine(drawable, gc, mode, n, points);
> -        }
> -        glamor_finish_access_gc(gc);
> -        glamor_finish_access(drawable);
> -    }
> -    else {
> - wide_line:
> -        /* fb calls mi functions in the lineWidth != 0 case. */
> -        fbPolyLine(drawable, gc, mode, n, points);
> +    switch (gc->lineStyle) {
> +    case LineSolid:
> +        if (gc->lineWidth == 0)
> +            miZeroLine(drawable, gc, mode, n, points);
> +        else
> +            miWideLine(drawable, gc, mode, n, points);
> +        break;
> +    case LineOnOffDash:
> +    case LineDoubleDash:
> +        miWideDash(drawable, gc, mode, n, points);
> +        break;
>      }
> +
>      return TRUE;
>  }


More information about the xorg-devel mailing list