[cairo-commit] 2 commits - configure.ac src/cairo-pen.c src/cairo-xlib-surface-shm.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Oct 20 00:35:37 PDT 2012


 configure.ac                 |   32 ++++++++++++++++++++++++++++++++
 src/cairo-pen.c              |    2 +-
 src/cairo-xlib-surface-shm.c |    3 +++
 3 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit c565bad8901dbe66e1402cdc2418986e96e698e3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Oct 19 12:22:58 2012 +0100

    pen: Relax invisibility criteria from half-tolerance to quarter-tolerance
    
    Inkscape is one user who sets geometric tolerance to 1.25 pixels when
    stroking sub-pixel lines. Whilst we wait for inkscape to set sensible
    values for their tolerance, we have to allow through the current values
    in order to prevent the fine strokes from disappearing.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56099
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index cf441c4..ea9e36a 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -284,7 +284,7 @@ _cairo_pen_vertices_needed (double	    tolerance,
 								     radius);
     int num_vertices;
 
-    if (tolerance >= 2*major_axis) {
+    if (tolerance >= 4*major_axis) { /* XXX relaxed from 2*major for inkscape */
 	num_vertices = 1;
     } else if (tolerance >= major_axis) {
 	num_vertices = 4;
commit 5041b462d084de8552336275914d30c23bf5dd35
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Oct 19 12:04:50 2012 +0100

    xlib/shm: Sync the XShmAttach before removing the ShmSegment id
    
    Whilst reading through other users of XShm, it became apparent that
    IPC_RMID behaves differently across the platforms. Linux allows
    processes to attach to an existing ShmSegment id after a IPC_RMID, but
    for others the IPC_RMID takes immediate effect. On those platforms
    without a "deferred" IPC_RMID, we then need to perform the XShmAttach
    synchronously before perfomring the IPC_RMID.
    
    Reported-by: Thomas Klausner <wiz at NetBSD.org>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index 67b68e2..017e81a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,38 @@ CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib, auto, [
 		       xlib_NONPKGCONFIG_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
 		       xlib_NONPKGCONFIG_CFLAGS=$X_CFLAGS
 		     fi])
+
+  AC_CHECK_HEADER(sys/ipc.h)
+  AC_CHECK_HEADER(sys/shm.h)
+
+  if test "$ac_cv_header_sys_ipc_h" = "yes" -a "$ac_cv_header_sys_shm_h" = "yes"; then
+      AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
+      AC_TRY_RUN([
+		  #include <sys/types.h>
+		  #include <sys/ipc.h>
+		  #include <sys/shm.h>
+		  int main()
+		  {
+		      char *shmaddr;
+		      int id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
+		      if (id == -1) return 2;
+		      shmaddr = shmat (id, 0, 0);
+		      shmctl (id, IPC_RMID, 0);
+		      if ((char*) shmat (id, 0, 0) == (char*) -1) {
+			  shmdt (shmaddr);
+			  return 1;
+		      }
+		      shmdt (shmaddr);
+		      shmdt (shmaddr);
+		      return 0;
+		  }
+		  ],
+		  AC_DEFINE(IPC_RMID_DEFERRED_RELEASE, 1,
+			    [Define to 1 if shared memory segments are released deferred.])
+		  AC_MSG_RESULT(yes),
+		  AC_MSG_RESULT(no),
+		  AC_MSG_RESULT(assuming no))
+      fi
 ])
 
 CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [
diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
index ec8a6e1..ec0d334 100644
--- a/src/cairo-xlib-surface-shm.c
+++ b/src/cairo-xlib-surface-shm.c
@@ -449,6 +449,9 @@ _cairo_xlib_shm_pool_create(cairo_xlib_display_t *display,
 
     pool->attached = NextRequest (dpy);
     success = XShmAttach (dpy, &pool->shm);
+#if !IPC_RMID_DEFERRED_RELEASE
+    XSync (dpy, FALSE);
+#endif
     shmctl (pool->shm.shmid, IPC_RMID, NULL);
 
     if (! success)


More information about the cairo-commit mailing list