[PATCH 0/3] Introduce shm pool helper functions

Ander Conselvan de Oliveira conselvan2 at gmail.com
Tue Aug 7 04:43:35 PDT 2012


On 08/04/2012 04:22 PM, Andre Heider wrote:
> This set adds a couple of helper function to wayland-client to handle
> shm pools.
>
> Motivation: I noticed the amount of code duplication on client side.
> On top of that, wayland already maintains this platform independent.
>
> I'm not happy with the names of the functions, and the API needs a few more
> thoughts before declaring it public, but I wanted to get some comments about
> this first.

I think this could be called wl_shm_mapping and we get rid of the unmap 
parameter to wl_shm_pool_helper_destroy(). In terms of a public API I 
think it is bad idea to let the user leak the mapping. In simple-shm.c, 
simple-touch.c and screenshot.c, this would be just a matter of keeping 
a reference to the mapping until it is not needed anymore.

> Similar to wayland-cursor, this could also be shoved into its own library.

I think this is useful enough to have it in libwayland-client, and as it 
turns out, it ends up there anyway. So there's no value in creating 
libshared. We could just have the helper implementation in src/ and have 
cursor/os-compatibility.c merged with src/wayland-os.c.

But anyway, let's see what Kristian thinks.

Cheers,
Ander


> Also see the follow up patch set for weston.
>
> Andre Heider (3):
>    Introduce a static lib for shared code
>    wayland-client: Introduce shm pool helper function
>    wayland-cursor: Adapt to new shm pool helper functions
>
>   configure.ac              |    1 +
>   cursor/Makefile.am        |   12 ++---
>   cursor/os-compatibility.c |  128 ---------------------------------------------
>   cursor/os-compatibility.h |   31 -----------
>   cursor/wayland-cursor.c   |  117 +++++++++--------------------------------
>   shared/Makefile.am        |    9 ++++
>   shared/os-compatibility.c |  128 +++++++++++++++++++++++++++++++++++++++++++++
>   shared/os-compatibility.h |   31 +++++++++++
>   src/Makefile.am           |    6 ++-
>   src/wayland-client.c      |  110 ++++++++++++++++++++++++++++++++++++++
>   src/wayland-client.h      |   23 ++++++++
>   11 files changed, 338 insertions(+), 258 deletions(-)
>   delete mode 100644 cursor/os-compatibility.c
>   delete mode 100644 cursor/os-compatibility.h
>   create mode 100644 shared/Makefile.am
>   create mode 100644 shared/os-compatibility.c
>   create mode 100644 shared/os-compatibility.h
>



More information about the wayland-devel mailing list