pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH] [RFC] graphics/MesaLib with osmesa and software-only rendering

Hi all,

my pkgsrc installations are on headless servers that people ssh into. A
normal MesaLib build with DRI is a flaky affair and has a multitude of
failure modes when it tries to talk to graphics hardware over SSH. The
example in case is math/octave, which I am trying to bring to full

Note that I am not suggesting that people use full-blown graphical
octave over ssh as regular mode of operation, it is just that it
probably will be tried if octave is available at all and it'd better
work in that case. Slow, sure, but working.

For this example and the build of MesaLib that results from pkgsrc on
my CentOS 7.3 server, I get very flaky behaviour of the OpenGL-based
plotting of octave, while the gnuplot backend works fine. Flaky can
mean: infinite hang or simply crashing. I must admit that I am not
quite sure what modes of operation might work with OpenGL over SSH
nowadays … direct, indirect, whichever hardware being but to work.

What seems to be reliable is what results with my attached patch that
adds the osmesa option to MesaLib, together with

	PKG_OPTIONS.MesaLib+= -dri -llvm osmesa

. While osmesa without dri but _with_ llvm might be worth considering,
this needs disentanglement of the current MesaLib and it
might not really be what I am after, with defaulting to using multiple
rendering threads per user who is logged into the machine (could be
some dozen at any time).

The OSMesa part is desired by octave for plotting, as I gather, and
this seems to work once one adds the MesaLib to octave's

As the MesaLib package is rather loaded with lots of hackery, I am not
sure how far off my patch is from something worth including. It at
least manages to get a DRI-less build that appears to work for me (and
it took some bitter time to get there!).

I'm continuing to work on octave … currently, it is failing to find the
ARPACK library. And there are numerous packages missing to complete its
sparse matrix support, mainly. I figure that when I present an octave
build to our users, in the hope that even some Matlab use might
migrate, it should better be a complete build.

Anyhow … opinions about my MesaLib changes?

Alrighty then,


Dr. Thomas Orgis
Universität Hamburg
RRZ / Basisinfrastruktur / HPC
Schlüterstr. 70
20146 Hamburg
Tel.: 040/42838 8826
Fax: 040/428 38 6270
diff -x CVS -ruN pkgsrc-2017Q1/graphics/MesaLib/Makefile pkgsrc/graphics/MesaLib/Makefile
--- pkgsrc-2017Q1/graphics/MesaLib/Makefile	2017-03-22 21:22:31.000000000 +0100
+++ pkgsrc/graphics/MesaLib/Makefile	2017-04-14 17:47:12.219075454 +0200
@@ -45,10 +45,14 @@
 SUBST_FILES.wrapper-bug=	src/gbm/
 SUBST_FILES.wrapper-bug+=	src/glx/
 SUBST_FILES.wrapper-bug+=	src/mapi/
+SUBST_FILES.wrapper-bug+=	src/mesa/
 SUBST_FILES.wrapper-bug+=	src/mesa/drivers/x11/
+SUBST_FILES.wrapper-bug+=	src/mesa/drivers/osmesa/
+SUBST_FILES.wrapper-bug+=       src/gallium/targets/libgl-xlib/
 SUBST_SED.wrapper-bug=		-e 's,shared-glapi/,shared-glapi/,g'
 SUBST_SED.wrapper-bug+=		-e 's,,,g'
 SUBST_SED.wrapper-bug+=		-e 's,,,g'
+SUBST_SED.wrapper-bug+=         -e 's,^\(LTCPPASCOMPILE = $$(LIBTOOL)\) \($$(AM_V_lt)\),\1 --tag=CC \2,'
 # Replace /etc/drirc with ${PREFIX}/etc/drirc
 SUBST_CLASSES+=			drirc
diff -x CVS -ruN pkgsrc-2017Q1/graphics/MesaLib/ pkgsrc/graphics/MesaLib/
--- pkgsrc-2017Q1/graphics/MesaLib/	2017-03-22 21:22:31.000000000 +0100
+++ pkgsrc/graphics/MesaLib/	2017-04-14 17:45:14.093022304 +0200
@@ -1,7 +1,7 @@
 # $NetBSD:,v 1.55 2017/03/22 20:22:31 markd Exp $
+PKG_SUPPORTED_OPTIONS=		llvm dri osmesa
 # The LLVM option enables JIT accelerated software rendering and
@@ -21,6 +21,7 @@
 .include "../../mk/"
+PLIST_VARS+=    osmesa
 # gallium
 PLIST_VARS+=	freedreno ilo i915 i965 nouveau r300 r600 radeonsi	\
 		swrast svga vc4 virgl
@@ -29,6 +30,24 @@
 # other features
 PLIST_VARS+=	gbm vaapi vdpau wayland xatracker
+.if ${OPSYS} != "Darwin"
+# OSMesa wants swrast,llvmpipe,softpipe; hoping for swrast at least.
+# I would like a non-DRI build with llvmpipe. Can I have that with pkgsrc?
+# Or swr, even?
+# I am getting linking/dependency trouble with glapi; is this due to pkgsrc hackery?
+# Does disabling shared glapi help?
+.if !empty(PKG_OPTIONS:Mosmesa)
+PLIST.osmesa= yes
+CONFIGURE_ARGS+=	--enable-osmesa
+CONFIGURE_ARGS+=        --disable-osmesa
 .if !empty(PKG_OPTIONS:Mdri)
 CONFIGURE_ARGS+=	--enable-dri
@@ -67,15 +86,13 @@
 .include "../../graphics/MesaLib/"
 # Software rasterizer
+# It is all DRI?! The DRI-less gallium swrast (softpipe) does not have those
+# PLIST files.
+PLIST.swrast=		yes
 PLIST.swrast_dri=	yes
 DRI_DRIVERS+=		swrast
-.if ${OPSYS} != "Darwin"
-PLIST.swrast=		yes
 # x86 only drivers
 .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && ${OPSYS} != "Darwin"
@@ -149,7 +166,6 @@
 CONFIGURE_ARGS+=	--with-egl-platforms=x11,drm
-CONFIGURE_ARGS+=	--with-gallium-drivers=${GALLIUM_DRIVERS:ts,}
 CONFIGURE_ARGS+=	--with-dri-drivers=${DRI_DRIVERS:ts,}
 .if !empty(PKG_OPTIONS:Mllvm)
@@ -187,7 +203,6 @@
 CONFIGURE_ARGS+=	--disable-r600-llvm-compiler
 .endif # llvm
 .else # !dri
-CONFIGURE_ARGS+=	--with-gallium-drivers=
 CONFIGURE_ARGS+=	--with-dri-drivers=
 CONFIGURE_ARGS+=	--disable-dri
 CONFIGURE_ARGS+=	--disable-dri3
@@ -200,3 +215,5 @@
 PKG_FAIL_REASON+=	"The llvm PKG_OPTION must also be disabled when dri is disabled"
+CONFIGURE_ARGS+=	--with-gallium-drivers=${GALLIUM_DRIVERS:ts,}
diff -x CVS -ruN pkgsrc-2017Q1/graphics/MesaLib/PLIST pkgsrc/graphics/MesaLib/PLIST
--- pkgsrc-2017Q1/graphics/MesaLib/PLIST	2017-02-24 14:48:33.000000000 +0100
+++ pkgsrc/graphics/MesaLib/PLIST	2017-04-14 17:51:39.314197955 +0200
@@ -81,3 +81,7 @@
+@comment For some reason, it is not part of the anymore?!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Home | Main Index | Thread Index | Old Index