[PATCH] glx: Set the pbuffer bit for dri2 fbconfigs

Kristian Høgsberg krh at bitplanet.net
Fri Apr 9 07:58:48 PDT 2010


They've been implemented for a while, but we never advertised them.  All we
need to do is set the GLX_PBUFFER_BIT in the drawable type fbconfig
field when we're using DRI2.

Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>

https://bugs.freedesktop.org/show_bug.cgi?id=26581
---
 glx/glxdri.c       |    7 +++----
 glx/glxdri2.c      |    5 ++++-
 glx/glxdricommon.c |   13 ++++++++-----
 glx/glxdricommon.h |    3 ++-
 glx/glxdriswrast.c |    5 ++++-
 5 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/glx/glxdri.c b/glx/glxdri.c
index 21e44d1..9810a73 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -35,6 +35,7 @@
 #include <drm.h>
 #include <GL/gl.h>
 #include <GL/internal/dri_interface.h>
+#include <GL/glxtokens.h>
 
 #include <windowstr.h>
 #include <os.h>
@@ -939,9 +940,6 @@ initializeExtensions(__GLXDRIscreen *screen)
     }
 }
     
-extern __GLXconfig *
-glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs);
-
 static __GLXscreen *
 __glXDRIscreenProbe(ScreenPtr pScreen)
 {
@@ -1131,7 +1129,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 	goto handle_error;
     }
 
-    screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs);
+    screen->base.fbconfigs = glxConvertConfigs(screen->core,
+					       driConfigs, GLX_WINDOW_BIT);
 
     initializeExtensions(screen);
 
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index e791bf6..4c9f381 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -748,7 +748,10 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     initializeExtensions(screen);
 
-    screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs);
+    screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs,
+					       GLX_WINDOW_BIT |
+					       GLX_PIXMAP_BIT |
+					       GLX_PBUFFER_BIT);
 
     __glXScreenInit(&screen->base, pScreen);
 
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index faaa3b7..454aa55 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -121,7 +121,7 @@ setScalar(__GLXconfig *config, unsigned int attrib, unsigned int value)
 static __GLXconfig *
 createModeFromConfig(const __DRIcoreExtension *core,
 		     const __DRIconfig *driConfig,
-		     unsigned int visualType)
+		     unsigned int visualType, unsigned int drawableType)
 {
     __GLXDRIconfig *config;
     unsigned int attrib, value;
@@ -167,13 +167,14 @@ createModeFromConfig(const __DRIcoreExtension *core,
     config->config.next = NULL;
     config->config.xRenderable = GL_TRUE;
     config->config.visualType = visualType;
-    config->config.drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+    config->config.drawableType = drawableType;
 
     return &config->config;
 }
 
 __GLXconfig *
-glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs)
+glxConvertConfigs(const __DRIcoreExtension *core,
+		  const __DRIconfig **configs, unsigned int drawableType)
 {
     __GLXconfig head, *tail;
     int i;
@@ -183,7 +184,8 @@ glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs)
 
     for (i = 0; configs[i]; i++) {
 	tail->next = createModeFromConfig(core,
-					  configs[i], GLX_TRUE_COLOR);
+					  configs[i], GLX_TRUE_COLOR,
+					  drawableType);
 	if (tail->next == NULL)
 	    break;
 
@@ -192,7 +194,8 @@ glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs)
 
     for (i = 0; configs[i]; i++) {
 	tail->next = createModeFromConfig(core,
-					  configs[i], GLX_DIRECT_COLOR);
+					  configs[i], GLX_DIRECT_COLOR,
+					  drawableType);
 	if (tail->next == NULL)
 	    break;
 
diff --git a/glx/glxdricommon.h b/glx/glxdricommon.h
index f88964b..41e2d27 100644
--- a/glx/glxdricommon.h
+++ b/glx/glxdricommon.h
@@ -33,7 +33,8 @@ struct __GLXDRIconfig {
 };
 
 __GLXconfig *
-glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs);
+glxConvertConfigs(const __DRIcoreExtension *core,
+		  const __DRIconfig **configs, unsigned int drawableType);
 
 extern const __DRIsystemTimeExtension systemTimeExtension;
 
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index c647d83..918383c 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -506,7 +506,10 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     initializeExtensions(screen);
 
-    screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs);
+    screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs,
+					       GLX_WINDOW_BIT |
+					       GLX_PIXMAP_BIT |
+					       GLX_PBUFFER_BIT);
 
     __glXScreenInit(&screen->base, pScreen);
 
-- 
1.7.0.1



More information about the xorg-devel mailing list