Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jul 2021 16:20:43 GMT
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 93734715f465 - main - graphics/mesa-devel: expose crocus to replace i965
Message-ID:  <202107011620.161GKhM6031235@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=93734715f465f6d0429513ef03ed857cb2e5bbe1

commit 93734715f465f6d0429513ef03ed857cb2e5bbe1
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-07-01 15:28:56 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-07-01 16:16:18 +0000

    graphics/mesa-devel: expose crocus to replace i965
    
    Example usage:
    $ MESA_LOADER_DRIVER_OVERRIDE=crocus glxgears
    
    See also https://gitlab.freedesktop.org/mesa/mesa/-/commit/17a1cc616371
---
 graphics/mesa-devel/Makefile            |  5 +++--
 graphics/mesa-devel/files/patch-userptr | 24 ++++++++++++++++++++++++
 graphics/mesa-devel/pkg-plist           |  1 +
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/graphics/mesa-devel/Makefile b/graphics/mesa-devel/Makefile
index 54040ad1b027..1a4e5ff582e3 100644
--- a/graphics/mesa-devel/Makefile
+++ b/graphics/mesa-devel/Makefile
@@ -55,12 +55,12 @@ OPTIONS_DEFINE=		LIBUNWIND LLVM LTO VAAPI VDPAU VKLAYERS WAYLAND X11 ZSTD
 OPTIONS_DEFAULT=	LIBUNWIND LLVM LTO VAAPI VDPAU VKLAYERS WAYLAND X11 ZSTD
 OPTIONS_GROUP=		DRI GALLIUM VULKAN
 OPTIONS_GROUP_DRI=	i965
-OPTIONS_GROUP_GALLIUM=	iris r600 radeonsi
+OPTIONS_GROUP_GALLIUM=	crocus iris r600 radeonsi
 OPTIONS_GROUP_VULKAN=	anv radv
 OPTIONS_EXCLUDE_DragonFly=	LIBUNWIND anv
 OPTIONS_EXCLUDE_i386=	LTO # anv: vkcube fails on vkCreateSwapchainKHR
 OPTIONS_EXCLUDE_powerpc64=	${"${/usr/bin/ld:L:tA}"==/usr/bin/ld.lld:?LTO:} # LLVM bug 47353
-OPTIONS_EXCLUDE+=	${ARCH:Namd64:Ni386:Nx86_64:C/.+/anv i965 iris/}
+OPTIONS_EXCLUDE+=	${ARCH:Namd64:Ni386:Nx86_64:C/.+/anv crocus i965 iris/}
 OPTIONS_EXCLUDE+=	${ARCH:Naarch64:Namd64:Ni386:Npowerpc64:Npowerpc64le:Nx86_64:C/.+/LIBUNWIND/}
 OPTIONS_EXCLUDE+=	${"${GL_DEFAULT:S/,/ /g:[-1]}"==${.CURDIR:T}:?COINST:}
 OPTIONS_EXCLUDE+=	${"${GL_DEFAULT:S/,/ /g:[1]}"!=libglvnd:?GLVND:}
@@ -81,6 +81,7 @@ DRI_DESC=		Classic OpenGL drivers
 i965_DESC=		GMA 3000 (Gen4) and newer
 
 GALLIUM_DESC=		Unified OpenGL drivers
+crocus_DESC=		Broadwater, Eaglelake, Ironlake, Sandybridge, Ivybridge, Haswell
 iris_DESC=		Broadwell and newer
 r600_DESC=		R600, R700, Evergreen, Northern Islands (implies LLVM)
 radeonsi_DESC=		Southern Islands and newer (implies LLVM)
diff --git a/graphics/mesa-devel/files/patch-userptr b/graphics/mesa-devel/files/patch-userptr
index 70885a10d47c..f73abcd5d1ed 100644
--- a/graphics/mesa-devel/files/patch-userptr
+++ b/graphics/mesa-devel/files/patch-userptr
@@ -1,6 +1,30 @@
 Try unsynchronized userptr if regular one fails.
 https://github.com/FreeBSDDesktop/kms-drm/issues/197
 
+--- src/gallium/drivers/crocus/crocus_bufmgr.c.orig	2021-06-30 22:34:42 UTC
++++ src/gallium/drivers/crocus/crocus_bufmgr.c
+@@ -493,8 +493,20 @@ crocus_bo_create_userptr(struct crocus_bufmgr *bufmgr,
+       .user_ptr = (uintptr_t)ptr,
+       .user_size = size,
+    };
+-   if (intel_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_USERPTR, &arg))
++
++   int ret;
++retry:
++   ret = intel_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_USERPTR, &arg);
++   if (ret) {
++      if (errno == ENODEV && arg.flags == 0) {
++         arg.flags = I915_USERPTR_UNSYNCHRONIZED;
++         goto retry;
++      }
++      if (geteuid() != 0) {
++         fprintf(stderr, "%s", "ioctl(I915_GEM_USERPTR) failed. Try running as root but expect poor stability.\n");
++      }
+       goto err_free;
++   }
+    bo->gem_handle = arg.handle;
+ 
+    /* Check the buffer for validity before we try and use it in a batch */
 --- src/gallium/drivers/iris/iris_bufmgr.c.orig	2021-03-10 22:23:51 UTC
 +++ src/gallium/drivers/iris/iris_bufmgr.c
 @@ -624,8 +624,20 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, con
diff --git a/graphics/mesa-devel/pkg-plist b/graphics/mesa-devel/pkg-plist
index 9de212c71b50..91a785ea696e 100644
--- a/graphics/mesa-devel/pkg-plist
+++ b/graphics/mesa-devel/pkg-plist
@@ -26,6 +26,7 @@
 %%NO_GLVND%%%%NO_COINST%%include/KHR/khrplatform.h
 %%NO_COINST%%include/gbm.h
 %%i965%%lib/dri%%SUFFIX%%/i965_dri.so
+%%crocus%%lib/dri%%SUFFIX%%/crocus_dri.so
 %%iris%%lib/dri%%SUFFIX%%/iris_dri.so
 %%r600%%lib/dri%%SUFFIX%%/r600_dri.so
 %%radeonsi%%lib/dri%%SUFFIX%%/radeonsi_dri.so



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107011620.161GKhM6031235>