[PATCH 4/6] xwayland: track shm pool protocol changes

Tiago Vignatti tiago.vignatti at intel.com
Mon Apr 16 07:31:49 PDT 2012


Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 hw/xfree86/xwayland/xwayland-cursor.c |    7 +++++--
 hw/xfree86/xwayland/xwayland.c        |    9 ++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c
index e7efdae..eae11ab 100644
--- a/hw/xfree86/xwayland/xwayland-cursor.c
+++ b/hw/xfree86/xwayland/xwayland-cursor.c
@@ -89,6 +89,7 @@ xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
     int size;
     char filename[] = "/tmp/wayland-shm-XXXXXX";
     int fd;
+    struct wl_shm_pool *pool;
     struct wl_buffer *buffer;
     void *data;
 
@@ -121,11 +122,13 @@ xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
 	expand_source_and_mask(cursor, data);
     munmap(data, size);
 
-    buffer = wl_shm_create_buffer(xwl_screen->shm, fd,
+    pool = wl_shm_create_pool(xwl_screen->shm, fd, size);
+    close(fd);
+    buffer = wl_shm_pool_create_buffer(pool, 0,
 				  cursor->bits->width, cursor->bits->height,
 				  cursor->bits->width * 4,
 				  WL_SHM_FORMAT_ARGB8888);
-    close(fd);
+    wl_shm_pool_destroy(pool);
 
     dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, buffer);
 
diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c
index a35f665..6f19f01 100644
--- a/hw/xfree86/xwayland/xwayland.c
+++ b/hw/xfree86/xwayland/xwayland.c
@@ -274,7 +274,8 @@ xwl_create_window_buffer_shm(struct xwl_window *xwl_window,
     uint32_t format;
     WindowPtr window = xwl_window->window;
     ScreenPtr screen = window->drawable.pScreen;
-    int i;
+    struct wl_shm_pool *pool;
+    int i, size;
 
     visual = wVisual(window);
     for (i = 0; i < screen->numVisuals; i++)
@@ -286,10 +287,12 @@ xwl_create_window_buffer_shm(struct xwl_window *xwl_window,
     else
 	format = WL_SHM_FORMAT_XRGB8888;
 
-    xwl_window->buffer =
-      wl_shm_create_buffer(xwl_window->xwl_screen->shm, fd,
+    size = pixmap->drawable.width * pixmap->drawable.width * 4;
+    pool = wl_shm_create_pool(xwl_window->xwl_screen->shm, fd, size);
+    xwl_window->buffer =  wl_shm_pool_create_buffer(pool, 0,
 			   pixmap->drawable.width, pixmap->drawable.height,
 			   pixmap->drawable.width * 4, format);
+    wl_shm_pool_destroy(pool);
 
     return xwl_window->buffer ? Success : BadDrawable;
 }
-- 
1.7.5.4



More information about the wayland-devel mailing list