OSDN Git Service

dri: Fix __DRIconfig reporting of __DRI_ATTRIB_SWAP_METHOD
authorThomas Hellstrom <thellstrom@vmware.com>
Wed, 9 Aug 2017 08:50:23 +0000 (10:50 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 10 Aug 2017 07:15:33 +0000 (09:15 +0200)
The attribMap had two entries for this attribute, and
driGetConfigAttribIndex didn't return a proper value for this attribute.
Fix this, and also make sure we return SWAP_UNDEFINED for single-buffer
configs as required by the GLX_OML_swap_method spec.

Finally bump the dri core extension version to 2, indicating that we
correctly report __DRI_ATTRIB_SWAP_METHOD.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
include/GL/internal/dri_interface.h
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/utils.c

index f676ac5..5e8fce7 100644 (file)
@@ -726,9 +726,12 @@ struct __DRIuseInvalidateExtensionRec {
 
 /**
  * This extension defines the core DRI functionality.
+ *
+ * Version >= 2 indicates that getConfigAttrib with __DRI_ATTRIB_SWAP_METHOD
+ * returns a reliable value.
  */
 #define __DRI_CORE "DRI_Core"
-#define __DRI_CORE_VERSION 1
+#define __DRI_CORE_VERSION 2
 
 struct __DRIcoreExtensionRec {
     __DRIextension base;
index 39ecaf0..31a3040 100644 (file)
@@ -767,7 +767,7 @@ driSwapBuffers(__DRIdrawable *pdp)
 
 /** Core interface */
 const __DRIcoreExtension driCoreExtension = {
-    .base = { __DRI_CORE, 1 },
+    .base = { __DRI_CORE, 2 },
 
     .createNewScreen            = NULL,
     .destroyScreen              = driDestroyScreen,
index c37d446..7ae4cb8 100644 (file)
@@ -286,6 +286,7 @@ driCreateConfigs(mesa_format format,
 
                    if ( db_modes[i] == GLX_NONE ) {
                        modes->doubleBufferMode = GL_FALSE;
+                       modes->swapMethod = GLX_SWAP_UNDEFINED_OML;
                    }
                    else {
                        modes->doubleBufferMode = GL_TRUE;
@@ -403,7 +404,6 @@ static const struct { unsigned int attrib, offset; } attribMap[] = {
      * so the iterator includes them though.*/
     __ATTRIB(__DRI_ATTRIB_RENDER_TYPE,                 level),
     __ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT,               level),
-    __ATTRIB(__DRI_ATTRIB_SWAP_METHOD,                 level)
 };
 
 
@@ -428,10 +428,6 @@ driGetConfigAttribIndex(const __DRIconfig *config,
        else
            *value = 0;
        break;
-    case __DRI_ATTRIB_SWAP_METHOD:
-        /* XXX no return value??? */
-       break;
-
     default:
         /* any other int-sized field */
        *value = *(unsigned int *)