From 9d029be5d7d88234558e637e0fec53e9c067a225 Mon Sep 17 00:00:00 2001 From: Wladislav Artsimovich Date: Thu, 14 May 2020 02:20:19 +0200 Subject: [PATCH 1/3] Force EXT_image_dma_buf to not be used, because it is not supported on DFLY. Patch applicable to Mesa 18+. This patch file was diffed from Mesa 20.2.0-devel (git-412e29c277) --- .../patch-src_egl_drivers_dri2_egl_dri2.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ports/graphics/mesa-dri/dragonfly/patch-src_egl_drivers_dri2_egl_dri2.c diff --git a/ports/graphics/mesa-dri/dragonfly/patch-src_egl_drivers_dri2_egl_dri2.c b/ports/graphics/mesa-dri/dragonfly/patch-src_egl_drivers_dri2_egl_dri2.c new file mode 100644 index 000000000000..7e5de3bb7253 --- /dev/null +++ b/ports/graphics/mesa-dri/dragonfly/patch-src_egl_drivers_dri2_egl_dri2.c @@ -0,0 +1,15 @@ +diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c +index 2e51d28a8b9..95ee2f3a7b1 100644 +--- a/src/egl/drivers/dri2/egl_dri2.c ++++ b/src/egl/drivers/dri2/egl_dri2.c +@@ -1005,8 +1005,8 @@ dri2_setup_screen(_EGLDisplay *disp) + #ifdef HAVE_LIBDRM + if (dri2_dpy->image->base.version >= 8 && + dri2_dpy->image->createImageFromDmaBufs) { +- disp->Extensions.EXT_image_dma_buf_import = EGL_TRUE; +- disp->Extensions.EXT_image_dma_buf_import_modifiers = EGL_TRUE; ++ disp->Extensions.EXT_image_dma_buf_import = EGL_FALSE; ++ disp->Extensions.EXT_image_dma_buf_import_modifiers = EGL_FALSE; + } + #endif + } From cc334dbea333733158136eb7a513611729ac4c39 Mon Sep 17 00:00:00 2001 From: Wladislav Artsimovich Date: Thu, 14 May 2020 02:30:46 +0200 Subject: [PATCH 2/3] Since wl_egl_window version 3, eglPointerIsDereferencable() uses a hacky solution to place a pointer in place of the version number. The branch that uses mincore to do so fails on DFLY. The other branch works and is thus forced. Patch applicable to Mesa 18+. This patch file was diffed from Mesa 20.2.0-devel (git-412e29c277) --- .../dragonfly/patch-src_egl_main_eglglobals.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 ports/graphics/mesa-dri/dragonfly/patch-src_egl_main_eglglobals.c diff --git a/ports/graphics/mesa-dri/dragonfly/patch-src_egl_main_eglglobals.c b/ports/graphics/mesa-dri/dragonfly/patch-src_egl_main_eglglobals.c new file mode 100644 index 000000000000..ef9a3d69e6c5 --- /dev/null +++ b/ports/graphics/mesa-dri/dragonfly/patch-src_egl_main_eglglobals.c @@ -0,0 +1,13 @@ +diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c +index 6811048bdf7..5eefbc9187b 100644 +--- a/src/egl/main/eglglobals.c ++++ b/src/egl/main/eglglobals.c +@@ -136,7 +136,7 @@ _eglPointerIsDereferencable(void *p) + { + uintptr_t addr = (uintptr_t) p; + const long page_size = getpagesize(); +-#ifdef HAVE_MINCORE ++#if 0 + unsigned char valid = 0; + + if (p == NULL) From e341019077d58254d05e6dd2480e73a6b8e0f9e5 Mon Sep 17 00:00:00 2001 From: Wladislav Artsimovich Date: Thu, 14 May 2020 02:38:49 +0200 Subject: [PATCH 3/3] Force EXT_image_dma_buf to not be used, because it is not supported on DFLY. Forcefully prevent branch leading to wl_dmabuf to be false. Patch applicable to Mesa 18+. This patch file was diffed from Mesa 20.2.0-devel (git-412e29c277) --- .../patch-src_egl_drivers_dri2_platform_wayland.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 ports/graphics/mesa-dri/dragonfly/patch-src_egl_drivers_dri2_platform_wayland.c diff --git a/ports/graphics/mesa-dri/dragonfly/patch-src_egl_drivers_dri2_platform_wayland.c b/ports/graphics/mesa-dri/dragonfly/patch-src_egl_drivers_dri2_platform_wayland.c new file mode 100644 index 000000000000..1cba82832794 --- /dev/null +++ b/ports/graphics/mesa-dri/dragonfly/patch-src_egl_drivers_dri2_platform_wayland.c @@ -0,0 +1,13 @@ +diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c +index c4177f8799c..0dbc7aa4803 100644 +--- a/src/egl/drivers/dri2/platform_wayland.c ++++ b/src/egl/drivers/dri2/platform_wayland.c +@@ -1347,7 +1347,7 @@ registry_handle_global_drm(void *data, struct wl_registry *registry, + dri2_dpy->wl_drm = + wl_registry_bind(registry, name, &wl_drm_interface, MIN2(version, 2)); + wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy); +- } else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0 && version >= 3) { ++ } else if (false && strcmp(interface, "zwp_linux_dmabuf_v1") == 0 && version >= 3) { + dri2_dpy->wl_dmabuf = + wl_registry_bind(registry, name, &zwp_linux_dmabuf_v1_interface, + MIN2(version, 3));