[PATCH] Support of GLX_RGBA*_FLOAT_BIT*, and correct setting of the flags. Also commented each renderType use with information which (fbconfig or context) RENDER_TYPE it is. Changes in dmx component.

Daniel Czarnowski daniel.czarnowski at intel.com
Mon Oct 21 19:57:53 CEST 2013


---
 hw/dmx/dmx_glxvisuals.c   |    4 +++-
 hw/dmx/glxProxy/glxcmds.c |   36 +++++++++++++++++++++++++++++-------
 2 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/hw/dmx/dmx_glxvisuals.c b/hw/dmx/dmx_glxvisuals.c
index 56bd67b..0cd5f21 100644
--- a/hw/dmx/dmx_glxvisuals.c
+++ b/hw/dmx/dmx_glxvisuals.c
@@ -448,7 +448,9 @@ 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 8cdb25e..fb56017 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -123,6 +123,21 @@ GetBackEndDisplay(__GLXclientState * cl, int s)
     return cl->be_displays[s];
 }
 
+/*  Convert the render type bits from fbconfig into context render type. */
+static int convFBconfRenderTypeBits2CtxRenderType(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 +323,13 @@ 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 (ie. both RGB and COLOR INDEX)
+             * can be accessible. The only parameter 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 = GLX_RGBA_TYPE;
 
             if (pVisual) {
                 switch (pVisual->class) {
@@ -329,7 +345,10 @@ CreateContext(__GLXclientState * cl,
                     renderType = GLX_RGBA_TYPE;
                     break;
                 }
+            } else {
+                renderType = convFBconfRenderTypeBits2CtxRenderType(glxc->pFBConfig->renderType);
             }
+
             if (__GLX_IS_VERSION_SUPPORTED(1, 3)) {
                 LockDisplay(dpy);
                 GetReq(GLXCreateNewContext, be_new_req);
@@ -3185,6 +3204,7 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
     __GLXcontext *ctx;
     xGLXQueryContextReq *req;
     xGLXQueryContextReply reply;
+    int renderType;
     int nProps;
     int *sendBuf, *pSendBuf;
     int nReplyBytes;
@@ -3197,6 +3217,8 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
         return __glXBadContext;
     }
 
+    renderType = convFBconfRenderTypeBits2CtxRenderType(ctx->pFBConfig->renderType);
+
     nProps = 3;
 
     reply = (xGLXQueryContextReply) {
@@ -3212,7 +3234,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++ = renderType; /* context render type (one of GLX_*_TYPE values) */
     *pSendBuf++ = GLX_SCREEN;
     *pSendBuf++ = (int) (ctx->pScreen->myNum);
 
-- 
1.7.10.4

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.



More information about the xorg-devel mailing list