From e82417d33b8147f65141ef937d56735d80ee7207 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 26 Mar 2016 16:59:37 +0000 Subject: userland: Implement dispmanx_wrap_buffer Signed-off-by: Khem Raj --- .../0015-wl-dispmanx-buffer-wrapping.patch | 80 ++++++++++++++++++++++ recipes-graphics/userland/userland_git.bb | 1 + 2 files changed, 81 insertions(+) create mode 100644 recipes-graphics/userland/userland/0015-wl-dispmanx-buffer-wrapping.patch (limited to 'recipes-graphics/userland') diff --git a/recipes-graphics/userland/userland/0015-wl-dispmanx-buffer-wrapping.patch b/recipes-graphics/userland/userland/0015-wl-dispmanx-buffer-wrapping.patch new file mode 100644 index 0000000..1a0faba --- /dev/null +++ b/recipes-graphics/userland/userland/0015-wl-dispmanx-buffer-wrapping.patch @@ -0,0 +1,80 @@ +implement buffer wrapping interface for dispmanx + +Courtesy: Zan Dobersek + +diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c +index 5730743..9ef89cd 100644 +--- a/interface/khronos/ext/egl_wayland.c ++++ b/interface/khronos/ext/egl_wayland.c +@@ -133,8 +133,50 @@ dispmanx_create_buffer(struct wl_client *client, struct wl_resource *resource, + buffer->handle); + } + ++static void ++dispmanx_wrap_buffer(struct wl_client *client, struct wl_resource *resource, ++ uint32_t id, uint32_t handle, int32_t width, int32_t height, ++ uint32_t stride, uint32_t buffer_height, uint32_t format) ++{ ++ struct wl_dispmanx_server_buffer *buffer; ++ VC_IMAGE_TYPE_T vc_format = get_vc_format(format); ++ uint32_t dummy; ++ ++ if(vc_format == VC_IMAGE_MIN) { ++ wl_resource_post_error(resource, ++ WL_DISPMANX_ERROR_INVALID_FORMAT, ++ "invalid format"); ++ return; ++ } ++ ++ buffer = calloc(1, sizeof *buffer); ++ if (buffer == NULL) { ++ wl_resource_post_no_memory(resource); ++ return; ++ } ++ ++ buffer->handle = handle; ++ buffer->width = width; ++ buffer->height = height; ++ buffer->format = format; ++ ++ buffer->resource = wl_resource_create(resource->client, &wl_buffer_interface, ++ 1, id); ++ if (!buffer->resource) { ++ wl_resource_post_no_memory(resource); ++ vc_dispmanx_resource_delete(buffer->handle); ++ free(buffer); ++ return; ++ } ++ ++ wl_resource_set_implementation(buffer->resource, ++ (void (**)(void)) &dispmanx_buffer_interface, ++ buffer, destroy_buffer); ++} ++ + static const struct wl_dispmanx_interface dispmanx_interface = { + dispmanx_create_buffer, ++ dispmanx_wrap_buffer, + }; + + static void +diff --git a/interface/wayland/dispmanx.xml b/interface/wayland/dispmanx.xml +index c18626d..11ed1ef 100644 +--- a/interface/wayland/dispmanx.xml ++++ b/interface/wayland/dispmanx.xml +@@ -118,6 +118,16 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + diff --git a/recipes-graphics/userland/userland_git.bb b/recipes-graphics/userland/userland_git.bb index 0189a16..ca9123e 100644 --- a/recipes-graphics/userland/userland_git.bb +++ b/recipes-graphics/userland/userland_git.bb @@ -34,6 +34,7 @@ SRC_URI = "\ file://0012-Fix-enum-conversion-warnings.patch \ file://0013-Fix-for-framerate-with-nested-composition.patch \ file://0014-Fix-errors-due-to-ignored-return-code.patch \ + file://0015-wl-dispmanx-buffer-wrapping.patch \ " S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf