[cairo-commit] 6 commits - src/cairo-xlib-render-compositor.c src/cairo-xlib-source.c src/cairo-xlib-surface.c src/cairo-xlib-surface-shm.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Jan 28 19:09:03 PST 2013


 src/cairo-xlib-render-compositor.c |    7 ++++++-
 src/cairo-xlib-source.c            |   10 +++-------
 src/cairo-xlib-surface-shm.c       |   15 +++++----------
 src/cairo-xlib-surface.c           |    3 +--
 4 files changed, 15 insertions(+), 20 deletions(-)

New commits:
commit c006b886d28a772d7a62cec52ab7e0c8196c36f6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 29 03:01:31 2013 +0000

    xlib/shm: Force synchronisation for scratch SHM image buffers
    
    The scratch image buffers are used for uploads to the xserver and so we
    must be careful not to overwrite active SHM segments. Unfortunately we
    told the core SHM allocator that we would sync before using the images,
    which was a lie.
    
    Reported-by: Michael Natterer <mitch at gimp.org>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
index 43cecdf..32c7033 100644
--- a/src/cairo-xlib-surface-shm.c
+++ b/src/cairo-xlib-surface-shm.c
@@ -1155,7 +1155,7 @@ _cairo_xlib_surface_create_shm__image (cairo_xlib_surface_t *surface,
 	return NULL;
 
     return &_cairo_xlib_shm_surface_create (surface, format, width, height,
-					    TRUE, 0)->image.base;
+					    FALSE, 0)->image.base;
 }
 
 cairo_surface_t *
commit fd59e6d86a3a1fc6720316f20deb8a0bd6f7b767
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 29 03:00:46 2013 +0000

    xlib/shm: Always request a CompletionEvent from ShmPutImage
    
    ...and treat is as an expected event for synchronisation.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
index 9c88cb8..43cecdf 100644
--- a/src/cairo-xlib-surface-shm.c
+++ b/src/cairo-xlib-surface-shm.c
@@ -404,11 +404,6 @@ peek_processed (cairo_device_t *device)
     return LastKnownRequestProcessed (peek_display(device));
 }
 
-static unsigned next_request (cairo_device_t *device)
-{
-    return NextRequest (peek_display (device));
-}
-
 static void
 _cairo_xlib_display_shm_pool_destroy (cairo_xlib_display_t *display,
 				      cairo_xlib_shm_t *pool)
@@ -1231,10 +1226,10 @@ _cairo_xlib_shm_surface_get_ximage (cairo_surface_t *surface,
 void *
 _cairo_xlib_shm_surface_get_obdata (cairo_surface_t *surface)
 {
-    cairo_xlib_shm_surface_t *shm;
+    cairo_xlib_display_t *display = (cairo_xlib_display_t *) surface->device;
+    cairo_xlib_shm_surface_t *shm = (cairo_xlib_shm_surface_t *) surface;
 
-    shm = (cairo_xlib_shm_surface_t *) surface;
-    shm->active = next_request (surface->device);
+    display->shm->last_event = shm->active = NextRequest (display->display);
     return &shm->info->pool->shm;
 }
 
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index ee69b66..96ba3ad 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1345,8 +1345,7 @@ _cairo_xlib_surface_draw_image (cairo_xlib_surface_t   *surface,
 
     if (ximage.obdata)
 	XShmPutImage (display->display, surface->drawable, gc, &ximage,
-		      src_x, src_y, dst_x, dst_y, width, height,
-		      shm_image == NULL);
+		      src_x, src_y, dst_x, dst_y, width, height, True);
     else
 	XPutImage (display->display, surface->drawable, gc, &ximage,
 		   src_x, src_y, dst_x, dst_y, width, height);
commit a364a106b257c4493ba7b3badacc63599ba6064a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 29 02:52:10 2013 +0000

    xlib/shm: Tidy up destroying the mempool for a shm block
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
index d27b2d6..9c88cb8 100644
--- a/src/cairo-xlib-surface-shm.c
+++ b/src/cairo-xlib-surface-shm.c
@@ -504,7 +504,7 @@ _cairo_xlib_shm_info_find (cairo_xlib_display_t *display, size_t size,
 	*last_request = info->last_request;
 
 	_pqueue_pop (&display->shm->info);
-	_cairo_mempool_free (&info->pool->mem, info->mem);
+	_cairo_mempool_free (&pool->mem, info->mem);
 	free (info);
 
 	if (pool->mem.free_bytes >= size) {
commit 02a2baa8dcf49ad2d9766d43578ba216fab0d464
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 29 02:51:25 2013 +0000

    xlib/shm: Tidy creation of the proxy source for ShmPixmaps
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c
index ca55278..0cc32e8 100644
--- a/src/cairo-xlib-source.c
+++ b/src/cairo-xlib-source.c
@@ -955,18 +955,14 @@ surface_source (cairo_xlib_surface_t *dst,
 	_cairo_xlib_shm_surface_get_pixmap (src)) {
 	cairo_xlib_proxy_t *proxy;
 
-	cairo_surface_reference (src);
-
 	proxy = malloc (sizeof(*proxy));
-	if (unlikely (proxy == NULL)) {
-	    cairo_surface_destroy (src);
+	if (unlikely (proxy == NULL))
 	    return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);
-	}
 
 	_cairo_surface_init (&proxy->source.base,
 			     &cairo_xlib_proxy_backend,
 			     dst->base.device,
-			     CAIRO_CONTENT_COLOR_ALPHA);
+			     src->content);
 
 	proxy->source.dpy = dst->display->display;
 	proxy->source.picture = XRenderCreatePicture (proxy->source.dpy,
@@ -979,7 +975,7 @@ surface_source (cairo_xlib_surface_t *dst,
 	proxy->source.has_matrix = 0;
 	proxy->source.filter = CAIRO_FILTER_NEAREST;
 	proxy->source.extend = CAIRO_EXTEND_NONE;
-	proxy->owner = src;
+	proxy->owner = cairo_surface_reference (src);
 
 	return embedded_source (dst, pattern, extents, src_x, src_y,
 				&proxy->source);
commit 30e950515171b25d9bc3da8d535cfe05d8be69c8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 29 02:49:26 2013 +0000

    xlib/shm: Skip creating new SHM segments if the data is already in the xserver
    
    If the image is already inside a SHM segment, but the image format does
    not match the surface, fallback to the XRender paths in order to perform
    colorspace conversion on the data already inside the Xserver.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c
index 94abe9e..10360db 100644
--- a/src/cairo-xlib-render-compositor.c
+++ b/src/cairo-xlib-render-compositor.c
@@ -251,6 +251,10 @@ draw_image_boxes (void *_dst,
     int i;
 
     if (image->base.device == dst->base.device &&
+	image->depth != dst->depth)
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
+    if (image->base.device == dst->base.device &&
 	image->depth == dst->depth &&
 	_cairo_xlib_shm_surface_get_pixmap (&image->base))
 	    return copy_image_boxes (dst, image, boxes, dx, dy);
commit 1d1af825bb4fcfd7c4a54b65292734ba244e096d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 29 02:47:48 2013 +0000

    xlib/shm: Tighten mark-active to the actual CopyArea on the ShmPixmap
    
    Along the draw_image_boxes() upload path, we were actually marking the
    ShmPixmap as still active for the subsequent drawing operation - which
    could in theory never be submitted...
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c
index 3540d1f..94abe9e 100644
--- a/src/cairo-xlib-render-compositor.c
+++ b/src/cairo-xlib-render-compositor.c
@@ -168,6 +168,7 @@ copy_image_boxes (void *_dst,
 	int x2 = _cairo_fixed_integer_part (boxes->chunks.base[0].p2.x);
 	int y2 = _cairo_fixed_integer_part (boxes->chunks.base[0].p2.y);
 
+	_cairo_xlib_shm_surface_mark_active (&image->base);
 	XCopyArea (dst->dpy, src, dst->drawable, gc,
 		   x1 + dx, y1 + dy,
 		   x2 - x1, y2 - y1,
@@ -201,6 +202,7 @@ copy_image_boxes (void *_dst,
 	}
 
 	XSetClipRectangles (dst->dpy, gc, 0, 0, rects, j, Unsorted);
+	_cairo_xlib_shm_surface_mark_active (&image->base);
 	XCopyArea (dst->dpy, src, dst->drawable, gc,
 		   0, 0, image->width, image->height, -dx, -dy);
 	XSetClipMask (dst->dpy, gc, None);
@@ -209,7 +211,6 @@ copy_image_boxes (void *_dst,
 	    free (rects);
     }
 
-    _cairo_xlib_shm_surface_mark_active (&image->base);
     _cairo_xlib_surface_put_gc (dst->display, dst, gc);
     release (dst);
     return CAIRO_STATUS_SUCCESS;


More information about the cairo-commit mailing list