VirtualBox

Ignore:
Timestamp:
Feb 1, 2017 11:51:44 AM (8 years ago)
Author:
vboxsync
Message:

bugref:8748: Additions/Graphics/Wayland: investigate EGLStreams support feasibility: modify guest GLX visual and FBConfig code to be independent of guest X11 visual configuration. Now we just report one of each with 32-bit ARGB instead of one for every X11 visual on the guest, some with 0-bit alpha and some with 8-bit. There was a comment in the code that we needed both 24-bit and 32-bit. I do not know why we should need 24-bit.

Change tested with a couple Unity and GNOME Shell versions, and glxinfo, glxgears, eglinfo and eglgears. More good test cases would be good. glxmark2 fails with both the old and the new code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/glx.c

    r65537 r65563  
    426426
    427427        case GLX_USE_GL:
    428             *value = 1;
     428            *value = vis->visualid == XVisualIDFromVisual(DefaultVisual(dpy, vis->screen));
    429429            break;
    430430
     
    10041004{
    10051005    ATTRIB_TYPE *attrib;
    1006     XVisualInfo *pVis;
    10071006    GLX_Pixmap_t *pGlxPixmap;
    10081007    (void) dpy;
     
    10401039    }
    10411040
    1042     pVis = VBOXGLXTAG(glXGetVisualFromFBConfig)(dpy, config);
    1043     if (!pVis)
    1044     {
    1045         crWarning("Unknown config %p in glXCreatePixmap", config);
    1046         return 0;
    1047     }
    1048 
    1049     pGlxPixmap->format = pVis->depth==24 ? GL_RGB:GL_RGBA;
     1041    pGlxPixmap->format = GL_RGBA;
    10501042    pGlxPixmap->target = GL_TEXTURE_2D;
    10511043
     
    12241216            break;
    12251217        case GLX_BIND_TO_TEXTURE_RGBA_EXT:
    1226             *value = pVisual->depth==32;
     1218            *value = True;
    12271219            break;
    12281220        case GLX_BIND_TO_TEXTURE_RGB_EXT:
     
    12381230        case GLX_ALPHA_SIZE:
    12391231            //crDebug("attribute=GLX_ALPHA_SIZE");
    1240             *value = pVisual->depth==32 ? 8:0;
     1232            *value = 8;
    12411233            break;
    12421234        case GLX_BUFFER_SIZE:
    12431235            //crDebug("attribute=GLX_BUFFER_SIZE");
    1244             *value = pVisual->depth;
     1236            *value = 32;
    12451237            break;
    12461238        case GLX_STENCIL_SIZE:
     
    13131305}
    13141306
    1315 #if !defined(VBOX_NO_NATIVEGL) || 1 /* need fbconfigs atleast for depths 24 and 32 */
    1316 DECLEXPORT(GLXFBConfig *) VBOXGLXTAG(glXGetFBConfigs)(Display *dpy, int screen, int *nelements)
    1317 {
    1318     GLXFBConfig *pGLXFBConfigs = NULL;
    1319     /*struct VisualInfo *v; */
    1320     int i=0;
    1321     XVisualInfo searchvis, *pVisuals;
    1322 
    1323     *nelements = 0;
    1324 
    1325     /*
    1326     for (v = VisualInfoList; v; v = v->next) {
    1327         if (v->dpy == dpy && v->screen == screen)
    1328             ++*nelements;
    1329     }
    1330 
    1331     if (*nelements)
    1332         pGLXFBConfigs = crAlloc(*nelements * sizeof(GLXFBConfig));
    1333 
    1334     for (v = VisualInfoList; v && i<*nelements; v = v->next) {
    1335         if (v->dpy == dpy && v->screen == screen)
    1336             pGLXFBConfigs[i++] = (GLXFBConfig) v->visualid;
    1337     }
    1338     */
    1339 
    1340     /*@todo doesn't really list all the common visuals, have to use some static list*/
    1341     searchvis.screen = screen;
    1342     XLOCK(dpy);
    1343     pVisuals = XGetVisualInfo(dpy, VisualScreenMask, &searchvis, nelements);
    1344     XUNLOCK(dpy);
    1345 
    1346     if (*nelements)
    1347         pGLXFBConfigs = crAlloc(*nelements * sizeof(GLXFBConfig));
    1348 
    1349     for (i=0; i<*nelements; ++i)
    1350     {
    1351         pGLXFBConfigs[i] = (GLXFBConfig) pVisuals[i].visualid;
    1352     }
    1353 
    1354     XFree(pVisuals);
    1355 
    1356     crDebug("glXGetFBConfigs returned %i configs", *nelements);
    1357     for (i=0; i<*nelements; ++i)
    1358     {
    1359         crDebug("glXGetFBConfigs[%i]=%p", i, pGLXFBConfigs[i]);
    1360     }
    1361     return pGLXFBConfigs;
    1362 }
    1363 #else /* not 0 */
    13641307DECLEXPORT(GLXFBConfig *) VBOXGLXTAG(glXGetFBConfigs)(Display *dpy, int screen, int *nelements)
    13651308{
     
    13761319    for (i=0; i<*nelements; ++i)
    13771320    {
    1378         crDebug("glXGetFBConfigs[%i]=0x%x", i, (unsigned int) pGLXFBConfigs[i]);
     1321        crDebug("glXGetFBConfigs[%i]=0x%x", i, (unsigned)(uintptr_t) pGLXFBConfigs[i]);
    13791322    }
    13801323    return pGLXFBConfigs;
    13811324}
    1382 #endif
    13831325
    13841326DECLEXPORT(void) VBOXGLXTAG(glXGetSelectedEvent)(Display *dpy, GLXDrawable draw, unsigned long *event_mask)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette