Bugfix + dri1 cleanup patches
Had those patches living in my local tree for a while now. Here is a respin on top of latest master
Patch 1: regression fix, preventing the ddx from loading if kernel module is not loaded
Patches 2-5: Completely nuke dri1, make dri2 hard dependency
Patches 6-7: Assist people with first-time build of nouveau
Git complains about whitespace errors in patch 7, which for the sake of me I cannot see
--
[PATCH 1/7] nouveau: Check if the device supports modesetting, after opening it
[PATCH 2/7] nouveau: stop using dri1 function DRICreatePCIBusID [PATCH 3/7] nouveau: Do not load dri {sub,}module [PATCH 4/7] dri1: purge the final references
[PATCH 5/7] nouveau: mandate dri2 build
[PATCH 6/7] configure: require xorg-macros 1.8 [PATCH 7/7] configure: printout the configuration info
--
configure.ac | 33 ++++++++++++++++++++++++++++++++- src/nouveau_dri2.c | 16 ++-------------- src/nv_driver.c | 46 +++++++++++++++++----------------------------- src/nv_type.h | 8 -------- 4 files changed, 51 insertions(+), 52 deletions(-)
A message that is not in the archive (sent off-list or not yet received): 1361047727-740-1-git-send-email-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 1/7 nouveau: Check if the device supports modesetting, after opening it
"Regression" caused by
commit e34cfbd5bd23f7f15372af52d8a39a5715ce7310
Author: Emil Velikov <[email protected]> Date: Fri Nov 2 03:57:41 2012 +0000
nouveau: Factor out common code to NVHasKMS()
As the name suggests checks if it has kernel mode setting, prints out the interface version and checkes if the chipset is supported
Function is used in NVPciProbe and NVPlatformProbe
Without this change X will fail with '[drm] KMS not enabled' if the kernel module is not loaded
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60772
--- src/nv_driver.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
src/nv_driver.c +7 -8
@@ -260,17 +260,10 @@ NVHasKMS(struct pci_device *pci_dev) } busid =DRICreatePCIBusID (pci_dev); - ret =drmCheckModesettingSupported (busid); -if (ret) { -xf86DrvMsg (-1 ,X_ERROR ,"[drm] KMS not enabled\n" ); -free (busid); -return FALSE; - } - ret =nouveau_device_open (busid, &dev); -free (busid);if (ret) {xf86DrvMsg (-1 ,X_ERROR ,"[drm] failed to open device\n" ); +free (busid);return FALSE; }
@@ -288,6 +281,12 @@ NVHasKMS(struct pci_device *pci_dev) chipset = dev->chipset;nouveau_device_del (&dev); + ret =drmCheckModesettingSupported (busid); +free (busid); +if (ret) { +xf86DrvMsg (-1 ,X_ERROR ,"[drm] KMS not enabled\n" ); +return FALSE; + }switch (chipset &0xf0 ) {case 0x00 :
Signature · 1 line
1.8.1.3
A message that is not in the archive (sent off-list or not yet received): 1361047727-740-2-git-send-email-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 1/7] nouveau: Check if the device supports modesetting, after opening it
Quoted 7 lines · Emil Velikov
"Regression" caused by
commite34cfbd5bd23f7f15372af52d8a39a5715ce7310Author: Emil Velikov <[email protected]> Date: Fri Nov 2 03:57:41 2012 +0000nouveau: Factor out common code to
NVHasKMS()
Quoted 8 lines
As the name suggests checks if it has kernel mode setting, prints out the interface version and checkes if the chipset is supported
Function is used in NVPciProbe and NVPlatformProbe
Without this change X will fail with '[drm] KMS not enabled' if the kernel module is not loaded
Thats correct, the X server is not responsible for loading the kernel module.
If the kernel module isn't loaded then there is a bug elsewhere.
Dave.
A message that is not in the archive (sent off-list or not yet received): CAPM=9tyko+H6B2KRC7RaTKgkRan_rMy4FHz4=_95s=v4sgsaDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 1/7] nouveau: Check if the device supports modesetting, after opening it
On 18/02/13 00:47, Dave Airlie wrote:
...
Quoted 6 lines
Thats correct, the X server is not responsible for loading the kernel module.
If the kernel module isn't loaded then there is a bug elsewhere.
Dave.
Same feeling in here as well. Although that does not stop people's workflow habits [1]
Emil
[1] http://xkcd.com/1172/
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 1/7] nouveau: Check if the device supports modesetting, after opening it
Quoted 5 lines · Emil Velikov
On 18/02/13 00:47, Dave Airlie wrote:
...Quoted 2 lines
Thats correct, the X server is not responsible for loading the kernel module.
Quoted 7 lines
Quoted 4 lines
If the kernel module isn't loaded then there is a bug elsewhere.
Dave.
Same feeling in here as well. Although that does not stop people's workflow habits [1]
Not supported, means not supported, won't fix.
The OS loads the kernel modules not the X server, pre-KMS things were different, but with KMS this is how it works. So yeah totally nak on this.
(xkcd never said you should care about people's workflows).
Dave.
PATCH v2 1/1 nouveau: call drmCheckModesettingSupported after opening the device
In reply to a message not in the archiveIf the kernel module is not yet loaded X will fail to load with "[drm] KMS not enabled". Some of the cases which may lead to this are
* using hotplug
* blacklisted nouveau
The issue was caused by commit
commit e34cfbd5bd23f7f15372af52d8a39a5715ce7310
Author: Emil Velikov <[email protected]>
Date: Fri Nov 2 03:57:41 2012 +0000
nouveau: Factor out common code to NVHasKMS()
As the name suggests checks if it has kernel mode setting, prints out the interface version and checkes if the chipset is supported
Function is used in NVPciProbe and NVPlatformProbe
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60772
---
v2: More sensible commit message
src/nv_driver.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
src/nv_driver.c +7 -8
@@ -260,17 +260,10 @@ NVHasKMS(struct pci_device *pci_dev) } busid =DRICreatePCIBusID (pci_dev); - ret =drmCheckModesettingSupported (busid); -if (ret) { -xf86DrvMsg (-1 ,X_ERROR ,"[drm] KMS not enabled\n" ); -free (busid); -return FALSE; - } - ret =nouveau_device_open (busid, &dev); -free (busid);if (ret) {xf86DrvMsg (-1 ,X_ERROR ,"[drm] failed to open device\n" ); +free (busid);return FALSE; }
@@ -288,6 +281,12 @@ NVHasKMS(struct pci_device *pci_dev) chipset = dev->chipset;nouveau_device_del (&dev); + ret =drmCheckModesettingSupported (busid); +free (busid); +if (ret) { +xf86DrvMsg (-1 ,X_ERROR ,"[drm] KMS not enabled\n" ); +return FALSE; + }switch (chipset &0xf0 ) {case 0x00 :
Signature · 1 line
1.8.1.3
A message that is not in the archive (sent off-list or not yet received): 1361225695-6797-1-git-send-email-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Dave Airlie
NAKRe: [PATCHv2] nouveau: call drmCheckModesettingSupported after opening the device
Quoted 5 lines · Emil Velikov
If the kernel module is not yet loaded X will fail to load with "[drm] KMS not enabled". Some of the cases which may lead to this are
* using hotplug
* blacklisted nouveau
If you blacklist it, its not up to the server to load it, the whole point of the blacklist to not load the modules.
I've no idea what hotplug does wrong, but it should load the drivers at bootup using pci ids like say udev does.
NAK.
Dave.
PATCH 2/7 nouveau: stop using dri1 function DRICreatePCIBusID
In reply to a message not in the archiveStep 1 to completely rip out dri1 out of nouveau
--- src/nv_driver.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
src/nv_driver.c +7 -5
@@ -254,11 +254,13 @@ NVHasKMS(struct pci_device *pci_dev)char *busid;int chipset, ret; -if (!xf86LoaderCheckSymbol ("DRICreatePCIBusID" )) { -xf86DrvMsg (-1 ,X_ERROR ,"[drm] No DRICreatePCIBusID symbol\n" ); -return FALSE; - } - busid =DRICreatePCIBusID (pci_dev); +#if XORG_VERSION_CURRENT >=XORG_VERSION_NUMERIC (1 ,9 ,99 ,901 ,0 ) +XNFasprintf (&busid,"pci:%04x:%02x:%02x.%d" , + pci_dev->domain, pci_dev->bus, pci_dev->dev, pci_dev->func); +#else + busid =XNFprintf ("pci:%04x:%02x:%02x.%d" , + pci_dev->domain, pci_dev->bus, pci_dev->dev, pci_dev->func); +#endif ret =nouveau_device_open (busid, &dev);if (ret) {
Signature · 1 line
1.8.1.3
PATCH 3/7 nouveau: Do not load dri {sub,}module
In reply to a message not in the archiveNouveau does not use dri1, thus loading XFree86-DRI is not needed On the other hand, we do use dri2
As a side effect, purge the 'set-but-unused' variable pLibDRMVersion
--- src/nv_driver.c | 19 +++---------------- src/nv_type.h | 2 -- 2 files changed, 3 insertions(+), 18 deletions(-)
src/nv_driver.c +3 -16
@@ -633,26 +633,13 @@ static Bool NVDRIGetVersion(ScrnInfoPtr pScrn) {NVPtr pNv =NVPTR (pScrn); -int errmaj, errmin; -pointer ret; - ret =LoadSubModule (pScrn->module,"dri" ,NULL ,NULL ,NULL , -NULL , &errmaj, &errmin); -if (!ret) { -xf86DrvMsg (pScrn->scrnIndex,X_INFO , -"error %d\n" , errmaj); -LoaderErrorMsg (pScrn->name,"dri" , errmaj, errmin); - } - -if (!ret && errmaj !=LDR_ONCEONLY ) +if (!xf86LoadSubModule (pScrn,"dri2" ))return FALSE; -xf86DrvMsg (pScrn->scrnIndex,X_INFO ,"Loaded DRI module\n" ); -/* Check the lib version */ -if (xf86LoaderCheckSymbol ("drmGetLibVersion" )) - pNv->pLibDRMVersion =drmGetLibVersion (0 ); -if (pNv->pLibDRMVersion ==NULL ) { +if ((xf86LoaderCheckSymbol ("drmGetLibVersion" )) && + (drmGetLibVersion (pNv->dev->fd) ==NULL )) {xf86DrvMsg (pScrn->scrnIndex,X_ERROR ,"NVDRIGetVersion failed because libDRM is really " "way to old to even get a version number out of it.\n"
src/nv_type.h +0 -2
@@ -69,8 +69,6 @@ typedef struct _NVRec {CARD32 currentRop; -drmVersionPtr pLibDRMVersion; -void *drmmode;/* for KMS */ /* DRM interface */
Signature · 1 line
1.8.1.3
PATCH 4/7 dri1: purge the final references
In reply to a message not in the archive--- configure.ac | 2 +- src/nv_type.h | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-)
configure.ac +1 -1
@@ -71,7 +71,7 @@ PKG_CHECK_MODULES(LIBDRM_NOUVEAU, [libdrm_nouveau >= 2.4.25]) AC_SUBST(LIBDRM_NOUVEAU_CFLAGS) AC_SUBST(LIBDRM_NOUVEAU_LIBS) -PKG_CHECK_MODULES(XORG, [xorg-server >= 1.8] xproto fontsproto libdrm xf86driproto $REQUIRED_MODULES) +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.8] xproto fontsproto libdrm $REQUIRED_MODULES) PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]), HAVE_XEXTPROTO_71="no")
src/nv_type.h +0 -6
@@ -4,16 +4,10 @@#include "colormapst.h" #include "xf86Cursor.h" #include "exa.h" -#ifdef XF86DRI -#define _XF86DRI_SERVER_#include "xf86drm.h" -#include "dri.h" #include <stdbool.h> #include <stdint.h> #include "xf86Crtc.h" -#else -#error "This driver requires a DRI-enabled X server" -#endif #if XF86_CRTC_VERSION >=5 #define NOUVEAU_PIXMAP_SHARING 1
Signature · 1 line
1.8.1.3
PATCH 5/7 nouveau: mandate dri2 build
In reply to a message not in the archiveBuilding nouveau without dri2 is just silly
--- configure.ac | 1 + src/nouveau_dri2.c | 16 ++-------------- 2 files changed, 3 insertions(+), 14 deletions(-)
configure.ac +1 -0
@@ -72,6 +72,7 @@ AC_SUBST(LIBDRM_NOUVEAU_CFLAGS) AC_SUBST(LIBDRM_NOUVEAU_LIBS) PKG_CHECK_MODULES(XORG, [xorg-server >= 1.8] xproto fontsproto libdrm $REQUIRED_MODULES) +PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6]) PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]), HAVE_XEXTPROTO_71="no")
src/nouveau_dri2.c +2 -14
@@ -7,9 +7,10 @@#include "nv_include.h" #ifdef DRI2 #include "dri2.h" +#else +#error "This driver requires a DRI2-enabled X server"#endif -#if defined(DRI2) && DRI2INFOREC_VERSION >= 3struct nouveau_dri2_buffer {DRI2BufferRec base;PixmapPtr ppix;
@@ -814,16 +815,3 @@ nouveau_dri2_fini(ScreenPtr pScreen) {DRI2CloseScreen (pScreen); } -#else -Bool -nouveau_dri2_init (ScreenPtr pScreen) -{ -return TRUE; -} - -void -nouveau_dri2_fini (ScreenPtr pScreen) -{ -} -#endif -
Signature · 1 line
1.8.1.3
PATCH 6/7 configure: require xorg-macros 1.8
In reply to a message not in the archiveExplicitly check for xorg-macros 1.8, as a subtle hint to update your build deps if building your own ddx
--- configure.ac | 12 ++++++++++++ 1 file changed, 12 insertions(+)
configure.ac +12 -0
@@ -47,6 +47,18 @@ AM_INIT_AUTOMAKE([dist-bzip2]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS +m4_ifndef([XORG_MACROS_VERSION], + [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) + +XORG_MACROS_VERSION(1.8) +XORG_DEFAULT_OPTIONS + +# Require X.Org server macros (i.e. XORG_DRIVER_CHECK_EXT) to check for required modules +m4_ifndef([XORG_DRIVER_CHECK_EXT], + [m4_fatal([must install xorg-server macros before running autoconf/autogen])]) + + # Checks for programs. AC_DISABLE_STATIC LT_INIT
Signature · 1 line
1.8.1.3
PATCH 7/7 configure: printout the configuration info
In reply to a message not in the archiveLet the bikeshedding begin
--- configure.ac | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
configure.ac +18 -0
@@ -132,3 +132,21 @@ AC_CONFIG_FILES([ man/Makefile ]) AC_OUTPUT + +dnl +dnl Output some configuration info for the user +dnl +echo "" +echo " prefix: $prefix" +echo " exec_prefix: $exec_prefix" +echo " libdir: $libdir" +echo " includedir: $includedir" + +echo "" +echo " CFLAGS: $CFLAGS" +echo " CXXFLAGS: $CXXFLAGS" +echo " Macros: $DEFINES" + +echo "" +echo " Run '${MAKE-make}' to build xf86-video-nouveau" +echo ""
Signature · 1 line
1.8.1.3