[PATCH] dix/dispatch: DoGetImage: Use a single buffer

Keith Packard keithp at keithp.com
Mon Mar 31 23:20:56 PDT 2014


Mark Kettenis <mark.kettenis at xs4all.nl> writes:

> I tried making the FlushClient() implementation a bit smarter by using
> a circular buffer to avoid the memmove'ing.  Unfortunately that makes
> resizing the output buffer more painful and introduces some additional
> memcpy'ing there.

I don't think there's actually any more memcpy going on -- you've
replaced a realloc with a malloc followed by memcpy, which should be the
same cost.

I've merged your patch along with Daniel's and my output reservation
idea into a single sequence so I could test the effect of each one.

1: glamor-server        my glamor-server branch
2: one-buffer           + Daniel's single buffer for GetImage patch
3: ring-buffer          + Mark's ring output buffer patch
4: output-reservation   + Keith's output reservation patch

       1                 2                           3                           4                 Operation
------------   -------------------------   -------------------------   -------------------------   -------------------------
       486.0          583.0 (     1.200)          603.0 (     1.241)          619.0 (     1.274)   GetImage 500x500 square 

All three have positive effects (oddly), with the bulk of the
improvement going to not calling the DDX in tiny chunks. I assume that
the ring output buffer helps by not calling memmove after every network
write (yikes!), while my output reservation patch has a smaller effect
by not copying the data twice.

This is with my glamor driver, which doesn't have any extra cost for
each GetImage as it's just calling glReadPixels.

Here's the patch that I made:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-client-output-buffer-reservation-API-for-GetImag.patch
Type: text/x-diff
Size: 7238 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140331/9620e92f/attachment.patch>
-------------- next part --------------

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140331/9620e92f/attachment.sig>


More information about the xorg-devel mailing list