aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-bsp/meta-freescale-layer
diff options
context:
space:
mode:
authorMihail Grigorov <michael.grigorov@konsulko.com>2017-10-13 11:24:56 +0300
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-10-14 13:51:44 +0000
commitf1d3961d6c86983fab125897c2db8892100d2c12 (patch)
tree15b395b3ba8a215843a15aeb6a6130482eff2ab9 /meta-agl-bsp/meta-freescale-layer
parent6195e19a0925c6cefdf00e4b4d1b9f4f93d10030 (diff)
meta-agl-bsp: imx6: Add EGL support for iMX6 in Weston 2.0
In Weston 2.0, the EGL support was dropped from the fbdev-backend, as that was not the correct way to initialize EGL. However, the vendor support patches in Weston 1.11 still require that functionality. Restore the EGL support in the fbdev-backend, until the issue is resolved, by either adding a standalone backend, or switching to etnaviv. Bug-AGL: SPEC-905 Change-Id: I9fc00e35c2eefee07998053e1fccec6265ac3b9e Signed-off-by: Mihail Grigorov <michael.grigorov@konsulko.com> Signed-off-by: Georgi Vlaev <georgi.vlaev@konsulko.com> Reviewed-on: https://gerrit.automotivelinux.org/gerrit/11305 Reviewed-by: Leon Anavi <leon.anavi@konsulko.com> Reviewed-by: Thomas Rini <trini@konsulko.com> Reviewed-by: Matt Porter <mporter@konsulko.com> Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'meta-agl-bsp/meta-freescale-layer')
-rw-r--r--meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0001-libweston-Restore-EGL-support-for-the-fbdev-backend.patch250
-rw-r--r--meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0002-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-2.0.patch87
-rw-r--r--meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0006-Link-compositor-to-egl.patch12
-rw-r--r--meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-init.bbappend1
-rw-r--r--meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston_2.0.0.bbappend38
5 files changed, 388 insertions, 0 deletions
diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0001-libweston-Restore-EGL-support-for-the-fbdev-backend.patch b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0001-libweston-Restore-EGL-support-for-the-fbdev-backend.patch
new file mode 100644
index 000000000..77bf2c5cb
--- /dev/null
+++ b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0001-libweston-Restore-EGL-support-for-the-fbdev-backend.patch
@@ -0,0 +1,250 @@
+From c43b64cad0fdc55594434a68faa25447b50ca7c5 Mon Sep 17 00:00:00 2001
+From: Georgi Vlaev <georgi.vlaev@konsulko.com>
+Date: Wed, 27 Sep 2017 14:00:50 +0300
+Subject: [PATCH 1/5] libweston: Restore EGL support for the fbdev backend
+
+In Weston 2.0, the EGL support was dropped from the fbdev-backend,
+as that was not the correct way to initialize the EGL in first
+place. However, the vendor support patches in Weston 1.11 still
+require that functionality. Teporary restore the EGL support in
+the fbdev-backend, until a separate vendor backend is available,
+or switch to using etnaviv.
+
+Signed-off-by: Georgi Vlaev <georgi.vlaev@konsulko.com>
+---
+ compositor/main.c | 2 +
+ libweston/compositor-fbdev.c | 99 +++++++++++++++++++++++++++++++++++++-------
+ libweston/compositor-fbdev.h | 1 +
+ 3 files changed, 87 insertions(+), 15 deletions(-)
+
+diff --git a/compositor/main.c b/compositor/main.c
+index 72c3cd10..6c45a018 100644
+--- a/compositor/main.c
++++ b/compositor/main.c
+@@ -574,6 +574,7 @@ usage(int error_code)
+ "Options for fbdev-backend.so:\n\n"
+ " --tty=TTY\t\tThe tty to use\n"
+ " --device=DEVICE\tThe framebuffer device to use\n"
++ " --use-gl\t\tUse the GL renderer\n"
+ "\n");
+ #endif
+
+@@ -1444,6 +1445,7 @@ load_fbdev_backend(struct weston_compositor *c,
+ const struct weston_option fbdev_options[] = {
+ { WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
+ { WESTON_OPTION_STRING, "device", 0, &config.device },
++ { WESTON_OPTION_BOOLEAN, "use-gl", 0, &config.use_gl },
+ };
+
+ parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
+diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
+index 44f0cf51..4ca53b67 100644
+--- a/libweston/compositor-fbdev.c
++++ b/libweston/compositor-fbdev.c
+@@ -49,6 +49,7 @@
+ #include "launcher-util.h"
+ #include "pixman-renderer.h"
+ #include "libinput-seat.h"
++#include "gl-renderer.h"
+ #include "presentation-time-server-protocol.h"
+
+ struct fbdev_backend {
+@@ -58,6 +59,7 @@ struct fbdev_backend {
+
+ struct udev *udev;
+ struct udev_input input;
++ int use_pixman;
+ uint32_t output_transform;
+ struct wl_listener session_listener;
+ };
+@@ -94,6 +96,8 @@ struct fbdev_output {
+ uint8_t depth;
+ };
+
++struct gl_renderer_interface *gl_renderer;
++
+ static const char default_seat[] = "seat0";
+
+ static inline struct fbdev_output *
+@@ -117,8 +121,8 @@ fbdev_output_start_repaint_loop(struct weston_output *output)
+ weston_output_finish_frame(output, &ts, WP_PRESENTATION_FEEDBACK_INVALID);
+ }
+
+-static int
+-fbdev_output_repaint(struct weston_output *base, pixman_region32_t *damage)
++static void
++fbdev_output_repaint_pixman(struct weston_output *base, pixman_region32_t *damage)
+ {
+ struct fbdev_output *output = to_fbdev_output(base);
+ struct weston_compositor *ec = output->base.compositor;
+@@ -140,6 +144,26 @@ fbdev_output_repaint(struct weston_output *base, pixman_region32_t *damage)
+ * refresh rate is given in mHz and the interval in ms. */
+ wl_event_source_timer_update(output->finish_frame_timer,
+ 1000000 / output->mode.refresh);
++}
++
++static int
++fbdev_output_repaint(struct weston_output *base, pixman_region32_t *damage)
++{
++ struct fbdev_output *output = to_fbdev_output(base);
++ struct fbdev_backend *backend = output->backend;
++ struct weston_compositor *ec = backend->compositor;
++
++ if (backend->use_pixman) {
++ fbdev_output_repaint_pixman(base,damage);
++ } else {
++ ec->renderer->repaint_output(base, damage);
++ /* Update the damage region. */
++ pixman_region32_subtract(&ec->primary_plane.damage,
++ &ec->primary_plane.damage, damage);
++
++ wl_event_source_timer_update(output->finish_frame_timer,
++ 1000000 / output->mode.refresh);
++ }
+
+ return 0;
+ }
+@@ -440,16 +464,30 @@ fbdev_output_enable(struct weston_output *base)
+ return -1;
+ }
+
+- if (fbdev_frame_buffer_map(output, fb_fd) < 0) {
+- weston_log("Mapping frame buffer failed.\n");
+- return -1;
+- }
++ if (backend->use_pixman) {
++ if (fbdev_frame_buffer_map(output, fb_fd) < 0) {
++ weston_log("Mapping frame buffer failed.\n");
++ return -1;
++ }
++ } else
++ close(fb_fd);
+
+ output->base.start_repaint_loop = fbdev_output_start_repaint_loop;
+ output->base.repaint = fbdev_output_repaint;
+
+- if (pixman_renderer_output_create(&output->base) < 0)
+- goto out_hw_surface;
++ if (backend->use_pixman) {
++ if (pixman_renderer_output_create(&output->base) < 0)
++ goto out_hw_surface;
++ } else {
++ setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
++ if (gl_renderer->output_window_create(&output->base,
++ (EGLNativeWindowType)NULL, NULL,
++ gl_renderer->opaque_attribs,
++ NULL, 0) < 0) {
++ weston_log("gl_renderer_output_create failed.\n");
++ goto out_hw_surface;
++ }
++ }
+
+ loop = wl_display_get_event_loop(backend->compositor->wl_display);
+ output->finish_frame_timer =
+@@ -534,14 +572,19 @@ static void
+ fbdev_output_destroy(struct weston_output *base)
+ {
+ struct fbdev_output *output = to_fbdev_output(base);
++ struct fbdev_backend *backend = output->backend;
+
+ weston_log("Destroying fbdev output.\n");
+
+ /* Close the frame buffer. */
+ fbdev_output_disable(base);
+
+- if (base->renderer_state != NULL)
+- pixman_renderer_output_destroy(base);
++ if (backend->use_pixman) {
++ if (base->renderer_state != NULL)
++ pixman_renderer_output_destroy(base);
++ } else {
++ gl_renderer->output_destroy(base);
++ }
+
+ /* Remove the output. */
+ weston_output_destroy(&output->base);
+@@ -610,9 +653,11 @@ fbdev_output_reenable(struct fbdev_backend *backend,
+ }
+
+ /* Map the device if it has the same details as before. */
+- if (fbdev_frame_buffer_map(output, fb_fd) < 0) {
+- weston_log("Mapping frame buffer failed.\n");
+- goto err;
++ if (backend->use_pixman) {
++ if (fbdev_frame_buffer_map(output, fb_fd) < 0) {
++ weston_log("Mapping frame buffer failed.\n");
++ goto err;
++ }
+ }
+
+ return 0;
+@@ -628,9 +673,13 @@ static void
+ fbdev_output_disable(struct weston_output *base)
+ {
+ struct fbdev_output *output = to_fbdev_output(base);
++ struct fbdev_backend *backend = output->backend;
+
+ weston_log("Disabling fbdev output.\n");
+
++ if (!backend->use_pixman)
++ return;
++
+ if (output->hw_surface != NULL) {
+ pixman_image_unref(output->hw_surface);
+ output->hw_surface = NULL;
+@@ -744,11 +793,30 @@ fbdev_backend_create(struct weston_compositor *compositor,
+ backend->base.restore = fbdev_restore;
+
+ backend->prev_state = WESTON_COMPOSITOR_ACTIVE;
++ backend->use_pixman = !param->use_gl;
+
+ weston_setup_vt_switch_bindings(compositor);
+
+- if (pixman_renderer_init(compositor) < 0)
+- goto out_launcher;
++ if (backend->use_pixman) {
++ if (pixman_renderer_init(compositor) < 0)
++ goto out_launcher;
++ } else {
++ gl_renderer = weston_load_module("gl-renderer.so",
++ "gl_renderer_interface");
++ if (!gl_renderer) {
++ weston_log("could not load gl renderer\n");
++ goto out_launcher;
++ }
++
++ if (gl_renderer->display_create(compositor, NO_EGL_PLATFORM,
++ EGL_DEFAULT_DISPLAY,
++ NULL,
++ gl_renderer->opaque_attribs,
++ NULL, 0) < 0) {
++ weston_log("gl_renderer_create failed.\n");
++ goto out_launcher;
++ }
++ }
+
+ if (fbdev_output_create(backend, param->device) < 0)
+ goto out_launcher;
+@@ -779,6 +847,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config *config)
+ * udev, rather than passing a device node in as a parameter. */
+ config->tty = 0; /* default to current tty */
+ config->device = "/dev/fb0"; /* default frame buffer */
++ config->use_gl = 0;
+ }
+
+ WL_EXPORT int
+diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
+index 8b7d900e..806712f9 100644
+--- a/libweston/compositor-fbdev.h
++++ b/libweston/compositor-fbdev.h
+@@ -43,6 +43,7 @@ struct weston_fbdev_backend_config {
+
+ int tty;
+ char *device;
++ int use_gl;
+
+ /** Callback used to configure input devices.
+ *
+--
+2.11.0
+
diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0002-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-2.0.patch b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0002-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-2.0.patch
new file mode 100644
index 000000000..2eca746a9
--- /dev/null
+++ b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0002-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-2.0.patch
@@ -0,0 +1,87 @@
+From ca6720b1c19f1581112e6ee371dff6d06aeae569 Mon Sep 17 00:00:00 2001
+From: Meng Mingming <mingming.meng@nxp.com>
+Date: Mon, 9 Jan 2017 15:04:27 +0800
+Subject: [PATCH 2/5] MGS-2352 [#ccc] Add GPU-VIV support for weston 2.0
+
+Add GPU-VIV support for weston 2.0
+
+Upstream Status: Inappropriate [i.MX specific]
+
+Date: Jan 09, 2017
+
+* Weston 2.0
+This requires re-enabling the EGL initialization support
+in the fbdev-backend.
+
+Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
+Signed-off-by: Georgi Vlaev <georgi.vlaev@konsulko.com>
+---
+ libweston/compositor-fbdev.c | 22 ++++++++++++++++++++--
+ 1 file changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
+index 4ca53b67..f87fccac 100644
+--- a/libweston/compositor-fbdev.c
++++ b/libweston/compositor-fbdev.c
+@@ -62,6 +62,7 @@ struct fbdev_backend {
+ int use_pixman;
+ uint32_t output_transform;
+ struct wl_listener session_listener;
++ NativeDisplayType display;
+ };
+
+ struct fbdev_screeninfo {
+@@ -94,6 +95,9 @@ struct fbdev_output {
+ /* pixman details. */
+ pixman_image_t *hw_surface;
+ uint8_t depth;
++
++ NativeDisplayType display;
++ NativeWindowType window;
+ };
+
+ struct gl_renderer_interface *gl_renderer;
+@@ -444,6 +448,10 @@ fbdev_frame_buffer_destroy(struct fbdev_output *output)
+ strerror(errno));
+
+ output->fb = NULL;
++ if(output->window)
++ fbDestroyWindow(output->window);
++ if(output->display)
++ fbDestroyDisplay(output->display);
+ }
+
+ static void fbdev_output_destroy(struct weston_output *base);
+@@ -480,8 +488,13 @@ fbdev_output_enable(struct weston_output *base)
+ goto out_hw_surface;
+ } else {
+ setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
++ output->window = fbCreateWindow(backend->display, -1, -1, 0, 0);
++ if (output->window == NULL) {
++ fprintf(stderr, "failed to create window\n");
++ return 0;
++ }
+ if (gl_renderer->output_window_create(&output->base,
+- (EGLNativeWindowType)NULL, NULL,
++ (EGLNativeWindowType)output->window, NULL,
+ gl_renderer->opaque_attribs,
+ NULL, 0) < 0) {
+ weston_log("gl_renderer_output_create failed.\n");
+@@ -808,8 +821,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
+ goto out_launcher;
+ }
+
++ backend->display = fbGetDisplay(backend->compositor->wl_display);
++ if (backend->display == NULL) {
++ weston_log("fbGetDisplay failed.\n");
++ goto out_launcher;
++ }
+ if (gl_renderer->display_create(compositor, NO_EGL_PLATFORM,
+- EGL_DEFAULT_DISPLAY,
++ backend->display,
+ NULL,
+ gl_renderer->opaque_attribs,
+ NULL, 0) < 0) {
+--
+2.11.0
+
diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0006-Link-compositor-to-egl.patch b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0006-Link-compositor-to-egl.patch
new file mode 100644
index 000000000..3cad74fd4
--- /dev/null
+++ b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-2.0.0/0006-Link-compositor-to-egl.patch
@@ -0,0 +1,12 @@
+Index: weston-1.11.1/configure.ac
+===================================================================
+--- weston-1.11.1.orig/configure.ac 2016-11-08 17:26:14.266564760 -0600
++++ weston-1.11.1/configure.ac 2016-11-09 19:38:58.000000000 -0600
+@@ -93,6 +93,7 @@
+ PKG_CHECK_MODULES(EGL, [egl glesv2])
+ PKG_CHECK_MODULES([EGL_TESTS], [egl glesv2 wayland-client wayland-egl])
+ PKG_CHECK_MODULES([GL_RENDERER], [libdrm])
++ COMPOSITOR_MODULES="$COMPOSITOR_MODULES egl"
+ fi
+
+ AC_ARG_ENABLE(xkbcommon,
diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-init.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-init.bbappend
new file mode 100644
index 000000000..2e1c950ec
--- /dev/null
+++ b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-init.bbappend
@@ -0,0 +1 @@
+WESTONARGS_append_imxgpu3d = " --use-gl"
diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston_2.0.0.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston_2.0.0.bbappend
new file mode 100644
index 000000000..683219968
--- /dev/null
+++ b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston_2.0.0.bbappend
@@ -0,0 +1,38 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/weston-2.0.0:"
+
+SRC_URI_append_imxgpu3d = " \
+ file://0001-libweston-Restore-EGL-support-for-the-fbdev-backend.patch \
+ file://0002-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-2.0.patch \
+ file://0006-Link-compositor-to-egl.patch \
+"
+
+# The 'egl' configuration of weston requires gles support, and consideration
+# must be taken for the different SoC capabilities:
+# - For SoCs with 3d support, imx-gpu-viv provides hardware-accelerated
+# egl and gles, so weston egl configuration is enabled.
+# - For SoCs with VG2D, like i.MX 6SoloLite, imx-gpu-viv provides
+# hardware-accelerated egl but does not provide a compatible software
+# version of gles, so weston egl configuration is disabled.
+# - For SoCs with no GPU, mesa provides software implementations of egl
+# and gles, so weston egl configuration is enabled.
+PACKAGECONFIG_IMX_TO_APPEND = ""
+PACKAGECONFIG_IMX_TO_APPEND_imxgpu3d = "cairo-glesv2"
+PACKAGECONFIG_IMX_TO_REMOVE = ""
+PACKAGECONFIG_IMX_TO_REMOVE_imxgpu2d = "egl"
+PACKAGECONFIG_IMX_TO_REMOVE_imxgpu3d = ""
+
+PACKAGECONFIG_append = " ${PACKAGECONFIG_IMX_TO_APPEND}"
+PACKAGECONFIG_remove = " ${PACKAGECONFIG_IMX_TO_REMOVE}"
+
+EXTRA_OECONF_IMX_COMMON = " \
+ --disable-libunwind \
+ --disable-xwayland-test \
+ WESTON_NATIVE_BACKEND=fbdev-backend.so \
+"
+EXTRA_OECONF_IMX = ""
+EXTRA_OECONF_IMX_imxpxp = "${EXTRA_OECONF_IMX_COMMON}"
+EXTRA_OECONF_IMX_imxgpu2d = "${EXTRA_OECONF_IMX_COMMON}"
+
+EXTRA_OECONF_append = " ${EXTRA_OECONF_IMX}"
+
+PACKAGE_ARCH = "${MACHINE_SOCARCH}"