summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-03-26 16:59:37 +0000
committerAndrei Gherzan <andrei@gherzan.ro>2016-03-28 16:37:43 +0200
commite82417d33b8147f65141ef937d56735d80ee7207 (patch)
tree8adf3d872b9031313d61c0a12f97aed0e7d5264b
parentd28692dc9e47b0b840acf0c9d96f5f08b959582f (diff)
downloadmeta-raspberrypi-e82417d33b8147f65141ef937d56735d80ee7207.tar.gz
userland: Implement dispmanx_wrap_buffer
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--recipes-graphics/userland/userland/0015-wl-dispmanx-buffer-wrapping.patch80
-rw-r--r--recipes-graphics/userland/userland_git.bb1
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 @@
1implement buffer wrapping interface for dispmanx
2
3Courtesy: Zan Dobersek
4
5diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c
6index 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
60diff --git a/interface/wayland/dispmanx.xml b/interface/wayland/dispmanx.xml
61index 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"
38S = "${WORKDIR}/git" 39S = "${WORKDIR}/git"
39 40