summaryrefslogtreecommitdiffstats
path: root/meta-agl-profile-graphical/recipes-graphics/wayland/weston
diff options
context:
space:
mode:
authorVeeresh Kadasani <external.vkadasani@jp.adit-jv.com>2019-07-29 17:29:20 +0900
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-08-05 21:51:30 +0000
commit59f37556d15e7e75a0be2ba6695bc0c3fdd5df64 (patch)
tree68620c8aee6d8c730be391f01e5c3de27c11fbf8 /meta-agl-profile-graphical/recipes-graphics/wayland/weston
parent5d2d2de60ebab140f7006a595c9c7087bddec1df (diff)
Update waltham-transmitter patches to weston 5.0 & 6.0halibut_8.0.0halibut/8.0.08.0.0
Change-Id: Idedada02d63914f247a137d031e44b15bef16134 Signed-off-by: Veeresh Kadasani <external.vkadasani@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/0002-compositor-add-output-type-to-weston_output.patch202
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/weston/0003-compositor-drm-introduce-drm_get_dmafd_from_view.patch103
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/weston/0016-compositor-add-output-type-to-weston_output.patch254
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/weston/0017-compositor-drm-introduce-drm_get_dmafd_from_view.patch (renamed from meta-agl-profile-graphical/recipes-graphics/wayland/weston/0019-compositor-drm-introduce-drm_get_dmafd_from_view.patch)71
-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/0018-compositor-drm-get-stride-from-drm_get_dma_fd_from_view.patch59
6 files changed, 642 insertions, 328 deletions
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0002-compositor-add-output-type-to-weston_output.patch b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0002-compositor-add-output-type-to-weston_output.patch
new file mode 100644
index 000000000..187bea502
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0002-compositor-add-output-type-to-weston_output.patch
@@ -0,0 +1,202 @@
+From e31e63976aab7616319c10ad21c998c3b4c634e6 Mon Sep 17 00:00:00 2001
+From: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
+Date: Tue, 30 Jul 2019 20:22:15 +0900
+Subject: [PATCH 1/2] 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: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
+---
+ libweston/compositor-drm.c | 12 +++++++++++-
+ libweston/compositor-fbdev.c | 2 +-
+ libweston/compositor-headless.c | 2 +-
+ libweston/compositor-rdp.c | 2 +-
+ libweston/compositor-wayland.c | 2 +-
+ libweston/compositor-x11.c | 2 +-
+ libweston/compositor.h | 12 ++++++++++++
+ 7 files changed, 28 insertions(+), 6 deletions(-)
+
+diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
+index c110110..b83459a 100644
+--- a/libweston/compositor-drm.c
++++ b/libweston/compositor-drm.c
+@@ -923,6 +923,7 @@ 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->base.output_type == OUTPUT_DRM)
+ if (output->crtc_id == crtc_id)
+ return output;
+ }
+@@ -939,6 +940,7 @@ drm_head_find_by_connector(struct drm_backend *backend, uint32_t connector_id)
+ wl_list_for_each(base,
+ &backend->compositor->head_list, compositor_link) {
+ head = to_drm_head(base);
++ if(base->output->output_type == OUTPUT_DRM)
+ if (head->connector_id == connector_id)
+ return head;
+ }
+@@ -6159,6 +6161,7 @@ drm_output_enable(struct weston_output *base)
+
+ assert(!output->virtual);
+
++ output->base.output_type = OUTPUT_DRM;
+ resources = drmModeGetResources(b->drm.fd);
+ if (!resources) {
+ weston_log("drmModeGetResources failed\n");
+@@ -6628,6 +6631,7 @@ drm_backend_update_heads(struct drm_backend *b, struct udev_device *drm_device)
+ /* Remove connectors that have disappeared. */
+ wl_list_for_each_safe(base, next,
+ &b->compositor->head_list, compositor_link) {
++ if (base->output->output_type == OUTPUT_DRM) {
+ bool removed = true;
+
+ head = to_drm_head(base);
+@@ -6646,6 +6650,7 @@ drm_backend_update_heads(struct drm_backend *b, struct udev_device *drm_device)
+ head->base.name, head->connector_id);
+ drm_head_destroy(head);
+ }
++ }
+
+ drm_backend_update_unused_outputs(b, resources);
+
+@@ -6751,12 +6756,14 @@ session_notify(struct wl_listener *listener, void *data)
+ * pending frame callbacks. */
+
+ wl_list_for_each(output, &compositor->output_list, base.link) {
++ if(output->base.output_type == OUTPUT_DRM) {
+ output->base.repaint_needed = false;
+ if (output->cursor_plane)
+ 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);
+
+@@ -6768,6 +6775,7 @@ session_notify(struct wl_listener *listener, void *data)
+ plane->plane_id,
+ output->crtc_id, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0);
++ }
+ }
+ }
+ }
+@@ -7094,6 +7102,7 @@ switch_to_gl_renderer(struct drm_backend *b)
+ }
+
+ wl_list_for_each(output, &b->compositor->output_list, base.link)
++ if(output->base.output_type == OUTPUT_DRM)
+ pixman_renderer_output_destroy(&output->base);
+
+ b->compositor->renderer->destroy(b->compositor);
+@@ -7106,6 +7115,7 @@ switch_to_gl_renderer(struct drm_backend *b)
+ }
+
+ wl_list_for_each(output, &b->compositor->output_list, base.link)
++ 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 6031be5..97002e6 100644
+--- a/libweston/compositor-fbdev.c
++++ b/libweston/compositor-fbdev.c
+@@ -526,7 +526,7 @@ fbdev_output_enable(struct weston_output *base)
+ struct fbdev_head *head;
+ int fb_fd;
+ struct wl_event_loop *loop;
+-
++ output->base.output_type = OUTPUT_FBDEV;
+ head = fbdev_output_get_head(output);
+
+ /* Create the frame buffer. */
+diff --git a/libweston/compositor-headless.c b/libweston/compositor-headless.c
+index 5a0e46c..20b78b2 100644
+--- a/libweston/compositor-headless.c
++++ b/libweston/compositor-headless.c
+@@ -160,7 +160,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 *
+ output->base.current_mode->height * 4);
+diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c
+index 871a0a3..b3064dd 100644
+--- a/libweston/compositor-rdp.c
++++ b/libweston/compositor-rdp.c
+@@ -554,7 +554,7 @@ rdp_output_enable(struct weston_output *base)
+ struct rdp_output *output = to_rdp_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 e1485ca..75140b2 100644
+--- a/libweston/compositor-wayland.c
++++ b/libweston/compositor-wayland.c
+@@ -1221,7 +1221,7 @@ wayland_output_enable(struct weston_output *base)
+ struct wayland_backend *b = to_wayland_backend(base->compositor);
+ enum mode_status mode_status;
+ 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 922e3c8..8c20626 100644
+--- a/libweston/compositor-x11.c
++++ b/libweston/compositor-x11.c
+@@ -934,7 +934,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] |=
+ XCB_EVENT_MASK_KEY_PRESS |
+diff --git a/libweston/compositor.h b/libweston/compositor.h
+index a5223c2..040917b 100644
+--- a/libweston/compositor.h
++++ b/libweston/compositor.h
+@@ -169,6 +169,17 @@ 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
++};
++
+ /** Represents a monitor
+ *
+ * This object represents a monitor (hardware backends like DRM) or a window
+@@ -202,6 +213,7 @@ struct weston_head {
+ struct weston_output {
+ uint32_t id;
+ char *name;
++ enum output_type output_type;
+
+ /** Matches the lifetime from the user perspective */
+ struct wl_signal user_destroy_signal;
+--
+2.7.4
+
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0003-compositor-drm-introduce-drm_get_dmafd_from_view.patch b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0003-compositor-drm-introduce-drm_get_dmafd_from_view.patch
new file mode 100644
index 000000000..f67f1c07a
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0003-compositor-drm-introduce-drm_get_dmafd_from_view.patch
@@ -0,0 +1,103 @@
+From 6bed527fe0a4101ef214abaf2cd82609b6c510e4 Mon Sep 17 00:00:00 2001
+From: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
+Date: Tue, 30 Jul 2019 20:25:34 +0900
+Subject: [PATCH 2/2] compositor-drm: introduce drm_get_dmafd_from_view
+
+This API enables to get dmafd from weston_view
+
+Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
+---
+ libweston/compositor-drm.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++
+ libweston/compositor-drm.h | 7 ++++++
+ 2 files changed, 65 insertions(+)
+
+diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
+index b83459a..5cabfb5 100644
+--- a/libweston/compositor-drm.c
++++ b/libweston/compositor-drm.c
+@@ -5849,6 +5849,64 @@ drm_output_set_seat(struct weston_output *base,
+ }
+
+ static int
++drm_get_dma_fd_from_view(struct weston_output *base,
++ struct weston_view *ev, int *buf_stride)
++{
++ 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;
++ bool is_opaque = drm_view_is_opaque(ev);
++ uint32_t format;
++ int fd, ret;
++
++ if(!buffer) {
++ weston_log("buffer is NULL\n");
++ return -1;
++ }
++
++ if(dmabuf = linux_dmabuf_buffer_get(buffer->resource)) {
++ current = drm_fb_get_from_dmabuf(dmabuf, b, is_opaque);
++ if (!current)
++ {
++ fprintf(stderr, "failed to get drm_fb from dmabuf\n");
++ return -1;
++ }
++ *buf_stride=current->strides[0];
++ }
++ 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;
++ }
++ current = drm_fb_get_from_bo(bo, b, is_opaque, BUFFER_CLIENT);
++
++ if (!current) {
++ weston_log("failed to get drm_fb from bo\n");
++ return -1;
++ }
++ *buf_stride=current->strides[0];
++ }
++ else {
++ weston_log("Buffer is not supported\n");
++ return -1;
++ }
++
++ ret = drmPrimeHandleToFD(b->drm.fd, current->handles[0],
++ 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_init_gamma_size(struct drm_output *output)
+ {
+ struct drm_backend *backend = to_drm_backend(output->base.compositor);
+diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h
+index 71a306f..4f985d3 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, int *buf_stride);
+ };
+
+ static inline const struct weston_drm_output_api *
+--
+2.7.4
+
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0016-compositor-add-output-type-to-weston_output.patch b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0016-compositor-add-output-type-to-weston_output.patch
new file mode 100644
index 000000000..6b93b06e8
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0016-compositor-add-output-type-to-weston_output.patch
@@ -0,0 +1,254 @@
+From 8ea60075d5310101bebedf09c94902e9d41432ac Mon Sep 17 00:00:00 2001
+From: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
+Date: Mon, 29 Jul 2019 17:04:12 +0900
+Subject: [PATCH 1/3] 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: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
+---
+ libweston/compositor-drm.c | 78 +++++++++++++++++++++++------------------
+ libweston/compositor-fbdev.c | 2 +-
+ libweston/compositor-headless.c | 2 +-
+ libweston/compositor-rdp.c | 2 +-
+ libweston/compositor-wayland.c | 2 +-
+ libweston/compositor-x11.c | 2 +-
+ libweston/compositor.h | 12 ++++++-
+ 7 files changed, 60 insertions(+), 40 deletions(-)
+
+diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
+index 3891176..26a480c 100644
+--- a/libweston/compositor-drm.c
++++ b/libweston/compositor-drm.c
+@@ -843,8 +843,9 @@ 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;
+ }
+
+ return NULL;
+@@ -859,7 +860,8 @@ drm_head_find_by_connector(struct drm_backend *backend, uint32_t connector_id)
+ wl_list_for_each(base,
+ &backend->compositor->head_list, compositor_link) {
+ head = to_drm_head(base);
+- if (head->connector_id == connector_id)
++ if(base->output->output_type == OUTPUT_DRM)
++ if (head->connector_id == connector_id)
+ return head;
+ }
+
+@@ -5728,6 +5730,7 @@ drm_output_enable(struct weston_output *base)
+ drmModeRes *resources;
+ int ret;
+
++ output->base.output_type = OUTPUT_DRM;
+ resources = drmModeGetResources(b->drm.fd);
+ if (!resources) {
+ weston_log("drmModeGetResources failed\n");
+@@ -6188,23 +6191,25 @@ drm_backend_update_heads(struct drm_backend *b, struct udev_device *drm_device)
+ /* Remove connectors that have disappeared. */
+ wl_list_for_each_safe(base, next,
+ &b->compositor->head_list, compositor_link) {
+- bool removed = true;
++ if (base->output->output_type == OUTPUT_DRM) {
++ bool removed = true;
+
+- head = to_drm_head(base);
++ head = to_drm_head(base);
+
+- for (i = 0; i < resources->count_connectors; i++) {
+- if (resources->connectors[i] == head->connector_id) {
+- removed = false;
+- break;
+- }
+- }
++ for (i = 0; i < resources->count_connectors; i++) {
++ if (resources->connectors[i] == head->connector_id) {
++ removed = false;
++ break;
++ }
++ }
+
+- if (!removed)
+- continue;
++ if (!removed)
++ continue;
+
+- weston_log("DRM: head '%s' (connector %d) disappeared.\n",
+- head->base.name, head->connector_id);
+- drm_head_destroy(head);
++ weston_log("DRM: head '%s' (connector %d) disappeared.\n",
++ head->base.name, head->connector_id);
++ drm_head_destroy(head);
++ }
+ }
+
+ drm_backend_update_unused_outputs(b, resources);
+@@ -6309,23 +6314,26 @@ 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 = false;
+- if (output->cursor_plane)
+- drmModeSetCursor(b->drm.fd, output->crtc_id,
+- 0, 0, 0);
++ if(output->base.output_type == OUTPUT_DRM) {
++ output->base.repaint_needed = false;
++ if (output->cursor_plane)
++ drmModeSetCursor(b->drm.fd, output->crtc_id,
++ 0, 0, 0);
++ }
+ }
+-
+- output = container_of(compositor->output_list.next,
+- struct drm_output, base.link);
+-
+- wl_list_for_each(plane, &b->plane_list, link) {
+- if (plane->type != WDRM_PLANE_TYPE_OVERLAY)
+- continue;
+-
+- drmModeSetPlane(b->drm.fd,
+- plane->plane_id,
+- output->crtc_id, 0, 0,
+- 0, 0, 0, 0, 0, 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(plane, &b->plane_list, link) {
++ if (plane->type != WDRM_PLANE_TYPE_OVERLAY)
++ continue;
++
++ drmModeSetPlane(b->drm.fd,
++ plane->plane_id,
++ output->crtc_id, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0);
++ }
+ }
+ }
+ }
+@@ -6649,7 +6657,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);
+
+@@ -6661,7 +6670,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 a71b7bd..8edb50b 100644
+--- a/libweston/compositor-fbdev.c
++++ b/libweston/compositor-fbdev.c
+@@ -501,7 +501,7 @@ fbdev_output_enable(struct weston_output *base)
+ struct fbdev_head *head;
+ int fb_fd;
+ struct wl_event_loop *loop;
+-
++ output->base.output_type = OUTPUT_FBDEV;
+ head = fbdev_output_get_head(output);
+
+ /* Create the frame buffer. */
+diff --git a/libweston/compositor-headless.c b/libweston/compositor-headless.c
+index 61a5bd9..f633cd7 100644
+--- a/libweston/compositor-headless.c
++++ b/libweston/compositor-headless.c
+@@ -159,7 +159,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 *
+ output->base.current_mode->height * 4);
+diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c
+index 134e729..429370c 100644
+--- a/libweston/compositor-rdp.c
++++ b/libweston/compositor-rdp.c
+@@ -554,7 +554,7 @@ rdp_output_enable(struct weston_output *base)
+ struct rdp_output *output = to_rdp_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 e80ecc1..808fc8f 100644
+--- a/libweston/compositor-wayland.c
++++ b/libweston/compositor-wayland.c
+@@ -1221,7 +1221,7 @@ wayland_output_enable(struct weston_output *base)
+ struct wayland_backend *b = to_wayland_backend(base->compositor);
+ enum mode_status mode_status;
+ 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 4a9d068..afbaa73 100644
+--- a/libweston/compositor-x11.c
++++ b/libweston/compositor-x11.c
+@@ -933,7 +933,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] |=
+ XCB_EVENT_MASK_KEY_PRESS |
+diff --git a/libweston/compositor.h b/libweston/compositor.h
+index 8b7a102..60feda3 100644
+--- a/libweston/compositor.h
++++ b/libweston/compositor.h
+@@ -169,6 +169,16 @@ 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
++};
+ /** Represents a monitor
+ *
+ * This object represents a monitor (hardware backends like DRM) or a window
+@@ -201,7 +211,7 @@ struct weston_head {
+ struct weston_output {
+ uint32_t id;
+ char *name;
+-
++ enum output_type output_type;
+ /** Matches the lifetime from the user perspective */
+ struct wl_signal user_destroy_signal;
+
+--
+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/0017-compositor-drm-introduce-drm_get_dmafd_from_view.patch
index bec90c75d..6fb963fb1 100644
--- 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/0017-compositor-drm-introduce-drm_get_dmafd_from_view.patch
@@ -1,21 +1,21 @@
-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
+From 020508b35b2bf6c89d62961eb95e2f81d6381ab5 Mon Sep 17 00:00:00 2001
+From: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
+Date: Mon, 29 Jul 2019 17:07:00 +0900
+Subject: [PATCH 2/3] 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>
+Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
---
- libweston/compositor-drm.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++
- libweston/compositor-drm.h | 7 ++++
- 2 files changed, 87 insertions(+)
+ libweston/compositor-drm.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++
+ libweston/compositor-drm.h | 7 ++++++
+ 2 files changed, 64 insertions(+)
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
-index 0b5b4c4..77f2ece 100644
+index 26a480c..2b99db5 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
-@@ -2430,6 +2430,85 @@ drm_output_set_seat(struct weston_output *base,
+@@ -5420,6 +5420,62 @@ drm_output_set_seat(struct weston_output *base,
}
static int
@@ -27,6 +27,7 @@ index 0b5b4c4..77f2ece 100644
+ struct gbm_bo *bo;
+ struct drm_fb *current;
+ struct linux_dmabuf_buffer *dmabuf;
++ bool is_opaque = drm_view_is_opaque(ev);
+ uint32_t format;
+ int fd, ret;
+
@@ -36,57 +37,34 @@ index 0b5b4c4..77f2ece 100644
+ }
+
+ 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");
++ current = drm_fb_get_from_dmabuf(dmabuf, b, is_opaque);
++ if (!current)
++ {
++ fprintf(stderr, "failed to get drm_fb from dmabuf\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;
+ }
++ current = drm_fb_get_from_bo(bo, b, is_opaque, BUFFER_CLIENT);
+
-+ 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);
++ weston_log("failed to get drm_fb from bo\n");
+ return -1;
+ }
++
+ }
+ else {
+ weston_log("Buffer is not supported\n");
+ return -1;
+ }
+
-+ ret = drmPrimeHandleToFD(b->drm.fd, current->handle,
++ ret = drmPrimeHandleToFD(b->drm.fd, current->handles[0],
+ DRM_CLOEXEC, &fd);
+ free(current);
+ if (ret) {
@@ -96,12 +74,11 @@ index 0b5b4c4..77f2ece 100644
+
+ return fd;
+}
-+
+static int
- drm_output_enable(struct weston_output *base)
+ drm_output_init_gamma_size(struct drm_output *output)
{
- struct drm_output *output = to_drm_output(base);
-@@ -3199,6 +3278,7 @@ static const struct weston_drm_output_api api = {
+ struct drm_backend *backend = to_drm_backend(output->base.compositor);
+@@ -6696,6 +6752,7 @@ static const struct weston_drm_output_api api = {
drm_output_set_mode,
drm_output_set_gbm_format,
drm_output_set_seat,
@@ -110,7 +87,7 @@ index 0b5b4c4..77f2ece 100644
static struct drm_backend *
diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h
-index 2e2995a..fe00bd5 100644
+index 9c37c15..a82a2a9 100644
--- a/libweston/compositor-drm.h
+++ b/libweston/compositor-drm.h
@@ -78,6 +78,13 @@ struct weston_drm_output_api {
@@ -118,7 +95,7 @@ index 2e2995a..fe00bd5 100644
void (*set_seat)(struct weston_output *output,
const char *seat);
+
-+ /** Get the dma fd from drm view.
++ /** Get the dma fd from drm view.
+ *
+ * The dma fd is got from weston_view.
+ * Returns fd on success, -1 on failure.
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
deleted file mode 100644
index 4c46ec4ec..000000000
--- a/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0018-compositor-add-output-type-to-weston_output.patch
+++ /dev/null
@@ -1,281 +0,0 @@
-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/0018-compositor-drm-get-stride-from-drm_get_dma_fd_from_view.patch b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0018-compositor-drm-get-stride-from-drm_get_dma_fd_from_view.patch
new file mode 100644
index 000000000..e2655d120
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston/0018-compositor-drm-get-stride-from-drm_get_dma_fd_from_view.patch
@@ -0,0 +1,59 @@
+From 0dac780379228396a19048544b9e53d5aa407583 Mon Sep 17 00:00:00 2001
+From: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
+Date: Mon, 29 Jul 2019 17:08:31 +0900
+Subject: [PATCH 3/3] compositor-drm: get stride from drm_get_dma_fd_from_view
+
+Modify drm_get_dma_fd_from_view to get buffer stride.
+
+Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
+---
+ libweston/compositor-drm.c | 5 +++--
+ libweston/compositor-drm.h | 2 +-
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
+index 2b99db5..ec2765f 100644
+--- a/libweston/compositor-drm.c
++++ b/libweston/compositor-drm.c
+@@ -5421,7 +5421,7 @@ 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 weston_view *ev, int *buf_stride)
+ {
+ struct drm_backend *b = to_drm_backend(base->compositor);
+ struct weston_buffer *buffer = ev->surface->buffer_ref.buffer;
+@@ -5444,6 +5444,7 @@ drm_get_dma_fd_from_view(struct weston_output *base,
+ fprintf(stderr, "failed to get drm_fb from dmabuf\n");
+ return -1;
+ }
++ *buf_stride=current->strides[0];
+ }
+ else if(ev->surface->buffer_ref.buffer->legacy_buffer) {
+ bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_WL_BUFFER,
+@@ -5458,7 +5459,7 @@ drm_get_dma_fd_from_view(struct weston_output *base,
+ weston_log("failed to get drm_fb from bo\n");
+ return -1;
+ }
+-
++ *buf_stride=current->strides[0];
+ }
+ else {
+ weston_log("Buffer is not supported\n");
+diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h
+index a82a2a9..c2461b3 100644
+--- a/libweston/compositor-drm.h
++++ b/libweston/compositor-drm.h
+@@ -84,7 +84,7 @@ struct weston_drm_output_api {
+ * 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);
++ int (*get_dma_fd_from_view)(struct weston_output *output, struct weston_view *view, int *buf_stride);
+ };
+
+ static inline const struct weston_drm_output_api *
+--
+2.7.4
+