]> code.ossystems Code Review - meta-freescale.git/commitdiff
xserver-xorg: Enable glamor for i.MX 8
authorTom Hochstein <tom.hochstein@nxp.com>
Wed, 31 Mar 2021 13:46:26 +0000 (08:46 -0500)
committerOtavio Salvador <otavio@ossystems.com.br>
Tue, 13 Apr 2021 20:30:43 +0000 (17:30 -0300)
Enable glamor (the default) so legacy x11 apps will get GPU
acceleration.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
recipes-graphics/xorg-xserver/xserver-xorg/0001-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch [new file with mode: 0644]
recipes-graphics/xorg-xserver/xserver-xorg/0001-glamor-glamor_egl.c-EGL_NATIVE_PIXMAP_KHR-do-not-req.patch [new file with mode: 0644]
recipes-graphics/xorg-xserver/xserver-xorg/0001-prefer-to-use-GLES2-for-glamor-EGL-config.patch [new file with mode: 0644]
recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend

diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0001-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0001-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch
new file mode 100644 (file)
index 0000000..6f23258
--- /dev/null
@@ -0,0 +1,30 @@
+From ed3c55fa6260ad125a32f9ac67f9e44a9bce7cf1 Mon Sep 17 00:00:00 2001
+From: Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
+Date: Mon, 11 May 2020 19:12:51 -0500
+Subject: [PATCH] MGS-5186 Per Specification EGL_NATIVE_PIXMAP_KHR requires
+ EGL_NO_CONTEXT
+
+https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_pixmap.txt
+
+Per Specification EGL_NATIVE_PIXMAP_KHR requires EGL_NO_CONTEXT.
+So passing context will result in error.
+
+Upstream-Status: Pending
+Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
+---
+ hw/xwayland/xwayland-glamor-gbm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: xorg-server-1.20.8/hw/xwayland/xwayland-glamor-gbm.c
+===================================================================
+--- xorg-server-1.20.8.orig/hw/xwayland/xwayland-glamor-gbm.c
++++ xorg-server-1.20.8/hw/xwayland/xwayland-glamor-gbm.c
+@@ -167,7 +167,7 @@ xwl_glamor_gbm_create_pixmap_for_bo(Scre
+     xwl_pixmap->bo = bo;
+     xwl_pixmap->buffer = NULL;
+     xwl_pixmap->image = eglCreateImageKHR(xwl_screen->egl_display,
+-                                          xwl_screen->egl_context,
++                                          EGL_NO_CONTEXT,
+                                           EGL_NATIVE_PIXMAP_KHR,
+                                           xwl_pixmap->bo, NULL);
+     if (xwl_pixmap->image == EGL_NO_IMAGE_KHR)
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0001-glamor-glamor_egl.c-EGL_NATIVE_PIXMAP_KHR-do-not-req.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0001-glamor-glamor_egl.c-EGL_NATIVE_PIXMAP_KHR-do-not-req.patch
new file mode 100644 (file)
index 0000000..c8f1ae7
--- /dev/null
@@ -0,0 +1,34 @@
+From cc05c01925755310f027c61daa29648a10155f96 Mon Sep 17 00:00:00 2001
+From: Rohan Garg <rohan@garg.io>
+Date: Thu, 13 Dec 2018 19:15:01 +0100
+Subject: [PATCH] glamor/glamor_egl.c: EGL_NATIVE_PIXMAP_KHR do not require
+ contexts
+
+From https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_pixmap.txt
+
+ * If <target> is EGL_NATIVE_PIXMAP_KHR, and <ctx> is not EGL_NO_CONTEXT,
+   the error EGL_BAD_PARAMETER is generated.
+
+Fixes: a5321ea4 ("Allow to create textured pixmaps from gbm_bo without using gem names")
+---
+ glamor/glamor_egl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Upstream-Status: Backport [cc05c01925755310f027c61daa29648a10155f96]
+
+diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
+index 0f4edb5a3..69844d4e2 100644
+--- a/glamor/glamor_egl.c
++++ b/glamor/glamor_egl.c
+@@ -233,7 +233,7 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap,
+     glamor_make_current(glamor_priv);
+     image = eglCreateImageKHR(glamor_egl->display,
+-                              glamor_egl->context,
++                              EGL_NO_CONTEXT,
+                               EGL_NATIVE_PIXMAP_KHR, bo, NULL);
+     if (image == EGL_NO_IMAGE_KHR) {
+         glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
+-- 
+2.17.1
+
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg/0001-prefer-to-use-GLES2-for-glamor-EGL-config.patch b/recipes-graphics/xorg-xserver/xserver-xorg/0001-prefer-to-use-GLES2-for-glamor-EGL-config.patch
new file mode 100644 (file)
index 0000000..6e140ea
--- /dev/null
@@ -0,0 +1,49 @@
+From a99ff39b3b6095a16977fbb13b2b453a7359850f Mon Sep 17 00:00:00 2001
+From: Xianzhong <xianzhong.li@nxp.com>
+Date: Mon, 11 Jan 2021 11:53:29 +0800
+Subject: [PATCH] prefer to use GLES2 for glamor EGL config
+
+created the initial patch for xorg/xserver 1.20.8
+
+Upstream-Status: Pending
+Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
+---
+ hw/xwayland/xwayland-glamor-gbm.c | 13 ++++---------
+ 1 file changed, 4 insertions(+), 9 deletions(-)
+
+diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
+index dce782fc3..1fdf45490 100644
+--- a/hw/xwayland/xwayland-glamor-gbm.c
++++ b/hw/xwayland/xwayland-glamor-gbm.c
+@@ -912,13 +912,8 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
+     struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
+     EGLint major, minor;
+     Bool egl_initialized = FALSE;
+-    static const EGLint config_attribs_core[] = {
+-        EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR,
+-        EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
+-        EGL_CONTEXT_MAJOR_VERSION_KHR,
+-        GLAMOR_GL_CORE_VER_MAJOR,
+-        EGL_CONTEXT_MINOR_VERSION_KHR,
+-        GLAMOR_GL_CORE_VER_MINOR,
++    static const EGLint config_attribs_gles2[] = {
++        EGL_CONTEXT_CLIENT_VERSION, 2,
+         EGL_NONE
+     };
+     const GLubyte *renderer;
+@@ -947,10 +942,10 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
+         goto error;
+     }
+-    eglBindAPI(EGL_OPENGL_API);
++    eglBindAPI(EGL_OPENGL_ES_API);
+     xwl_screen->egl_context = eglCreateContext(
+-        xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, config_attribs_core);
++        xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, config_attribs_gles2);
+     if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
+         xwl_screen->egl_context = eglCreateContext(
+             xwl_screen->egl_display, NULL, EGL_NO_CONTEXT, NULL);
+-- 
+2.17.1
+
index 9eb149f04bab76732db375b12284eeeb04f8772a..a828e5188b88a907dc912f158da32474097f9b51 100644 (file)
@@ -1,6 +1,9 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
 SRC_URI_append_imxgpu = " \
     file://0003-Remove-check-for-useSIGIO-option.patch \
+    file://0001-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch \
+    file://0001-glamor-glamor_egl.c-EGL_NATIVE_PIXMAP_KHR-do-not-req.patch \
+    file://0001-prefer-to-use-GLES2-for-glamor-EGL-config.patch \
     file://0001-hw-xwayland-Makefile.am-fix-build-without-glx.patch \
 "
 
@@ -8,5 +11,4 @@ IMX_OPENGL_PKGCONFIGS_REMOVE        = ""
 IMX_OPENGL_PKGCONFIGS_REMOVE_imxgpu = "glamor"
 OPENGL_PKGCONFIGS_remove_mx6        = "${IMX_OPENGL_PKGCONFIGS_REMOVE}"
 OPENGL_PKGCONFIGS_remove_mx7        = "${IMX_OPENGL_PKGCONFIGS_REMOVE}"
-OPENGL_PKGCONFIGS_remove_mx8        = "${IMX_OPENGL_PKGCONFIGS_REMOVE}"
 OPENGL_PKGCONFIGS_remove_imxdrm     = "dri glx"