ephyr: Sync less in hostx_paint_rect

Move the xcb_aux_sync into the shm path, where we do still need it to
synchronize access with the host. In the non-shm path the image is
copied to the host anyway so the sync just adds latency and keeps you
from using all your network bandwidth.

Only the non-shm-putimage path benefits from this, but the benefit is
significant even on the local machine (here a 3.2GHz Core i7-8700, using
XEPHYR_NO_SHM=1):

      before                  after   Operation
------------   --------------------   -------------------------
 228000000.0    225000000.0 (0.987)   Dot
  40900000.0     41600000.0 (1.017)   1x1 rectangle
  10400000.0     10700000.0 (1.029)   10x10 rectangle
    477000.0       471000.0 (0.987)   100x100 rectangle
     30900.0        31800.0 (1.029)   500x500 rectangle
    760000.0       981000.0 (1.291)   PutImage 10x10 square
     14700.0        19200.0 (1.306)   PutImage 100x100 square
       320.0          382.0 (1.194)   PutImage 500x500 square
    749000.0       984000.0 (1.314)   ShmPutImage 10x10 square
    268000.0       304000.0 (1.134)   ShmPutImage 100x100 square
     16600.0        18500.0 (1.114)   ShmPutImage 500x500 square

Reviewed-by: Emma Anholt <emma@anholt.net>
This commit is contained in:
Adam Jackson 2022-02-08 18:02:40 -05:00
parent 92a00f5221
commit 7f88489963

View File

@ -1100,6 +1100,7 @@ hostx_paint_rect(KdScreenInfo *screen,
HostX.gc, scrpriv->ximg,
scrpriv->shminfo,
sx, sy, dx, dy, width, height, FALSE);
xcb_aux_sync(HostX.conn);
}
else {
xcb_image_t *subimg = xcb_image_subimage(scrpriv->ximg, sx, sy,
@ -1110,8 +1111,6 @@ hostx_paint_rect(KdScreenInfo *screen,
xcb_image_destroy(img);
xcb_image_destroy(subimg);
}
xcb_aux_sync(HostX.conn);
}
static void