Thomas Hellstrom wrote:
Hi!

Sorry for attching the patch like this, but for some reason it was blocked when I tried to send it the normal way.

This patch bumps some dri interface versions, and I'm not sure when / whether that is allowed.
Please review!

Thanks
Thomas


------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
...And the patch of course. ...

/Thomas

>From 61d359819e650225f67b3a8707f4146fb786dc62 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom <[email protected]>
Date: Wed, 17 Jun 2009 04:24:29 +0200
Subject: [PATCH] dri: Pass the dri driver name down to the driver initialization function.

This is needed for the gallium dri state tracker to use driconf correctly.

Signed-off-by: Thomas Hellstrom <[email protected]>
---
 include/GL/internal/dri_interface.h    |    6 ++++--
 src/glx/x11/dri2_glx.c                 |    3 ++-
 src/glx/x11/dri_glx.c                  |    7 +++++--
 src/mesa/drivers/dri/common/dri_util.c |    7 ++++++-
 src/mesa/drivers/dri/common/dri_util.h |    3 +++
 5 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 910c916..de97614 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -587,7 +587,7 @@ struct __DRIframebufferRec {
  * conjunction with the core extension.
  */
 #define __DRI_LEGACY "DRI_Legacy"
-#define __DRI_LEGACY_VERSION 1
+#define __DRI_LEGACY_VERSION 2
 
 struct __DRIlegacyExtensionRec {
     __DRIextension base;
@@ -600,6 +600,7 @@ struct __DRIlegacyExtensionRec {
 				    void *pSAREA, int fd, 
 				    const __DRIextension **extensions,
 				    const __DRIconfig ***driver_configs,
+				    const char *driver_name,
 				    void *loaderPrivate);
 
     __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
@@ -713,7 +714,7 @@ struct __DRIdri2LoaderExtensionRec {
  * constructors for DRI2.
  */
 #define __DRI_DRI2 "DRI_DRI2"
-#define __DRI_DRI2_VERSION 1
+#define __DRI_DRI2_VERSION 2
 
 struct __DRIdri2ExtensionRec {
     __DRIextension base;
@@ -721,6 +722,7 @@ struct __DRIdri2ExtensionRec {
     __DRIscreen *(*createNewScreen)(int screen, int fd,
 				    const __DRIextension **extensions,
 				    const __DRIconfig ***driver_configs,
+				    const char *driver_name,
 				    void *loaderPrivate);
 
     __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
index fb31898..a3c5160 100644
--- a/src/glx/x11/dri2_glx.c
+++ b/src/glx/x11/dri2_glx.c
@@ -469,7 +469,8 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
 				 ((pdp->driMinor < 1)
 				  ? loader_extensions_old
 				  : loader_extensions),
-				 &driver_configs, psc);
+				 &driver_configs,
+				 driverName, psc);
 
     if (psc->__driScreen == NULL) {
 	ErrorMessageF("failed to create dri screen\n");
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 3ce410d..d8d5576 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -363,8 +363,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
 	goto handle_error;
     }
 
-    Xfree(driverName); /* No longer needed. */
-
     /*
      * Get device-specific info.  pDevPriv will point to a struct
      * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that
@@ -407,6 +405,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
 					  fd,
 					  loader_extensions,
 					  &driver_configs,
+					  driverName,
 					  psc);
 
     if (psp == NULL) {
@@ -414,6 +413,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
 	goto handle_error;
     }
 
+    Xfree(driverName);
     psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
     psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
 
@@ -426,6 +426,9 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
     if (framebuffer.base != MAP_FAILED)
 	drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
 
+    if (driverName != NULL)
+	Xfree(driverName);
+
     if (framebuffer.dev_priv != NULL)
 	Xfree(framebuffer.dev_priv);
 
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 2b1493a..2b78eed 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -707,6 +707,7 @@ driCreateNewScreen(int scrn,
 		   drmAddress pSAREA, int fd, 
 		   const __DRIextension **extensions,
 		   const __DRIconfig ***driver_modes,
+		   const char *driver_name,
 		   void *loaderPrivate)
 {
     static const __DRIextension *emptyExtensionList[] = { NULL };
@@ -745,6 +746,7 @@ driCreateNewScreen(int scrn,
     psp->fd = fd;
     psp->myNum = scrn;
     psp->dri2.enabled = GL_FALSE;
+    strncpy(psp->driver_name, driver_name, DRI_DRIVER_NAME_SIZE - 1);
 
     /*
     ** Do not init dummy context here; actual initialization will be
@@ -770,7 +772,9 @@ driCreateNewScreen(int scrn,
 static __DRIscreen *
 dri2CreateNewScreen(int scrn, int fd,
 		    const __DRIextension **extensions,
-		    const __DRIconfig ***driver_configs, void *data)
+		    const __DRIconfig ***driver_configs,
+		    const char *driver_name,
+		    void *data)
 {
     static const __DRIextension *emptyExtensionList[] = { NULL };
     __DRIscreen *psp;
@@ -797,6 +801,7 @@ dri2CreateNewScreen(int scrn, int fd,
     psp->fd = fd;
     psp->myNum = scrn;
     psp->dri2.enabled = GL_TRUE;
+    strncpy(psp->driver_name, driver_name, DRI_DRIVER_NAME_SIZE - 1);
 
     psp->DriverAPI = driDriverAPI;
     *driver_configs = driDriverAPI.InitScreen2(psp);
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index c95a5c8..7aea580 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -56,6 +56,7 @@
 #include "GL/internal/dri_interface.h"
 
 #define GLX_BAD_CONTEXT                    5
+#define DRI_DRIVER_NAME_SIZE               64
 
 typedef struct __DRIswapInfoRec        __DRIswapInfo;
 
@@ -536,6 +537,8 @@ struct __DRIscreenRec {
 
     /* The lock actually in use, old sarea or DRI2 */
     drmLock *lock;
+
+    char driver_name[DRI_DRIVER_NAME_SIZE];
 };
 
 extern void
-- 
1.6.0.2

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to