NetBSD Problem Report #50172

From www@NetBSD.org  Wed Aug 26 05:03:22 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 16D33A65BA
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 26 Aug 2015 05:03:22 +0000 (UTC)
Message-Id: <20150826050320.16EB1A65BB@mollari.NetBSD.org>
Date: Wed, 26 Aug 2015 05:03:20 +0000 (UTC)
From: davshao@gmail.com
Reply-To: davshao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: modular-xorg needs some glamor
X-Send-Pr-Version: www-1.0

>Number:         50172
>Category:       pkg
>Synopsis:       modular-xorg needs some glamor
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    tnn
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 26 05:05:00 +0000 2015
>Closed-Date:    Mon Oct 05 05:16:23 +0000 2015
>Last-Modified:  Mon Oct 05 05:16:23 +0000 2015
>Originator:     David Shao
>Release:        pkgsrc current
>Organization:
>Environment:
DragonFly  4.3-DEVELOPMENT DragonFly v4.3.1.340.g01e30f-DEVELOPMENT #4: Tue Aug 25 14:11:21 PDT 2015     xxxxx@:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64
>Description:
Uncommenting out the options for glamor and llvm in pkgsrc MesaLib, modular-xorg-server, and xf86-video-ati has led to successful use of glamor / llvm / radeonsi for a Gigabyte Radeon R7 240 (Southern Islands OLAND) on DragonFly 4.3-DEVELOPMENT.  Starting with Southern Islands the old EXA driver is no longer supported for 2D acceleration according to

http://xorg.freedesktop.org/wiki/RadeonFeature/

As this worked for a version of DragonFly that had its Radeon drivers the rough equivalent of Linux 3.12, it seems reasonable to expect the same pkgsrc stack can work for recent NetBSD if one workaround is found for:

# (EE) Failed to load /usr/pkg/lib/xorg/modules/extensions/libglx.so:
# /usr/pkg/lib/libGL.so.1: Use of initialized Thread Local Storage with model initial-exec and dlopen is not supported

There are problems waiting for native NetBSD support for this and subsequent generations of AMD Radeon graphics cards.  It seems the radeonsi driver depends on LLVM, and as Mesa drivers get further developed, it is possible that further features will require more recent LLVM.  This link suggests for MesaLib 10.6.5 that LLVM 3.6.2 might be required.  So there is the question of building LLVM in base and also the question of whether base wishes to update LLVM at the speed the Mesa3D project does.

http://www.linuxfromscratch.org/blfs/view/svn/x/mesalib.html

As far as I am aware, FreeBSD for example does not use its base LLVM but requires building LLVM from ports to support its xorg.

In addition the glamor driver with a hint from
/usr/pkg/share/X11/xorg.conf.d/20-radeon.conf
similar to

Section "Device"
	Identifier	"Radeon Graphics Card"
	Driver		"radeon"
	Option		"AccelMethod"	"Glamor"
EndSection

works with Dragonfly 4-3 DEVELOPMENT, FreeBSD 10.2 RELEASE, FreeBSD 10 Stable, and FreeBSD 11 current using a Sapphire Radeon HD5570 graphics card, and it also works with FreeBSD 11 current using a Sapphire Radeon HD 6450 graphics card (CAICOS).  (The latter graphics card used to work with DragonFly 4.3 before the recent update to Linux 3.17 equivalent Radeon kernel drivers, but now there is some sort of glyph corruption.)


>How-To-Repeat:

>Fix:
Might as well update to MesaLib 10.6.5 as the 10.5 series probably received its last update in July.  There are no patches needed to be added, just a couple to subtract that have been incorporated into the code.

diff -Nur MesaLib.orig/options.mk MesaLib/options.mk
--- MesaLib.orig/options.mk	2015-05-28 14:09:07.000000000 -0700
+++ MesaLib/options.mk	2015-08-23 11:48:48.398817000 -0700
@@ -2,6 +2,7 @@

 PKG_OPTIONS_VAR=		PKG_OPTIONS.MesaLib
 PKG_SUPPORTED_OPTIONS=		llvm dri
+PKG_SUPPORTED_OPTIONS+=		glamor debug
 PKG_SUGGESTED_OPTIONS=

 .if !empty(MACHINE_PLATFORM:MNetBSD-[789].*-*) && (	\
@@ -28,10 +29,25 @@

 .if !empty(PKG_OPTIONS:Mdri)

+.if !empty(PKG_OPTIONS:Mglamor)
+# Recommended by
+# http://www.freedesktop.org/wiki/Software/Glamor/
+CONFIGURE_ARGS+=	--enable-gbm
+CONFIGURE_ARGS+=	--enable-shared-glapi
+CONFIGURE_ARGS+=	--enable-glx-tls
+
+.else
+
 # (EE) Failed to load /usr/pkg/lib/xorg/modules/extensions/libglx.so:
 # /usr/pkg/lib/libGL.so.1: Use of initialized Thread Local Storage with model initial-exec and dlopen is not supported
 CONFIGURE_ARGS+=	--disable-glx-tls

+.endif
+
+.if !empty(PKG_OPTIONS:Mdebug)
+CFLAGS+=	-DDEBUG -O0 -g3
+.endif
+
 PLIST.dri=	yes

 BUILDLINK_DEPMETHOD.libpciaccess=      full
@@ -114,6 +130,7 @@
 GALLIUM_DRIVERS+=	radeonsi
 CONFIGURE_ARGS+=	--enable-gallium-llvm
 CONFIGURE_ARGS+=	--enable-r600-llvm-compiler
+.include "../../devel/libelf/buildlink3.mk"
 .include "../../lang/libLLVM/buildlink3.mk"
 CONFIGURE_ENV+=		ac_cv_path_ac_pt_LLVM_CONFIG=${LLVM_CONFIG_PATH}
 .else # !llvm

For modular-xorg-server something like this (ignore the devd stuff for now, it is DragonFly and FreeBSD specific):

diff -Nur modular-xorg-server.orig/options.mk modular-xorg-server/options.mk
--- modular-xorg-server.orig/options.mk	2015-04-29 08:11:02.000000000 -0700
+++ modular-xorg-server/options.mk	2015-08-15 05:38:07.911535000 -0700
@@ -1,9 +1,17 @@
 # $NetBSD: options.mk,v 1.11 2015/04/29 15:11:02 tnn Exp $

 PKG_OPTIONS_VAR=	PKG_OPTIONS.modular-xorg-server
-PKG_SUPPORTED_OPTIONS=	dri inet6 debug dtrace
+PKG_SUPPORTED_OPTIONS=	dri inet6 debug dtrace devd
+PKG_SUPPORTED_OPTIONS+= glamor	
 PKG_SUGGESTED_OPTIONS=	dri inet6

+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+PKG_SUGGESTED_OPTIONS+= devd
+# CONFIGURE_ARGS+=	--disable-xvfb
+# CONFIGURE_ARGS+=	--disable-xnest 
+CONFIGURE_ARGS+=	--enable-record=yes
+.endif
+
 .include "../../mk/bsd.options.mk"

 PLIST_VARS+=		dri dri3 dtrace
@@ -41,13 +49,17 @@
 	(echo "all:"; echo "install:") > ${WRKSRC}/hw/xfree86/drivers/modesetting/Makefile
 .endif

-#.if !empty(PKG_OPTIONS:Mglamor)
-#.include "../../x11/dri3proto/buildlink3.mk"
-#.include "../../x11/libxshmfence/buildlink3.mk"
-#CONFIGURE_ARGS+=	--enable-xtrans-send-fds
-#CONFIGURE_ARGS+=	--enable-dri3
-#CONFIGURE_ARGS+=	--enable-glamor
-#.endif
+PLIST_VARS+=		glamor
+.if !empty(PKG_OPTIONS:Mglamor)
+# .include "../../x11/dri3proto/buildlink3.mk"
+.if ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD"
+.include "../../x11/libxshmfence/buildlink3.mk"
+.endif
+# CONFIGURE_ARGS+=	--enable-xtrans-send-fds
+# CONFIGURE_ARGS+=	--enable-dri3
+CONFIGURE_ARGS+=	--enable-glamor
+PLIST.glamor=		yes
+.endif

 .if !empty(PKG_OPTIONS:Minet6)
 CONFIGURE_ARGS+=	--enable-ipv6
@@ -57,7 +69,8 @@

 .if !empty(PKG_OPTIONS:Mdebug)
 CONFIGURE_ARGS+=	--enable-debug
-CFLAGS+=		-ggdb
+#CFLAGS+=		-ggdb
+CFLAGS+=		-O0 -g3
 .endif

 .if !empty(PKG_OPTIONS:Mdtrace)
@@ -66,3 +79,17 @@
 .else
 CONFIGURE_ARGS+=	--without-dtrace
 .endif
+
+.if !empty(PKG_OPTIONS:Mdevd)
+SUBST_CLASSES+=			devd_config
+SUBST_STAGE.devd_config=	pre-build
+SUBST_MESSAGE.devd_config=	Patching config/Makefile for devd
+SUBST_FILES.devd_config+=	config/Makefile
+SUBST_SED.devd_config+=		-e 's|config\.c|config.c devd.c|g'
+SUBST_SED.devd_config+=		-e 's|config\.lo|config.lo devd.lo|g'
+SUBST_CLASSES+=			devd_dix
+SUBST_STAGE.devd_dix=		post-configure
+SUBST_MESSAGE.devd_dix=		Patching include/dix-config.h for devd 
+SUBST_FILES.devd_dix+=		include/dix-config.h	
+SUBST_SED.devd_dix+=		-e 's|/\* \#undef CONFIG_UDEV \*/|\#define CONFIG_DEVD 1 |'
+.endif

diff -Nur modular-xorg-server.orig/PLIST modular-xorg-server/PLIST
--- modular-xorg-server.orig/PLIST	2015-06-08 22:05:37.000000000 -0700
+++ modular-xorg-server/PLIST	2015-08-14 20:40:36.464378000 -0700
@@ -52,6 +52,7 @@
 include/xorg/gcstruct.h
 include/xorg/geext.h
 include/xorg/geint.h
+${PLIST.glamor}include/xorg/glamor.h
 include/xorg/globals.h
 include/xorg/glx_extinit.h
 include/xorg/glyphstr.h
@@ -171,6 +172,7 @@
 lib/xorg/modules/libexa.la
 lib/xorg/modules/libfb.la
 lib/xorg/modules/libfbdevhw.la
+${PLIST.glamor}lib/xorg/modules/libglamoregl.la
 lib/xorg/modules/libint10.la
 lib/xorg/modules/libshadow.la
 lib/xorg/modules/libshadowfb.la

And for xf86-video-ati:

diff -Nur xf86-video-ati.orig/Makefile xf86-video-ati/Makefile
--- xf86-video-ati.orig/Makefile	2015-04-25 07:25:21.000000000 -0700
+++ xf86-video-ati/Makefile	2015-08-18 15:53:47.164717000 -0700
@@ -10,9 +10,9 @@
 HOMEPAGE=	http://xorg.freedesktop.org/
 COMMENT=	Modular Xorg ATI Radeon video driver

-CONFIGURE_ARGS+=	--enable-dri
+# CONFIGURE_ARGS+=	--enable-dri
 # not packaged yet as of 20140125
-CONFIGURE_ARGS+=	--disable-glamor
+# CONFIGURE_ARGS+=	--disable-glamor

 CONFLICTS+=	xf86-video-ati6-[0-9]*

@@ -20,12 +20,31 @@
 GNU_CONFIGURE=	YES
 USE_TOOLS+=	gmake pkg-config

+CONFIGURE_ARGS+=--disable-udev
+
 .include "../../mk/bsd.prefs.mk"

+PKG_OPTIONS_VAR=	PKG_OPTIONS.xf86-video-ati
+PKG_SUPPORTED_OPTIONS= glamor debug	
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mglamor)
+CONFIGURE_ARGS+=	--enable-glamor
+.else
+CONFIGURE_ARGS+=	--disable-glamor
+.endif
+
+.if !empty(PKG_OPTIONS:Mdebug)
+CFLAGS+=		-O0 -g3
+.endif
+
 .if ${OPSYS} == "SunOS"
 CONFIGURE_ENV+=	DRIVER_MAN_SUFFIX=4
 .endif

+.include "../../devel/xorg-util-macros/buildlink3.mk"
+
 .include "../../x11/modular-xorg-server/buildlink3.mk"

 .include "../../devel/zlib/buildlink3.mk"



>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->tnn
Responsible-Changed-By: tnn@NetBSD.org
Responsible-Changed-When: Wed, 26 Aug 2015 07:45:18 +0000
Responsible-Changed-Why:
take


From: Tobias Nygren <tnn@NetBSD.org>
To: davshao@gmail.com
Cc: gnats-bugs@NetBSD.org
Subject: Re: pkg/50172: modular-xorg needs some glamor
Date: Mon, 31 Aug 2015 22:25:16 +0200

 On Wed, 26 Aug 2015 05:05:00 +0000 (UTC)
 davshao@gmail.com wrote:

 > Might as well update to MesaLib 10.6.5 as the 10.5 series probably received its last update in July.  There are no patches needed to be added, just a couple to subtract that have been incorporated into the code.

 Agreed. But I think I will instead hold this until Mesa 11 proper
 lands. It is due in less than two weeks. I have hardware that should be
 glamor capable, will try to get it going on NetBSD.

From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/50172: modular-xorg needs some glamor
Date: Mon, 7 Sep 2015 22:05:53 -0700

 On Mon, Aug 31, 2015 at 1:30 PM, Tobias Nygren <tnn@netbsd.org> wrote:
 > The following reply was made to PR pkg/50172; it has been noted by GNATS.
 >
 > From: Tobias Nygren <tnn@NetBSD.org>
 > To: davshao@gmail.com
 > Cc: gnats-bugs@NetBSD.org
 > Subject: Re: pkg/50172: modular-xorg needs some glamor
 > Date: Mon, 31 Aug 2015 22:25:16 +0200
 >
 >  On Wed, 26 Aug 2015 05:05:00 +0000 (UTC)
 >  davshao@gmail.com wrote:
 >
 >  > Might as well update to MesaLib 10.6.5 as the 10.5 series probably received its last update in July.  There are no patches needed to be added, just a couple to subtract that have been incorporated into the code.
 >
 >  Agreed. But I think I will instead hold this until Mesa 11 proper
 >  lands. It is due in less than two weeks. I have hardware that should be
 >  glamor capable, will try to get it going on NetBSD.
 >

 I would advise against this.  My understanding is that the freeze for
 the next version of pkgsrc is about to begin within days.  MesaLib
 10.6.x seems to have essentially been a bugfix branch known to be
 compatible with 10.5.x systems.  Therefore I would anticipate that
 there will be further bugfix updates to 10.6.x through much of the
 lifetime of the next pkgsrc branch, perfect for stability, while there
 would be no further updates to 10.5.x.  Also some new features of Mesa
 11 require an update to libLLVM 3.7.  And Mesa 11 would be a less
 stable development branch.

 Also I do not believe the NetBSD problems with glamor have anything to
 do with the version of MesaLib; instead, they are known problems with
 NetBSD as indicated in MesaLib's options.mk:

 # (EE) Failed to load /usr/pkg/lib/xorg/modules/extensions/libglx.so:
 # /usr/pkg/lib/libGL.so.1: Use of initialized Thread Local Storage
 with model initial-exec and dlopen is not supported
 CONFIGURE_ARGS+=    --disable-glx-tls

 I would think it would be far easier to debug this problem with a
 known stable branch and not simultaneously be trying to figure out
 what might have changed with Mesa 11.

 It seems to me that working on Mesa 11 and libLLVM 3.7 is suited more
 for pkgsrc-wip.

From: Tobias Nygren <tnn@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: David Shao <davshao@gmail.com>
Subject: Re: pkg/50172: modular-xorg needs some glamor
Date: Wed, 9 Sep 2015 19:19:54 +0200

 On Tue,  8 Sep 2015 05:10:04 +0000 (UTC)
 David Shao <davshao@gmail.com> wrote:

 >  I would advise against this.  My understanding is that the freeze for
 >  the next version of pkgsrc is about to begin within days.  MesaLib
 >  10.6.x seems to have essentially been a bugfix branch known to be
 >  compatible with 10.5.x systems.  Therefore I would anticipate that
 >  there will be further bugfix updates to 10.6.x through much of the
 >  lifetime of the next pkgsrc branch, perfect for stability, while there
 >  would be no further updates to 10.5.x.  Also some new features of Mesa
 >  11 require an update to libLLVM 3.7.  And Mesa 11 would be a less
 >  stable development branch.

 This makes sense. Let's update to 10.6.x.

From: "Tobias Nygren" <tnn@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50172 CVS commit: pkgsrc/graphics/MesaLib
Date: Sat, 12 Sep 2015 16:50:24 +0000

 Module Name:	pkgsrc
 Committed By:	tnn
 Date:		Sat Sep 12 16:50:24 UTC 2015

 Modified Files:
 	pkgsrc/graphics/MesaLib: Makefile options.mk

 Log Message:
 The LLVM option enables JIT accelerated software rendering and
 is also required to support the latest RADEON GPUs, so enable it
 by default on platforms where such GPUs might be encountered.
 Also enable thread local storage support in GLX for those platforms.
 Part of PR pkg/50172.


 To generate a diff of this commit:
 cvs rdiff -u -r1.107 -r1.108 pkgsrc/graphics/MesaLib/Makefile
 cvs rdiff -u -r1.35 -r1.36 pkgsrc/graphics/MesaLib/options.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Tobias Nygren" <tnn@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50172 CVS commit: pkgsrc/x11
Date: Sun, 13 Sep 2015 04:59:35 +0000

 Module Name:	pkgsrc
 Committed By:	tnn
 Date:		Sun Sep 13 04:59:35 UTC 2015

 Modified Files:
 	pkgsrc/x11/modular-xorg-server: Makefile PLIST options.mk
 	pkgsrc/x11/xf86-video-ati: Makefile

 Log Message:
 PR pkg/50172: support the "glamor" AccelMethod on FreeBSD/DragonFly/Linux

 (NetBSD not yet. Needs libxshmfence support first.)


 To generate a diff of this commit:
 cvs rdiff -u -r1.101 -r1.102 pkgsrc/x11/modular-xorg-server/Makefile
 cvs rdiff -u -r1.21 -r1.22 pkgsrc/x11/modular-xorg-server/PLIST
 cvs rdiff -u -r1.11 -r1.12 pkgsrc/x11/modular-xorg-server/options.mk
 cvs rdiff -u -r1.30 -r1.31 pkgsrc/x11/xf86-video-ati/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: tnn@NetBSD.org
State-Changed-When: Sun, 13 Sep 2015 05:01:23 +0000
State-Changed-Why:
I think everything that was requested is commited now.
Please review all changes and let me know if I have missed anything.
Thanks!


From: "Tobias Nygren" <tnn@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50172 CVS commit: pkgsrc/graphics/MesaLib
Date: Wed, 16 Sep 2015 17:03:28 +0000

 Module Name:	pkgsrc
 Committed By:	tnn
 Date:		Wed Sep 16 17:03:28 UTC 2015

 Modified Files:
 	pkgsrc/graphics/MesaLib: options.mk

 Log Message:
 Turn off llvm option by default for FreeBSD & DragonFlyBSD.
 There are conflicting reports regarding if it builds. It has been reported
 to work in PR pkg/50172, but then again appears to have failed in
 Sevan's bulk build.
 (Need to find out exactly which FreeBSD versions this applies to.)


 To generate a diff of this commit:
 cvs rdiff -u -r1.39 -r1.40 pkgsrc/graphics/MesaLib/options.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: tnn@NetBSD.org
State-Changed-When: Mon, 05 Oct 2015 05:16:23 +0000
State-Changed-Why:
worked on this some more meanwhile, now supported on NetBSD too


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.