[Mesa-dev] [PATCH 08/10] Float fbconfigs frontend patch [1/3] Introduce new flags in __DRI_ATTRIB_RENDER_TYPE.

Tomasz Lis listom at gmail.com
Wed Jul 17 04:49:21 PDT 2013


From: Tomasz Lis <tomasz.lis at intel.com>

dri: Introduce new flags in __DRI_ATTRIB_RENDER_TYPE.

The patch marks __DRI_ATTRIB_FLOAT_MODE as deprecated and introduces
nrw flags to __DRI_ATTRIB_RENDER_TYPE which are to define float modes.
Both signed float (fbconfig_float) and unsigned (packed_float) is
introduced as a flag. The old attribute should be set for both float
modes.

Signed-off-by: Tomasz Lis <listom at gmail.com>
---
 include/GL/internal/dri_interface.h |    2 ++
 src/egl/drivers/dri2/egl_dri2.c     |    6 +++++-
 src/glx/dri_common.c                |   10 ++++++++--
 src/mesa/drivers/dri/common/utils.c |    6 ------
 4 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 30ce175..3316fd2 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -552,6 +552,8 @@ struct __DRIuseInvalidateExtensionRec {
 #define __DRI_ATTRIB_RGBA_BIT			0x01	
 #define __DRI_ATTRIB_COLOR_INDEX_BIT		0x02
 #define __DRI_ATTRIB_LUMINANCE_BIT		0x04
+#define __DRI_ATTRIB_FLOAT_BIT             0x08
+#define __DRI_ATTRIB_UNSIGNED_FLOAT_BIT    0x10
 
 /* __DRI_ATTRIB_CONFIG_CAVEAT */
 #define __DRI_ATTRIB_SLOW_BIT			0x01
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 1bce314..17d18be 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -75,7 +75,7 @@ EGLint dri2_to_egl_attribute_map[] = {
    0,				/* __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE */
    0,				/* __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE */
    0,				/* __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE */
-   0,				/* __DRI_ATTRIB_FLOAT_MODE */
+   0,				/* __DRI_ATTRIB_FLOAT_MODE (deprecated) */
    0,				/* __DRI_ATTRIB_RED_MASK */
    0,				/* __DRI_ATTRIB_GREEN_MASK */
    0,				/* __DRI_ATTRIB_BLUE_MASK */
@@ -140,6 +140,10 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
 	    value = EGL_RGB_BUFFER;
 	 else if (value & __DRI_ATTRIB_LUMINANCE_BIT)
 	    value = EGL_LUMINANCE_BUFFER;
+	 else if (value & __DRI_ATTRIB_FLOAT_BIT)
+	    return NULL; // Don't allow float configs for EGL
+	 else if (value & __DRI_ATTRIB_UNSIGNED_FLOAT_BIT)
+	    return NULL; // Don't allow float configs for EGL
 	 else
 	    /* not valid */;
 	 _eglSetConfigKey(&base, EGL_COLOR_BUFFER_TYPE, value);
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 7ab303e..58aba46 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -285,10 +285,16 @@ driConfigEqual(const __DRIcoreExtension *core,
          if (value & __DRI_ATTRIB_RGBA_BIT) {
             glxValue |= GLX_RGBA_BIT;
          }
-         else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
+         if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
             glxValue |= GLX_COLOR_INDEX_BIT;
          }
-         if (glxValue != config->renderType)
+         if (value & __DRI_ATTRIB_FLOAT_BIT) {
+            glxValue |= GLX_RGBA_FLOAT_BIT_ARB;
+         }
+         if (value & __DRI_ATTRIB_UNSIGNED_FLOAT_BIT) {
+            glxValue |= GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT;
+         }
+         if ((glxValue & config->renderType) == 0)
             return GL_FALSE;
          break;
 
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index ac0773b..c9fc218 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -366,7 +366,6 @@ static const struct { unsigned int attrib, offset; } attribMap[] = {
     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE,	transparentGreen),
     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE,	transparentBlue),
     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE,	transparentAlpha),
-    __ATTRIB(__DRI_ATTRIB_FLOAT_MODE,			floatMode),
     __ATTRIB(__DRI_ATTRIB_RED_MASK,			redMask),
     __ATTRIB(__DRI_ATTRIB_GREEN_MASK,			greenMask),
     __ATTRIB(__DRI_ATTRIB_BLUE_MASK,			blueMask),
@@ -418,11 +417,6 @@ driGetConfigAttribIndex(const __DRIconfig *config,
         /* XXX no return value??? */
 	break;
 
-    case __DRI_ATTRIB_FLOAT_MODE:
-        /* this field is not int-sized */
-        *value = config->modes.floatMode;
-        break;
-
     default:
         /* any other int-sized field */
 	*value = *(unsigned int *)
-- 
1.7.9.5



More information about the mesa-dev mailing list