- mesa-7.5-get-driver-name.patch: Fix glXGetScreenDriver for DRI2 (#495342)

This commit is contained in:
Adam Jackson 2009-04-15 15:19:12 +00:00
parent 35c4a86b4a
commit c85499f8ca
2 changed files with 92 additions and 1 deletions

View file

@ -0,0 +1,85 @@
commit a3c3c1f1437de0186d70de9017a6a8e404ecf482
Author: Adam Jackson <ajax@redhat.com>
Date: Tue Apr 14 17:56:29 2009 -0400
glx: Make glXGetScreenDriver() work for DRI2
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 3089aa1..87d62ad 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -40,6 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "glxclient.h"
#include "glcontextmodes.h"
#include "xf86dri.h"
+#include "dri2.h"
#include "sarea.h"
#include <dlfcn.h>
#include <sys/types.h>
@@ -75,32 +76,45 @@ struct __GLXDRIcontextPrivateRec {
*/
static Bool driGetDriverName(Display *dpy, int scrNum, char **driverName)
{
- int directCapable;
- Bool b;
- int driverMajor, driverMinor, driverPatch;
+ int directCapable;
+ Bool b;
+ int event, error;
+ int driverMajor, driverMinor, driverPatch;
- *driverName = NULL;
+ *driverName = NULL;
- if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) {
- ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n");
- return False;
- }
- if (!directCapable) {
- ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n");
- return False;
- }
+ if (XF86DRIQueryExtension(dpy, &event, &error)) { /* DRI1 */
+ if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) {
+ ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n");
+ return False;
+ }
+ if (!directCapable) {
+ ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n");
+ return False;
+ }
- b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor,
- &driverPatch, driverName);
- if (!b) {
- ErrorMessageF("Cannot determine driver name for screen %d\n", scrNum);
- return False;
- }
+ b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor,
+ &driverPatch, driverName);
+ if (!b) {
+ ErrorMessageF("Cannot determine driver name for screen %d\n", scrNum);
+ return False;
+ }
+
+ InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n",
+ driverMajor, driverMinor, driverPatch, *driverName, scrNum);
+
+ return True;
+ } else if (DRI2QueryExtension(dpy, &event, &error)) { /* DRI2 */
+ char *dev;
+ Bool ret = DRI2Connect(dpy, RootWindow(dpy, scrNum), driverName, &dev);
- InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n",
- driverMajor, driverMinor, driverPatch, *driverName, scrNum);
+ if (ret)
+ Xfree(dev);
+
+ return ret;
+ }
- return True;
+ return False;
}
/*

View file

@ -20,7 +20,7 @@
Summary: Mesa graphics libraries
Name: mesa
Version: 7.5
Release: 0.9%{?dist}
Release: 0.10%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.mesa3d.org
@ -48,6 +48,8 @@ Patch9: intel-revert-vbl.patch
Patch12: mesa-7.1-disable-intel-classic-warn.patch
Patch13: mesa-7.5-sparc64.patch
Patch20: mesa-7.5-get-driver-name.patch
BuildRequires: pkgconfig autoconf automake
%if %{with_dri}
BuildRequires: libdrm-devel >= 2.4.5-1
@ -175,6 +177,7 @@ This package provides some demo applications for testing Mesa.
%patch9 -p1 -b .intel-vbl
%patch12 -p1 -b .intel-nowarn
%patch13 -p1 -b .sparc64
%patch20 -p1 -b .get-driver-name
# Hack the demos to use installed data files
sed -i 's,../images,%{_libdir}/mesa-demos-data,' progs/demos/*.c
@ -431,6 +434,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/mesa-demos-data
%changelog
* Tue Apr 14 2009 Adam Jackson <ajax@redhat.com> 7.5-0.10
- mesa-7.5-get-driver-name.patch: Fix glXGetScreenDriver for DRI2 (#495342)
* Fri Apr 09 2009 Dennis Gilmore <dennis@ausil.us> - 7.5-0.9
- fix sparc64 asm