From: Benjamin Gaignard benjamin.gaignard@linaro.org
The goal of this serie of patches is to add a way to use dmabuf file descriptor inside wayland and weston.
In a context where there is no Mesa EGL (and so no wl_drm protocol) wl_dmabuf could be used as an alternative to shm to share buffers between hardware devices. If your hardware device (video decoder, renderer, etc...) need physical contiguous memory (obviously don't have MMU) wl_dmabuf may save the cost of one copy compare to shm.
shm case: videodecoder --(copy into shm_buffer)--> weston(+pixman) --> HW renderer
dmabuf case: videodecoder --(directly write in dmabuf buffer)--> weston(+pixman) --> HW renderer
The server is responsible to send its supported pixel formats and the device name to be used by the client to allocate buffers.
While mmap() call on dmabuf file descriptor result isn't guaranty on all architectures both server and client should take care of it before accessing to buffer data to avoid segfault.
This series of patches include wayland and weston modifications. An example of how use wl_dmabuf is provided in weston/clients/simple-dmabuf.c
=== Wayland === Benjamin Gaignard (1): Add wl_dmabuf protocol
protocol/Makefile.am | 6 +- protocol/wayland-dmabuf.xml | 128 ++++++++++++++++++++++++ src/Makefile.am | 12 ++- src/wayland-dmabuf.c | 231 +++++++++++++++++++++++++++++++++++++++++++ src/wayland-dmabuf.h | 123 +++++++++++++++++++++++ 5 files changed, 496 insertions(+), 4 deletions(-) create mode 100644 protocol/wayland-dmabuf.xml create mode 100644 src/wayland-dmabuf.c create mode 100644 src/wayland-dmabuf.h
=== Weston === Benjamin Gaignard (2): compositor-drm: allow to be a wl_dmabuf server add simple-dmabuf client
clients/Makefile.am | 11 ++ clients/simple-dmabuf.c | 469 +++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 5 + src/compositor-drm.c | 83 ++++++++- src/compositor.c | 4 +- src/compositor.h | 2 + src/pixman-renderer.c | 93 +++++++--- 7 files changed, 637 insertions(+), 30 deletions(-) create mode 100644 clients/simple-dmabuf.c