[PATCH 2/2] glamor: use write only for putimage in some cases

Michel Dänzer michel at daenzer.net
Fri Mar 11 02:07:41 UTC 2016


On 11.03.2016 10:17, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> Ilia pointed out that xlock -mode wator is slow, this speeds it
> up by avoiding the ReadPixels on every frame.
> 
> The current criteria for putimage is
> 
> a) ALU copy operation
> b) planemask all set
> c) region is contained inside pCompositeClip
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  glamor/glamor_image.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/glamor/glamor_image.c b/glamor/glamor_image.c
> index 3158749..a190d3e 100644
> --- a/glamor/glamor_image.c
> +++ b/glamor/glamor_image.c
> @@ -88,7 +88,19 @@ static void
>  glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
>                        int w, int h, int leftPad, int format, char *bits)
>  {
> -    if (glamor_prepare_access_box(drawable, GLAMOR_ACCESS_RW, x, y, w, h))
> +    int access = GLAMOR_ACCESS_RW;
> +
> +    if (gc->alu == GXcopy && glamor_pm_is_solid(gc->depth, gc->planemask)) {
> +	BoxRec box;
> +	box.x1 = x;
> +	box.y1 = y;
> +	box.x2 = x + w;
> +	box.y2 = y + h;
> +
> +	if (RegionContainsRect(gc->pCompositeClip, &box))
> +            access = GLAMOR_ACCESS_WO;
> +    }
> +    if (glamor_prepare_access_box(drawable, access, x, y, w, h))
>          fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
>      glamor_finish_access(drawable);
>  }
> 

Instead of bailing if the box isn't fully contained in
gc->pCompositeClip, how about looping over the rects of the intersection
of the two?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-devel mailing list