aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-profile-graphical/recipes-graphics/wayland/weston
diff options
context:
space:
mode:
authorNaoko Tanibata <tnaoko@jp.adit-jv.com>2018-04-11 16:15:33 +0900
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-11-13 14:30:29 +0000
commit4a17dd7bc0114a8a6baffa27c5e5b2659093fa75 (patch)
tree06ee8f3bd95ca23bc1c7a40c04d0c063563f962e /meta-agl-profile-graphical/recipes-graphics/wayland/weston
parent611497f75ee8d128b8911b50d1be4e3c45f805d9 (diff)
meta-agl: introduce transmitter plugin to weston
The waltham-transmitter is the plugin of weston to enable client apps to share its surface between multiple domains. v2 (jsmoeller): rebased to new layer structure v3 (jsmoeller): squashed with previous commit v4 (jsmoeller): merge with https://gerrit.automotivelinux.org/gerrit/#/c/16187 to keep addition together in one patch v5 (jsmoeller): remove unneeded file v6 (jsmoeller): merge with https://gerrit.automotivelinux.org/gerrit/#/c/17223/ to keep addition together in one patch (cherry picked from commit d3ebc4bf2eb0331226ef4eac79aaacd520ee5a60) v7 (jsmoeller): After discussions during the integration session: - fix hardcoded lib64 in source code - reduce package to just transmitter (render is part of the transmitter) - include waltham-transmitter in packagegroup (might not be final place) v8 (tnaoko) : add missing dependency plugins. Change-Id: I7e607ed183f147fc0078bef54639207cfca80c6e Signed-off-by: Wataru Mizuno <wmizuno@jp.adit-jv.com> Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org> Signed-off-by: Naoko Tanibata <tnaoko@jp.adit-jv.com>
Diffstat (limited to 'meta-agl-profile-graphical/recipes-graphics/wayland/weston')
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/weston/0017-ivi-shell-register-ivi_layout_interface.patch91
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/weston/0018-compositor-add-output-type-to-weston_output.patch281
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/weston/0019-compositor-drm-introduce-drm_get_dmafd_from_view.patch132
3 files changed, 504 insertions, 0 deletions
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0017-ivi-shell-register-ivi_layout_interface.patch b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0017-ivi-shell-register-ivi_layout_interface.patch
new file mode 100644
index 000000000..87d883c02
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0017-ivi-shell-register-ivi_layout_interface.patch
@@ -0,0 +1,91 @@
+From 5b1d282c7a7d2badf74bb19f9ddc0d49d3d4562b Mon Sep 17 00:00:00 2001
+From: Emre Ucan <eucan@de.adit-jv.com>
+Date: Thu, 25 Jan 2018 14:36:10 +0100
+Subject: [PATCH] ivi-shell: register ivi_layout_interface
+
+Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
+Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
+---
+ ivi-shell/ivi-layout-export.h | 13 +++++++++++++
+ ivi-shell/ivi-layout.c | 6 ++++++
+ ivi-shell/ivi-shell.c | 2 --
+ 3 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
+index 2317d6e..9452691 100644
+--- a/ivi-shell/ivi-layout-export.h
++++ b/ivi-shell/ivi-layout-export.h
+@@ -59,6 +59,7 @@ extern "C" {
+
+ #include "stdbool.h"
+ #include "compositor.h"
++#include "plugin-registry.h"
+
+ #define IVI_SUCCEEDED (0)
+ #define IVI_FAILED (-1)
+@@ -140,6 +141,8 @@ enum ivi_layout_transition_type{
+ IVI_LAYOUT_TRANSITION_MAX,
+ };
+
++#define IVI_LAYOUT_API_NAME "ivi_layout_api_v1"
++
+ struct ivi_layout_interface {
+
+ /**
+@@ -580,6 +583,16 @@ struct ivi_layout_interface {
+ (*get_surface)(struct weston_surface *surface);
+ };
+
++static inline const struct ivi_layout_interface *
++ivi_layout_get_api(struct weston_compositor *compositor)
++{
++ const void *api;
++ api = weston_plugin_api_get(compositor, IVI_LAYOUT_API_NAME,
++ sizeof(struct ivi_layout_interface));
++
++ return (const struct ivi_layout_interface *)api;
++}
++
+ #ifdef __cplusplus
+ }
+ #endif /* __cplusplus */
+diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
+index 64e4ead..c2c1a35 100644
+--- a/ivi-shell/ivi-layout.c
++++ b/ivi-shell/ivi-layout.c
+@@ -2000,6 +2000,8 @@ ivi_layout_surface_create(struct weston_surface *wl_surface,
+ return ivisurf;
+ }
+
++static struct ivi_layout_interface ivi_layout_interface;
++
+ void
+ ivi_layout_init_with_compositor(struct weston_compositor *ec)
+ {
+@@ -2028,6 +2030,10 @@ ivi_layout_init_with_compositor(struct weston_compositor *ec)
+
+ layout->transitions = ivi_layout_transition_set_create(ec);
+ wl_list_init(&layout->pending_transition_list);
++
++ weston_plugin_api_register(ec, IVI_LAYOUT_API_NAME,
++ &ivi_layout_interface,
++ sizeof(struct ivi_layout_interface));
+ }
+
+ static struct ivi_layout_interface ivi_layout_interface = {
+diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
+index 67619b8..2dabdf9 100644
+--- a/ivi-shell/ivi-shell.c
++++ b/ivi-shell/ivi-shell.c
+@@ -425,8 +425,6 @@ ivi_shell_setting_create(struct ivi_shell_setting *dest,
+ if (!dest->ivi_module &&
+ weston_config_section_get_string(section, "ivi-module",
+ &dest->ivi_module, NULL) < 0) {
+- weston_log("Error: ivi-shell: No ivi-module set\n");
+- result = -1;
+ }
+
+ weston_config_section_get_bool(section, "developermode",
+--
+2.7.4
+
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0018-compositor-add-output-type-to-weston_output.patch b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0018-compositor-add-output-type-to-weston_output.patch
new file mode 100644
index 000000000..4c46ec4ec
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0018-compositor-add-output-type-to-weston_output.patch
@@ -0,0 +1,281 @@
+From 99fb36e62d3d0e3bda3d2984f280f534a629f70c Mon Sep 17 00:00:00 2001
+From: Wataru Mizuno <wmizuno@jp.adit-jv.com>
+Date: Thu, 12 Oct 2017 14:55:13 +0900
+Subject: [PATCH 1/5] compositor: add output type to weston_output
+
+This enables weston to use multiple types of backend
+Each backends have own output structure for each functions
+To avoid invalid member access, type identifier is needed
+
+Signed-off-by: Wataru Mizuno <wmizuno@jp.adit-jv.com>
+---
+ libweston/compositor-drm.c | 100 +++++++++++++++++++++++-----------------
+ libweston/compositor-fbdev.c | 1 +
+ libweston/compositor-headless.c | 1 +
+ libweston/compositor-rdp.c | 1 +
+ libweston/compositor-wayland.c | 1 +
+ libweston/compositor-x11.c | 1 +
+ libweston/compositor.h | 12 +++++
+ 7 files changed, 74 insertions(+), 43 deletions(-)
+
+diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
+index 1d38f05..0b5b4c4 100644
+--- a/libweston/compositor-drm.c
++++ b/libweston/compositor-drm.c
+@@ -243,14 +243,16 @@ drm_output_find_by_crtc(struct drm_backend *b, uint32_t crtc_id)
+ struct drm_output *output;
+
+ wl_list_for_each(output, &b->compositor->output_list, base.link) {
+- if (output->crtc_id == crtc_id)
+- return output;
++ if(output->base.output_type == OUTPUT_DRM)
++ if (output->crtc_id == crtc_id)
++ return output;
+ }
+
+ wl_list_for_each(output, &b->compositor->pending_output_list,
+ base.link) {
+- if (output->crtc_id == crtc_id)
+- return output;
++ if(output->base.output_type == OUTPUT_DRM)
++ if (output->crtc_id == crtc_id)
++ return output;
+ }
+
+ return NULL;
+@@ -262,14 +264,16 @@ drm_output_find_by_connector(struct drm_backend *b, uint32_t connector_id)
+ struct drm_output *output;
+
+ wl_list_for_each(output, &b->compositor->output_list, base.link) {
+- if (output->connector_id == connector_id)
+- return output;
++ if(output->base.output_type == OUTPUT_DRM)
++ if (output->connector_id == connector_id)
++ return output;
+ }
+
+ wl_list_for_each(output, &b->compositor->pending_output_list,
+ base.link) {
+- if (output->connector_id == connector_id)
+- return output;
++ if(output->base.output_type == OUTPUT_DRM)
++ if (output->connector_id == connector_id)
++ return output;
+ }
+
+ return NULL;
+@@ -2433,6 +2437,7 @@ drm_output_enable(struct weston_output *base)
+ struct weston_mode *m;
+
+ output->dpms_prop = drm_get_prop(b->drm.fd, output->connector, "DPMS");
++ output->base.output_type = OUTPUT_DRM;
+
+ if (b->use_pixman) {
+ if (drm_output_init_pixman(output, b) < 0) {
+@@ -2797,38 +2802,42 @@ update_outputs(struct drm_backend *b, struct udev_device *drm_device)
+
+ wl_list_for_each_safe(output, next, &b->compositor->output_list,
+ base.link) {
+- bool disconnected = true;
+-
+- for (i = 0; i < resources->count_connectors; i++) {
+- if (connected[i] == output->connector_id) {
+- disconnected = false;
+- break;
++ if (output->base.output_type == OUTPUT_DRM) {
++ bool disconnected = true;
++
++ for (i = 0; i < resources->count_connectors; i++) {
++ if (connected[i] == output->connector_id) {
++ disconnected = false;
++ break;
++ }
+ }
+- }
+
+- if (!disconnected)
+- continue;
++ if (!disconnected)
++ continue;
+
+- weston_log("connector %d disconnected\n", output->connector_id);
+- drm_output_destroy(&output->base);
++ weston_log("connector %d disconnected\n", output->connector_id);
++ drm_output_destroy(&output->base);
++ }
+ }
+
+ wl_list_for_each_safe(output, next, &b->compositor->pending_output_list,
+ base.link) {
+- bool disconnected = true;
+-
+- for (i = 0; i < resources->count_connectors; i++) {
+- if (connected[i] == output->connector_id) {
+- disconnected = false;
+- break;
++ if (output->base.output_type == OUTPUT_DRM) {
++ bool disconnected = true;
++
++ for (i = 0; i < resources->count_connectors; i++) {
++ if (connected[i] == output->connector_id) {
++ disconnected = false;
++ break;
++ }
+ }
+- }
+
+- if (!disconnected)
+- continue;
++ if (!disconnected)
++ continue;
+
+- weston_log("connector %d disconnected\n", output->connector_id);
+- drm_output_destroy(&output->base);
++ weston_log("connector %d disconnected\n", output->connector_id);
++ drm_output_destroy(&output->base);
++ }
+ }
+
+ free(connected);
+@@ -2925,18 +2934,21 @@ session_notify(struct wl_listener *listener, void *data)
+ * pending frame callbacks. */
+
+ wl_list_for_each(output, &compositor->output_list, base.link) {
+- output->base.repaint_needed = 0;
+- drmModeSetCursor(b->drm.fd, output->crtc_id, 0, 0, 0);
++ if(output->base.output_type == OUTPUT_DRM) {
++ output->base.repaint_needed = 0;
++ drmModeSetCursor(b->drm.fd, output->crtc_id, 0, 0, 0);
++ }
++ }
++ if(output->base.output_type == OUTPUT_DRM) {
++ output = container_of(compositor->output_list.next,
++ struct drm_output, base.link);
++
++ wl_list_for_each(sprite, &b->sprite_list, link)
++ drmModeSetPlane(b->drm.fd,
++ sprite->plane_id,
++ output->crtc_id, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+-
+- output = container_of(compositor->output_list.next,
+- struct drm_output, base.link);
+-
+- wl_list_for_each(sprite, &b->sprite_list, link)
+- drmModeSetPlane(b->drm.fd,
+- sprite->plane_id,
+- output->crtc_id, 0, 0,
+- 0, 0, 0, 0, 0, 0, 0, 0);
+ };
+ }
+
+@@ -3148,7 +3160,8 @@ switch_to_gl_renderer(struct drm_backend *b)
+ }
+
+ wl_list_for_each(output, &b->compositor->output_list, base.link)
+- pixman_renderer_output_destroy(&output->base);
++ if(output->base.output_type == OUTPUT_DRM)
++ pixman_renderer_output_destroy(&output->base);
+
+ b->compositor->renderer->destroy(b->compositor);
+
+@@ -3160,7 +3173,8 @@ switch_to_gl_renderer(struct drm_backend *b)
+ }
+
+ wl_list_for_each(output, &b->compositor->output_list, base.link)
+- drm_output_init_egl(output, b);
++ if(output->base.output_type == OUTPUT_DRM)
++ drm_output_init_egl(output, b);
+
+ b->use_pixman = 0;
+
+diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
+index 44f0cf5..9cb903e 100644
+--- a/libweston/compositor-fbdev.c
++++ b/libweston/compositor-fbdev.c
+@@ -433,6 +433,7 @@ fbdev_output_enable(struct weston_output *base)
+ int fb_fd;
+ struct wl_event_loop *loop;
+
++ output->base.output_type = OUTPUT_FBDEV;
+ /* Create the frame buffer. */
+ fb_fd = fbdev_frame_buffer_open(output, output->device, &output->fb_info);
+ if (fb_fd < 0) {
+diff --git a/libweston/compositor-headless.c b/libweston/compositor-headless.c
+index a1aec6d..b0d5afb 100644
+--- a/libweston/compositor-headless.c
++++ b/libweston/compositor-headless.c
+@@ -148,6 +148,7 @@ headless_output_enable(struct weston_output *base)
+ loop = wl_display_get_event_loop(b->compositor->wl_display);
+ output->finish_frame_timer =
+ wl_event_loop_add_timer(loop, finish_frame_handler, output);
++ output->base.output_type = OUTPUT_HEADLESS;
+
+ if (b->use_pixman) {
+ output->image_buf = malloc(output->base.current_mode->width *
+diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c
+index d9668e8..d525982 100644
+--- a/libweston/compositor-rdp.c
++++ b/libweston/compositor-rdp.c
+@@ -519,6 +519,7 @@ rdp_output_enable(struct weston_output *base)
+ struct rdp_backend *b = to_rdp_backend(base->compositor);
+ struct wl_event_loop *loop;
+
++ output->base.output_type = OUTPUT_RDP;
+ output->shadow_surface = pixman_image_create_bits(PIXMAN_x8r8g8b8,
+ output->base.current_mode->width,
+ output->base.current_mode->height,
+diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
+index 9d35ef7..66a0dbf 100644
+--- a/libweston/compositor-wayland.c
++++ b/libweston/compositor-wayland.c
+@@ -1164,6 +1164,7 @@ wayland_output_enable(struct weston_output *base)
+ struct wayland_backend *b = to_wayland_backend(base->compositor);
+ int ret = 0;
+
++ output->base.output_type = OUTPUT_WAYLAND;
+ weston_log("Creating %dx%d wayland output at (%d, %d)\n",
+ output->base.current_mode->width,
+ output->base.current_mode->height,
+diff --git a/libweston/compositor-x11.c b/libweston/compositor-x11.c
+index f9cb461..fcf39e1 100644
+--- a/libweston/compositor-x11.c
++++ b/libweston/compositor-x11.c
+@@ -825,6 +825,7 @@ x11_output_enable(struct weston_output *base)
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY,
+ 0
+ };
++ output->base.output_type = OUTPUT_X11;
+
+ if (!b->no_input)
+ values[0] |=
+diff --git a/libweston/compositor.h b/libweston/compositor.h
+index 08e728a..51157d0 100644
+--- a/libweston/compositor.h
++++ b/libweston/compositor.h
+@@ -146,9 +146,21 @@ enum dpms_enum {
+ WESTON_DPMS_OFF
+ };
+
++/* bit compatible with drm definitions. */
++enum output_type {
++ OUTPUT_DRM,
++ OUTPUT_FBDEV,
++ OUTPUT_HEADLESS,
++ OUTPUT_RDP,
++ OUTPUT_WAYLAND,
++ OUTPUT_X11,
++ OUTPUT_WALTHAM
++};
++
+ struct weston_output {
+ uint32_t id;
+ char *name;
++ enum output_type output_type;
+
+ void *renderer_state;
+
+--
+2.7.4
+
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0019-compositor-drm-introduce-drm_get_dmafd_from_view.patch b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0019-compositor-drm-introduce-drm_get_dmafd_from_view.patch
new file mode 100644
index 000000000..bec90c75d
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0019-compositor-drm-introduce-drm_get_dmafd_from_view.patch
@@ -0,0 +1,132 @@
+From 3dbffb783f44752ec221a2ee7a94a21934d681a2 Mon Sep 17 00:00:00 2001
+From: Wataru Mizuno <wmizuno@jp.adit-jv.com>
+Date: Tue, 10 Apr 2018 12:22:07 +0900
+Subject: [PATCH 5/5] compositor-drm: introduce drm_get_dmafd_from_view
+
+This API enables to get dmafd from weston_view
+
+Signed-off-by: Wataru Mizuno <wmizuno@jp.adit-jv.com>
+---
+ libweston/compositor-drm.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++
+ libweston/compositor-drm.h | 7 ++++
+ 2 files changed, 87 insertions(+)
+
+diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
+index 0b5b4c4..77f2ece 100644
+--- a/libweston/compositor-drm.c
++++ b/libweston/compositor-drm.c
+@@ -2430,6 +2430,85 @@ drm_output_set_seat(struct weston_output *base,
+ }
+
+ static int
++drm_get_dma_fd_from_view(struct weston_output *base,
++ struct weston_view *ev)
++{
++ struct drm_backend *b = to_drm_backend(base->compositor);
++ struct weston_buffer *buffer = ev->surface->buffer_ref.buffer;
++ struct gbm_bo *bo;
++ struct drm_fb *current;
++ struct linux_dmabuf_buffer *dmabuf;
++ uint32_t format;
++ int fd, ret;
++
++ if(!buffer) {
++ weston_log("buffer is NULL\n");
++ return -1;
++ }
++
++ if(dmabuf = linux_dmabuf_buffer_get(buffer->resource)) {
++ struct gbm_import_fd_data gbm_dmabuf = {
++ .fd = dmabuf->attributes.fd[0],
++ .width = dmabuf->attributes.width,
++ .height = dmabuf->attributes.height,
++ .stride = dmabuf->attributes.stride[0],
++ .format = dmabuf->attributes.format
++ };
++
++ bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_FD,
++ &gbm_dmabuf, GBM_BO_USE_SCANOUT);
++ if (!bo) {
++ weston_log("failed to get gbm_bo\n");
++ return -1;
++ }
++
++ current = zalloc(sizeof *current);
++ current->handle = gbm_bo_get_handle(bo).s32;
++ if (!current->handle) {
++ fprintf(stderr, "failed to get drm_handle\n");
++ return -1;
++ }
++ }
++ else if(ev->surface->buffer_ref.buffer->legacy_buffer) {
++ bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_WL_BUFFER,
++ buffer->resource, GBM_BO_USE_SCANOUT);
++
++ if (!bo) {
++ weston_log("failed to get gbm_bo\n");
++ return -1;
++ }
++
++ format = gbm_bo_get_format(bo);
++ if (!format) {
++ weston_log("failed to get format\n");
++ gbm_bo_destroy(bo);
++ return -1;
++ }
++
++ current = drm_fb_get_from_bo(bo, b, format);
++ if (!current) {
++ weston_log("failed to get drm_fb\n");
++ gbm_bo_destroy(bo);
++ return -1;
++ }
++ }
++ else {
++ weston_log("Buffer is not supported\n");
++ return -1;
++ }
++
++ ret = drmPrimeHandleToFD(b->drm.fd, current->handle,
++ DRM_CLOEXEC, &fd);
++ free(current);
++ if (ret) {
++ weston_log("failed to create prime fd for front buffer\n");
++ return -1;
++ }
++
++ return fd;
++}
++
++static int
+ drm_output_enable(struct weston_output *base)
+ {
+ struct drm_output *output = to_drm_output(base);
+@@ -3199,6 +3278,7 @@ static const struct weston_drm_output_api api = {
+ drm_output_set_mode,
+ drm_output_set_gbm_format,
+ drm_output_set_seat,
++ drm_get_dma_fd_from_view,
+ };
+
+ static struct drm_backend *
+diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h
+index 2e2995a..fe00bd5 100644
+--- a/libweston/compositor-drm.h
++++ b/libweston/compositor-drm.h
+@@ -78,6 +78,13 @@ struct weston_drm_output_api {
+ */
+ void (*set_seat)(struct weston_output *output,
+ const char *seat);
++
++ /** Get the dma fd from drm view.
++ *
++ * The dma fd is got from weston_view.
++ * Returns fd on success, -1 on failure.
++ */
++ int (*get_dma_fd_from_view)(struct weston_output *output, struct weston_view *view);
+ };
+
+ static inline const struct weston_drm_output_api *
+--
+2.7.4
+