xserver: Branch 'master' - 5 commits

Keith Packard keithp at kemper.freedesktop.org
Tue Oct 29 17:38:10 CET 2013


 configure.ac              |    2 +-
 glx/createcontext.c       |    2 ++
 glx/extension_string.c    |    5 +++++
 glx/extension_string.h    |    1 +
 glx/glxdri2.c             |   11 +++++++++++
 glx/glxdricommon.c        |   42 +++++++++++++++++++++++++++++++++++++++---
 glx/glxext.h              |   16 ++++++++++++++++
 hw/dmx/dmx_glxvisuals.c   |    7 ++++++-
 hw/dmx/glxProxy/glxcmds.c |   42 +++++++++++++++++++++++++++++++++++-------
 hw/xwin/glx/indirect.c    |    4 +++-
 10 files changed, 119 insertions(+), 13 deletions(-)

New commits:
commit b32a4c91ccd479638c2bd2c0143b6ea170c717d1
Merge: be66809 c671e93
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Oct 29 09:37:30 2013 -0700

    Merge remote-tracking branch 'idr/glx-float-fbconfig'

commit c671e935e7c44d4711ba9588ee96cb9796b879e6
Author: Daniel Czarnowski <daniel.czarnowski at intel.com>
Date:   Mon Oct 21 19:48:38 2013 +0200

    glx: Enable GLX_ARB_fbconfig_float for DRI2 drivers
    
    v2 (idr): Maintain sort order of extension list.  Fixed rebase error
    (comment header for initializeExtensions was in front of
    __glXDRIinvalidateBuffers).  Re-write commit message.
    
    Signed-off-by: Daniel Czarnowski <daniel.czarnowski at intel.com>
    Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
    Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

diff --git a/glx/extension_string.c b/glx/extension_string.c
index 58f930f..4bef96f 100644
--- a/glx/extension_string.c
+++ b/glx/extension_string.c
@@ -65,12 +65,17 @@ struct extension_info {
     unsigned char driver_support;
 };
 
+/**
+ * List of known GLX Extensions.
+ * The last Y/N switch informs whether the support of this extension is always enabled.
+ */
 static const struct extension_info known_glx_extensions[] = {
 /*   GLX_ARB_get_proc_address is implemented on the client. */
     /* *INDENT-OFF* */
     { GLX(ARB_create_context),          VER(0,0), N, },
     { GLX(ARB_create_context_profile),  VER(0,0), N, },
     { GLX(ARB_create_context_robustness), VER(0,0), N, },
+    { GLX(ARB_fbconfig_float),          VER(0,0), N, },
     { GLX(ARB_framebuffer_sRGB),        VER(0,0), N, },
     { GLX(ARB_multisample),             VER(1,4), Y, },
 
diff --git a/glx/extension_string.h b/glx/extension_string.h
index 81b7de3..e7d3932 100644
--- a/glx/extension_string.h
+++ b/glx/extension_string.h
@@ -39,6 +39,7 @@ enum {
     ARB_create_context_bit = 0,
     ARB_create_context_profile_bit,
     ARB_create_context_robustness_bit,
+    ARB_fbconfig_float_bit,
     ARB_framebuffer_sRGB_bit,
     ARB_multisample_bit,
     EXT_create_context_es2_profile_bit,
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index f662b21..843f603 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -845,6 +845,11 @@ glxDRILeaveVT(ScrnInfoPtr scrn)
     scrn->LeaveVT = glxDRILeaveVT;
 }
 
+/**
+ * Initialize extension flags in glx_enable_bits when a new screen is created
+ *
+ * @param screen The screen where glx_enable_bits are to be set.
+ */
 static void
 initializeExtensions(__GLXDRIscreen * screen)
 {
@@ -889,6 +894,12 @@ initializeExtensions(__GLXDRIscreen * screen)
         LogMessage(X_INFO, "AIGLX: enabled GLX_EXT_framebuffer_sRGB\n");
     }
 
+    /* enable ARB_fbconfig_float extension (even if there are no float fbconfigs) */
+    {
+        __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_fbconfig_float");
+        LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_fbconfig_float\n");
+    }
+
     for (i = 0; extensions[i]; i++) {
 #ifdef __DRI_READ_DRAWABLE
         if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
commit ccc8bb1153ec669f7540a174a81a8ec0e0d6dd67
Author: Daniel Czarnowski <daniel.czarnowski at intel.com>
Date:   Wed Oct 23 12:53:59 2013 +0200

    glx: Handle float config types in glxConvertConfigs
    
    Replaces old use of floatMode attribute with new, extended range of
    values in __DRI_ATTRIB_RENDER_TYPE. Also adds new conditions, where the
    float modes support requires it. Enables support for not only float
    configs, but packed float configs as well.
    
    v2 (idr): Whitespace and formatting fixes.  Refactor render type
    vs. pbuffer checking to a separate function that includes a quote from
    the spec.  Re-write commit message.  Fix compiler warnings:
    
    glxdricommon.c: In function 'glxConvertConfigs':
    glxdricommon.c:212:35: warning: pointer targets in passing argument 3 of 'core->getConfigAttrib' differ in signedness [-Wpointer-sign]
    glxdricommon.c:212:35: note: expected 'unsigned int *' but argument is of type 'int *'
    glxdricommon.c:230:35: warning: pointer targets in passing argument 3 of 'core->getConfigAttrib' differ in signedness [-Wpointer-sign]
    glxdricommon.c:230:35: note: expected 'unsigned int *' but argument is of type 'int *'
    
    Signed-off-by: Daniel Czarnowski <daniel.czarnowski at intel.com>
    Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
    Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

diff --git a/configure.ac b/configure.ac
index 7b4e70f..c47937a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -809,7 +809,7 @@ LIBAPPLEWM="applewm >= 1.4"
 LIBDMX="dmx >= 1.0.99.1"
 LIBDRI="dri >= 7.8.0"
 LIBDRM="libdrm >= 2.3.0"
-LIBGL="gl >= 7.1.0"
+LIBGL="gl >= 9.2.0"
 LIBXEXT="xext >= 1.0.99.4"
 LIBXFONT="xfont >= 1.4.2"
 LIBXI="xi >= 1.2.99.1"
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index 0ab3e30..48f0bce 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -36,6 +36,7 @@
 #include <GL/internal/dri_interface.h>
 #include <os.h>
 #include "glxserver.h"
+#include "glxext.h"
 #include "glxcontext.h"
 #include "glxscreens.h"
 #include "glxdricommon.h"
@@ -127,6 +128,7 @@ createModeFromConfig(const __DRIcoreExtension * core,
                      unsigned int visualType, unsigned int drawableType)
 {
     __GLXDRIconfig *config;
+    GLint renderType = 0;
     unsigned int attrib, value;
     int i;
 
@@ -138,11 +140,14 @@ createModeFromConfig(const __DRIcoreExtension * core,
     while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
         switch (attrib) {
         case __DRI_ATTRIB_RENDER_TYPE:
-            config->config.renderType = 0;
             if (value & __DRI_ATTRIB_RGBA_BIT)
-                config->config.renderType |= GLX_RGBA_BIT;
+                renderType |= GLX_RGBA_BIT;
             if (value & __DRI_ATTRIB_COLOR_INDEX_BIT)
-                config->config.renderType |= GLX_COLOR_INDEX_BIT;
+                renderType |= GLX_COLOR_INDEX_BIT;
+            if (value & __DRI_ATTRIB_FLOAT_BIT)
+                renderType |= GLX_RGBA_FLOAT_BIT_ARB;
+            if (value & __DRI_ATTRIB_UNSIGNED_FLOAT_BIT)
+                renderType |= GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT;
             break;
         case __DRI_ATTRIB_CONFIG_CAVEAT:
             if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
@@ -171,11 +176,26 @@ createModeFromConfig(const __DRIcoreExtension * core,
     config->config.next = NULL;
     config->config.xRenderable = GL_TRUE;
     config->config.visualType = visualType;
+    config->config.renderType = renderType;
     config->config.drawableType = drawableType;
 
     return &config->config;
 }
 
+static Bool
+render_type_is_pbuffer_only(unsigned renderType)
+{
+    /* The GL_ARB_color_buffer_float spec says:
+     *
+     *     "Note that floating point rendering is only supported for
+     *     GLXPbuffer drawables.  The GLX_DRAWABLE_TYPE attribute of the
+     *     GLXFBConfig must have the GLX_PBUFFER_BIT bit set and the
+     *     GLX_RENDER_TYPE attribute must have the GLX_RGBA_FLOAT_BIT set."
+     */
+    return !!(renderType & (__DRI_ATTRIB_UNSIGNED_FLOAT_BIT
+                            | __DRI_ATTRIB_FLOAT_BIT));
+}
+
 __GLXconfig *
 glxConvertConfigs(const __DRIcoreExtension * core,
                   const __DRIconfig ** configs, unsigned int drawableType)
@@ -187,6 +207,14 @@ glxConvertConfigs(const __DRIcoreExtension * core,
     head.next = NULL;
 
     for (i = 0; configs[i]; i++) {
+        unsigned renderType = 0;
+        if (core->getConfigAttrib(configs[i], __DRI_ATTRIB_RENDER_TYPE,
+                                  &renderType)) {
+            if (render_type_is_pbuffer_only(renderType) &&
+                !(drawableType & GLX_PBUFFER_BIT))
+                continue;
+        }
+        /* Add all the others */
         tail->next = createModeFromConfig(core,
                                           configs[i], GLX_TRUE_COLOR,
                                           drawableType);
@@ -197,6 +225,14 @@ glxConvertConfigs(const __DRIcoreExtension * core,
     }
 
     for (i = 0; configs[i]; i++) {
+        int renderType = 0;
+        if (core->getConfigAttrib(configs[i], __DRI_ATTRIB_RENDER_TYPE,
+                                  &renderType)) {
+            if (render_type_is_pbuffer_only(renderType) &&
+                !(drawableType & GLX_PBUFFER_BIT))
+                continue;
+        }
+        /* Add all the others */
         tail->next = createModeFromConfig(core,
                                           configs[i], GLX_DIRECT_COLOR,
                                           drawableType);
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index b79f023..4f09652 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -386,7 +386,9 @@ fbConfigsDump(unsigned int n, __GLXconfig * c)
                c->accumAlphaBits, c->sampleBuffers, c->samples,
                (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
                (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
-               (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", ".",
+               (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".",
+               (c->renderType & (GLX_RGBA_FLOAT_BIT_ARB |
+                   GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) ? "y" : ".",
                (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
                c->visualSelectGroup,
                (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
commit 4e5eb15b4cc170499cf87e6633c1737f0b1c514b
Author: Daniel Czarnowski <daniel.czarnowski at intel.com>
Date:   Mon Oct 21 19:57:53 2013 +0200

    glx: Correctly set render type enum
    
    The type specified is bits, but the context wants an enum.
    
    v2 (idr): Fix various whitespace and formatting problems.  Rename
    convFBconfRenderTypeBits2CtxRenderType to
    renderTypeBitsToRenderTypeEnum.  Re-write commit message.
    
    Signed-off-by: Daniel Czarnowski <daniel.czarnowski at intel.com>
    Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
    Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

diff --git a/hw/dmx/dmx_glxvisuals.c b/hw/dmx/dmx_glxvisuals.c
index 56bd67b..b3bd3b7 100644
--- a/hw/dmx/dmx_glxvisuals.c
+++ b/hw/dmx/dmx_glxvisuals.c
@@ -448,7 +448,12 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)
         /* Fill in derived values */
         config->screen = screen;
 
-        config->rgbMode = config->renderType & GLX_RGBA_BIT;
+        /* The rgbMode should be true for any mode which has distinguishible
+         * R, G and B components
+         */
+        config->rgbMode = (config->renderType
+                           & (GLX_RGBA_BIT | GLX_RGBA_FLOAT_BIT_ARB
+                              | GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) != 0;
         config->colorIndexMode = !config->rgbMode;
 
         config->haveAccumBuffer =
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 335da37..190eeef 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -123,6 +123,28 @@ GetBackEndDisplay(__GLXclientState * cl, int s)
     return cl->be_displays[s];
 }
 
+/**
+ * Convert the render type bits from fbconfig into context render type.
+ */
+static int
+renderTypeBitsToRenderTypeEnum(int fbRenderType)
+{
+    if (fbRenderType & GLX_RGBA_BIT)
+        return GLX_RGBA_TYPE;
+
+    if (fbRenderType & GLX_COLOR_INDEX_BIT)
+        return  GLX_COLOR_INDEX_TYPE;
+
+    if (fbRenderType & GLX_RGBA_FLOAT_BIT_ARB)
+        return GLX_RGBA_FLOAT_TYPE_ARB;
+
+    if (fbRenderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)
+        return GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT;
+
+    /* There's no recognized renderType in the config */
+    return GLX_RGBA_TYPE;
+}
+
 /*
 ** Create a GL context with the given properties.
 */
@@ -308,12 +330,14 @@ CreateContext(__GLXclientState * cl,
         /* send the create context request to the back-end server */
         dpy = GetBackEndDisplay(cl, screen);
         if (glxc->pFBConfig) {
-            /*Since for a certain visual both RGB and COLOR INDEX
-             *can be on then the only parmeter to choose the renderType
-             * should be the class of the colormap since all 4 first 
-             * classes does not support RGB mode only COLOR INDEX ,
-             * and so TrueColor and DirectColor does not support COLOR INDEX*/
-            int renderType = glxc->pFBConfig->renderType;
+            /* For a specific visual, multiple render types (i.e., both RGB
+             * and COLOR INDEX) can be accessible. The only parameter to
+             * choose the renderType should be the class of the colormap,
+             * since the first classes do not support RGB mode (only COLOR
+             * INDEX), and TrueColor and DirectColor do not support COLOR
+             * INDEX.
+             */
+            int renderType = GLX_RGBA_TYPE;
 
             if (pVisual) {
                 switch (pVisual->class) {
@@ -329,7 +353,11 @@ CreateContext(__GLXclientState * cl,
                     renderType = GLX_RGBA_TYPE;
                     break;
                 }
+            } else {
+                renderType =
+                    renderTypeBitsToRenderTypeEnum(glxc->pFBConfig->renderType);
             }
+
             if (__GLX_IS_VERSION_SUPPORTED(1, 3)) {
                 LockDisplay(dpy);
                 GetReq(GLXCreateNewContext, be_new_req);
@@ -3210,7 +3238,7 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
     *pSendBuf++ = GLX_FBCONFIG_ID;
     *pSendBuf++ = (int) (ctx->pFBConfig->id);
     *pSendBuf++ = GLX_RENDER_TYPE;
-    *pSendBuf++ = (int) (ctx->pFBConfig->renderType);
+    *pSendBuf++ = renderTypeBitsToRenderTypeEnum(ctx->pFBConfig->renderType);
     *pSendBuf++ = GLX_SCREEN;
     *pSendBuf++ = (int) (ctx->pScreen->myNum);
 
commit eabb523aa45f3d8940cadac197ef1225fbfd5c56
Author: Daniel Czarnowski <daniel.czarnowski at intel.com>
Date:   Mon Oct 21 19:45:35 2013 +0200

    glx: Allow float renderType in glXCreateContextAttribsARB
    
    This enables GLX_RGBA_FLOAT_TYPE_ARB and
    GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT as valid renderType parameters to
    glXCreateContextAttribsARB.
    
    v2 (idr) : Use C-style comments and fix word wrapping.  Re-write commit
    message.
    
    Signed-off-by: Daniel Czarnowski <daniel.czarnowski at intel.com>
    Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
    Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

diff --git a/glx/createcontext.c b/glx/createcontext.c
index 13d21cc..41ecd11 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -68,6 +68,8 @@ validate_render_type(uint32_t render_type)
     switch (render_type) {
     case GLX_RGBA_TYPE:
     case GLX_COLOR_INDEX_TYPE:
+    case GLX_RGBA_FLOAT_TYPE_ARB:
+    case GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT:
         return True;
     default:
         return False;
diff --git a/glx/glxext.h b/glx/glxext.h
index 9b0978b..3f2dee6 100644
--- a/glx/glxext.h
+++ b/glx/glxext.h
@@ -35,6 +35,22 @@
  * Silicon Graphics, Inc.
  */
 
+/* doing #include <GL/glx.h> & #include <GL/glxext.h> could cause problems
+ * with overlapping definitions, so let's use the easy way
+ */
+#ifndef GLX_RGBA_FLOAT_BIT_ARB
+#define GLX_RGBA_FLOAT_BIT_ARB             0x00000004
+#endif
+#ifndef GLX_RGBA_FLOAT_TYPE_ARB
+#define GLX_RGBA_FLOAT_TYPE_ARB            0x20B9
+#endif
+#ifndef GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT
+#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT    0x00000008
+#endif
+#ifndef GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT
+#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT   0x20B1
+#endif
+
 extern GLboolean __glXFreeContext(__GLXcontext * glxc);
 extern void __glXFlushContextCache(void);
 


More information about the xorg-commit mailing list