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
functionality.

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 options.mk 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 buildlink3.mk to octave's
Makefile.

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,

Thomas

-- 
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/Makefile.in
 SUBST_FILES.wrapper-bug+=	src/glx/Makefile.in
 SUBST_FILES.wrapper-bug+=	src/mapi/Makefile.in
+SUBST_FILES.wrapper-bug+=	src/mesa/Makefile.in
 SUBST_FILES.wrapper-bug+=	src/mesa/drivers/x11/Makefile.in
+SUBST_FILES.wrapper-bug+=	src/mesa/drivers/osmesa/Makefile.in
+SUBST_FILES.wrapper-bug+=       src/gallium/targets/libgl-xlib/Makefile.in
 SUBST_SED.wrapper-bug=		-e 's,shared-glapi/libglapi.la,shared-glapi/libglapi_tmp_rename.la,g'
 SUBST_SED.wrapper-bug+=		-e 's,libglapi.la,libglapi_impl.la,g'
 SUBST_SED.wrapper-bug+=		-e 's,libglapi_tmp_rename.la,libglapi.la,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/options.mk pkgsrc/graphics/MesaLib/options.mk
--- pkgsrc-2017Q1/graphics/MesaLib/options.mk	2017-03-22 21:22:31.000000000 +0100
+++ pkgsrc/graphics/MesaLib/options.mk	2017-04-14 17:45:14.093022304 +0200
@@ -1,7 +1,7 @@
 # $NetBSD: options.mk,v 1.55 2017/03/22 20:22:31 markd Exp $
 
 PKG_OPTIONS_VAR=		PKG_OPTIONS.MesaLib
-PKG_SUPPORTED_OPTIONS=		llvm dri
+PKG_SUPPORTED_OPTIONS=		llvm dri osmesa
 PKG_SUGGESTED_OPTIONS=
 
 # The LLVM option enables JIT accelerated software rendering and
@@ -21,6 +21,7 @@
 
 .include "../../mk/bsd.options.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
 
+GALLIUM_DRIVERS=	#
+.if ${OPSYS} != "Darwin"
+GALLIUM_DRIVERS+=	swrast
+.endif
+
+
+# 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
+.else
+CONFIGURE_ARGS+=        --disable-osmesa
+.endif
+
 .if !empty(PKG_OPTIONS:Mdri)
 
 CONFIGURE_ARGS+=	--enable-dri
@@ -67,15 +86,13 @@
 .include "../../graphics/MesaLib/dri.mk"
 
 DRI_DRIVERS=		#
-GALLIUM_DRIVERS=	#
 
 # 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
-GALLIUM_DRIVERS+=	swrast
-.endif
 
 # x86 only drivers
 .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && ${OPSYS} != "Darwin"
@@ -149,7 +166,6 @@
 CONFIGURE_ARGS+=	--with-egl-platforms=x11,drm
 .endif
 
-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"
 .endif
 .endif
+
+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 @@
 ${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1.0.0
 ${PLIST.vaapi}lib/dri/gallium_drv_video.la
 ${PLIST.vaapi}lib/dri/gallium_drv_video.so
+${PLIST.osmesa}lib/pkgconfig/osmesa.pc
+${PLIST.osmesa}lib/libOSMesa.la
+@comment For some reason, it is not part of the libGL.la anymore?!
+${PLIST.osmesa}lib/libGL.so.1.6.0

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



Home | Main Index | Thread Index | Old Index