diff options
| -rw-r--r-- | recipes-graphics/userland/userland/0015-wl-dispmanx-buffer-wrapping.patch | 80 | ||||
| -rw-r--r-- | recipes-graphics/userland/userland_git.bb | 1 |
2 files changed, 81 insertions, 0 deletions
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 @@ | |||
| 1 | implement buffer wrapping interface for dispmanx | ||
| 2 | |||
| 3 | Courtesy: Zan Dobersek | ||
| 4 | |||
| 5 | diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c | ||
| 6 | index 5730743..9ef89cd 100644 | ||
| 7 | --- a/interface/khronos/ext/egl_wayland.c | ||
| 8 | +++ b/interface/khronos/ext/egl_wayland.c | ||
| 9 | @@ -133,8 +133,50 @@ dispmanx_create_buffer(struct wl_client *client, struct wl_resource *resource, | ||
| 10 | buffer->handle); | ||
| 11 | } | ||
| 12 | |||
| 13 | +static void | ||
| 14 | +dispmanx_wrap_buffer(struct wl_client *client, struct wl_resource *resource, | ||
| 15 | + uint32_t id, uint32_t handle, int32_t width, int32_t height, | ||
| 16 | + uint32_t stride, uint32_t buffer_height, uint32_t format) | ||
| 17 | +{ | ||
| 18 | + struct wl_dispmanx_server_buffer *buffer; | ||
| 19 | + VC_IMAGE_TYPE_T vc_format = get_vc_format(format); | ||
| 20 | + uint32_t dummy; | ||
| 21 | + | ||
| 22 | + if(vc_format == VC_IMAGE_MIN) { | ||
| 23 | + wl_resource_post_error(resource, | ||
| 24 | + WL_DISPMANX_ERROR_INVALID_FORMAT, | ||
| 25 | + "invalid format"); | ||
| 26 | + return; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + buffer = calloc(1, sizeof *buffer); | ||
| 30 | + if (buffer == NULL) { | ||
| 31 | + wl_resource_post_no_memory(resource); | ||
| 32 | + return; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + buffer->handle = handle; | ||
| 36 | + buffer->width = width; | ||
| 37 | + buffer->height = height; | ||
| 38 | + buffer->format = format; | ||
| 39 | + | ||
| 40 | + buffer->resource = wl_resource_create(resource->client, &wl_buffer_interface, | ||
| 41 | + 1, id); | ||
| 42 | + if (!buffer->resource) { | ||
| 43 | + wl_resource_post_no_memory(resource); | ||
| 44 | + vc_dispmanx_resource_delete(buffer->handle); | ||
| 45 | + free(buffer); | ||
| 46 | + return; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + wl_resource_set_implementation(buffer->resource, | ||
| 50 | + (void (**)(void)) &dispmanx_buffer_interface, | ||
| 51 | + buffer, destroy_buffer); | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | static const struct wl_dispmanx_interface dispmanx_interface = { | ||
| 55 | dispmanx_create_buffer, | ||
| 56 | + dispmanx_wrap_buffer, | ||
| 57 | }; | ||
| 58 | |||
| 59 | static void | ||
| 60 | diff --git a/interface/wayland/dispmanx.xml b/interface/wayland/dispmanx.xml | ||
| 61 | index c18626d..11ed1ef 100644 | ||
| 62 | --- a/interface/wayland/dispmanx.xml | ||
| 63 | +++ b/interface/wayland/dispmanx.xml | ||
| 64 | @@ -118,6 +118,16 @@ | ||
| 65 | <arg name="buffer" type="object" interface="wl_buffer"/> | ||
| 66 | <arg name="handle" type="uint"/> | ||
| 67 | </event> | ||
| 68 | + | ||
| 69 | + <request name="wrap_buffer"> | ||
| 70 | + <arg name="id" type="new_id" interface="wl_buffer"/> | ||
| 71 | + <arg name="handle" type="uint"/> | ||
| 72 | + <arg name="width" type="int"/> | ||
| 73 | + <arg name="height" type="int"/> | ||
| 74 | + <arg name="stride" type="uint"/> | ||
| 75 | + <arg name="buffer_height" type="uint"/> | ||
| 76 | + <arg name="format" type="uint"/> | ||
| 77 | + </request> | ||
| 78 | </interface> | ||
| 79 | |||
| 80 | </protocol> | ||
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 = "\ | |||
| 34 | file://0012-Fix-enum-conversion-warnings.patch \ | 34 | file://0012-Fix-enum-conversion-warnings.patch \ |
| 35 | file://0013-Fix-for-framerate-with-nested-composition.patch \ | 35 | file://0013-Fix-for-framerate-with-nested-composition.patch \ |
| 36 | file://0014-Fix-errors-due-to-ignored-return-code.patch \ | 36 | file://0014-Fix-errors-due-to-ignored-return-code.patch \ |
| 37 | file://0015-wl-dispmanx-buffer-wrapping.patch \ | ||
| 37 | " | 38 | " |
| 38 | S = "${WORKDIR}/git" | 39 | S = "${WORKDIR}/git" |
| 39 | 40 | ||
