VirtualBox

Ignore:
Timestamp:
Oct 25, 2017 2:24:45 PM (7 years ago)
Author:
vboxsync
Message:

common/crOpenGL: scm updates

File:
1 edited

Legend:

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

    • Property svn:keywords set to Id Revision
    r69040 r69310  
    1 /* $Id: dri_drv.c 100879 2015-06-09 14:26:20Z bird $ */
    2 
     1/* $Id$ */
    32/** @file
    43 * VBox OpenGL GLX implementation
     
    4039#define CR_MAX_DAMAGE_REGIONS_TRACKED 50
    4140
    42 /* Force "bigger" update (full or clip) if it's reducing number of regions updated 
     41/* Force "bigger" update (full or clip) if it's reducing number of regions updated
    4342 * but doesn't increase updated area more than given number
    4443 */
    4544#define CR_MIN_DAMAGE_PROFIT_SIZE 64*64
    4645
    47 /*@todo combine it in some other place*/
     46/** @todo combine it in some other place*/
    4847/* Size of pack spu buffer - some delta for commands packing, see pack/packspu_config.c*/
    4948
     
    218217    pret = XGetVisualInfo(dpy, VisualIDMask, &searchvis, &nvisuals);
    219218    XUNLOCK(dpy);
    220      
     219
    221220    if (nvisuals!=1) crWarning("glXChooseVisual: XGetVisualInfo returned %i visuals for %x", nvisuals, (unsigned int) searchvis.visualid);
    222221    if (pret)
     
    232231 **  There is a problem with glXCopyContext.
    233232 ** IRIX and Mesa both define glXCopyContext
    234  ** to have the mask argument being a 
     233 ** to have the mask argument being a
    235234 ** GLuint.  XFree 4 and oss.sgi.com
    236235 ** define it to be an unsigned long.
     
    240239 */
    241240DECLEXPORT(void)
    242 VBOXGLXTAG(glXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, 
     241VBOXGLXTAG(glXCopyContext)( Display *dpy, GLXContext src, GLXContext dst,
    243242#if defined(AIX) || defined(PLAYSTATION2)
    244243GLuint mask
     
    377376        if (pGlxPixmap)
    378377        {
    379             /*@todo*/
     378            /** @todo */
    380379            crWarning("Unimplemented glxMakeCurrent call with GLXPixmap passed, unexpected things might happen.");
    381380        }
     
    523522#if defined(SunOS) || 1
    524523        /*
    525           I don't think this is even a valid attribute for glxGetConfig. 
     524          I don't think this is even a valid attribute for glxGetConfig.
    526525          No idea why this gets called under SunOS but we simply ignore it
    527526          -- jw
     
    530529          crWarning ("Ignoring Unsupported GLX Call: glxGetConfig with attrib 0x%x", attrib);
    531530          break;
    532 #endif 
     531#endif
    533532
    534533        case GLX_TRANSPARENT_TYPE:
     
    679678
    680679        case GLX_EXTENSIONS:
    681             /*@todo should be a screen not a name...but it's not used anyway*/
     680            /** @todo should be a screen not a name...but it's not used anyway*/
    682681            retval  = glXQueryExtensionsString(dpy, name);
    683682            break;
     
    730729#if GLX_EXTRAS
    731730
    732 DECLEXPORT(GLXPbufferSGIX) 
     731DECLEXPORT(GLXPbufferSGIX)
    733732VBOXGLXTAG(glXCreateGLXPbufferSGIX)(Display *dpy, GLXFBConfigSGIX config,
    734733                                    unsigned int width, unsigned int height,
     
    782781}
    783782
    784 DECLEXPORT(GLXFBConfigSGIX *) 
     783DECLEXPORT(GLXFBConfigSGIX *)
    785784VBOXGLXTAG(glXChooseFBConfigSGIX)(Display *dpy, int screen,
    786785                                  int *attrib_list, int *nelements)
     
    789788}
    790789
    791 DECLEXPORT(GLXPixmap) 
     790DECLEXPORT(GLXPixmap)
    792791VBOXGLXTAG(glXCreateGLXPixmapWithConfigSGIX)(Display *dpy,
    793792                                             GLXFBConfig config,
     
    797796}
    798797
    799 DECLEXPORT(GLXContext) 
     798DECLEXPORT(GLXContext)
    800799VBOXGLXTAG(glXCreateContextWithConfigSGIX)(Display *dpy, GLXFBConfig config,
    801800                                           int render_type,
     
    812811}
    813812
    814 DECLEXPORT(XVisualInfo *) 
     813DECLEXPORT(XVisualInfo *)
    815814VBOXGLXTAG(glXGetVisualFromFBConfigSGIX)(Display *dpy,
    816815                                         GLXFBConfig config)
     
    969968}
    970969
    971 DECLEXPORT(GLXContext) 
     970DECLEXPORT(GLXContext)
    972971VBOXGLXTAG(glXCreateNewContext)(Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct)
    973972{
     
    987986}
    988987
    989 DECLEXPORT(GLXPbuffer) 
     988DECLEXPORT(GLXPbuffer)
    990989VBOXGLXTAG(glXCreatePbuffer)(Display *dpy, GLXFBConfig config, ATTRIB_TYPE *attrib_list)
    991990{
     
    1000999 * Instead we'd do necessary initialization on first use of those pixmaps.
    10011000 */
    1002 DECLEXPORT(GLXPixmap) 
     1001DECLEXPORT(GLXPixmap)
    10031002VBOXGLXTAG(glXCreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, ATTRIB_TYPE *attrib_list)
    10041003{
     
    10851084}
    10861085
    1087 DECLEXPORT(GLXWindow) 
     1086DECLEXPORT(GLXWindow)
    10881087VBOXGLXTAG(glXCreateWindow)(Display *dpy, GLXFBConfig config, Window win, ATTRIB_TYPE *attrib_list)
    10891088{
     
    12941293            break;
    12951294        default:
    1296             crDebug("glXGetFBConfigAttrib: unknown attribute=0x%x", attribute); 
     1295            crDebug("glXGetFBConfigAttrib: unknown attribute=0x%x", attribute);
    12971296            return GLX_BAD_ATTRIBUTE;
    12981297    }
     
    14401439    crInfo("Using XSHM for GLX_EXT_texture_from_pixmap");
    14411440
    1442     /*Anyway mark to be deleted when our process detaches it, in case of segfault etc*/   
     1441    /*Anyway mark to be deleted when our process detaches it, in case of segfault etc*/
    14431442
    14441443/* Ramshankar: Solaris compiz fix */
     
    14531452
    14541453    CRASSERT(pContext);
    1455    
     1454
    14561455    if (pContext->damageQueryFailed)
    14571456        return;
     
    14791478        int        nReturnRects;
    14801479
    1481         /* Get the damage region as a server region */ 
     1480        /* Get the damage region as a server region */
    14821481        XserverRegion serverDamageRegion = XFixesCreateRegion (dpy, NULL, 0);
    14831482
     
    16101609        pGlxPixmap->gc = XCreateGC(dpy, (Pixmap)draw, GCGraphicsExposures|GCSubwindowMode, &xgcv);
    16111610
    1612         pGlxPixmap->hShmPixmap = XShmCreatePixmap(dpy, pGlxPixmap->root, stub.xshmSI.shmaddr, &stub.xshmSI, 
     1611        pGlxPixmap->hShmPixmap = XShmCreatePixmap(dpy, pGlxPixmap->root, stub.xshmSI.shmaddr, &stub.xshmSI,
    16131612                                                  pGlxPixmap->w, pGlxPixmap->h, pGlxPixmap->depth);
    16141613    }
     
    16411640    }
    16421641
    1643     /* glTexSubImage2D generates GL_INVALID_OP if texture array hasn't been defined by a call to glTexImage2D first. 
     1642    /* glTexSubImage2D generates GL_INVALID_OP if texture array hasn't been defined by a call to glTexImage2D first.
    16441643     * It's fine for small textures which would be updated in stubXshmUpdateWholeImage, but we'd never call glTexImage2D for big ones.
    16451644     * Note that we're making empty texture by passing NULL as pixels pointer, so there's no overhead transferring data to host.*/
    16461645    if (CR_MAX_TRANSFER_SIZE < 4*pGlxPixmap->w*pGlxPixmap->h)
    16471646    {
    1648         stub.spu->dispatch_table.TexImage2D(pGlxPixmap->target, 0, pGlxPixmap->format, pGlxPixmap->w, pGlxPixmap->h, 0, 
     1647        stub.spu->dispatch_table.TexImage2D(pGlxPixmap->target, 0, pGlxPixmap->format, pGlxPixmap->w, pGlxPixmap->h, 0,
    16491648                                            GL_BGRA, GL_UNSIGNED_BYTE, NULL);
    16501649    }
     
    16601659    /* To limit the size of transferring buffer, split bigger texture into regions
    16611660     * which fit into connection buffer. Could be done in hgcm or packspu but implementation in this place allows to avoid
    1662      * unnecessary memcpy. 
     1661     * unnecessary memcpy.
    16631662     * This also workarounds guest driver failures when sending 6+mb texture buffers on linux.
    16641663     */
     
    16911690
    16921691        XLOCK(dpy);
    1693         XCopyArea(dpy, (Pixmap)draw, pGlxPixmap->hShmPixmap, pGlxPixmap->gc, 
     1692        XCopyArea(dpy, (Pixmap)draw, pGlxPixmap->hShmPixmap, pGlxPixmap->gc,
    16941693                  pGlxPixmap->x, pGlxPixmap->y, pGlxPixmap->w, pGlxPixmap->h, 0, 0);
    16951694        /* Have to make sure XCopyArea is processed */
    16961695        XSync(dpy, False);
    16971696        XUNLOCK(dpy);
    1698        
     1697
    16991698        stubGetUnpackState(&unpackState);
    17001699        stubSetUnpackState(&defaultPacking);
    1701         stub.spu->dispatch_table.TexImage2D(pGlxPixmap->target, 0, pGlxPixmap->format, pGlxPixmap->w, pGlxPixmap->h, 0, 
     1700        stub.spu->dispatch_table.TexImage2D(pGlxPixmap->target, 0, pGlxPixmap->format, pGlxPixmap->w, pGlxPixmap->h, 0,
    17021701                                            GL_BGRA, GL_UNSIGNED_BYTE, stub.xshmSI.shmaddr);
    17031702        stubSetUnpackState(&unpackState);
    1704         /*crDebug("Sync texture for drawable 0x%x(dmg handle 0x%x) [%i,%i,%i,%i]", 
    1705                   (unsigned int) draw, (unsigned int)pGlxPixmap->hDamage, 
     1703        /*crDebug("Sync texture for drawable 0x%x(dmg handle 0x%x) [%i,%i,%i,%i]",
     1704                  (unsigned int) draw, (unsigned int)pGlxPixmap->hDamage,
    17061705                  pGlxPixmap->x, pGlxPixmap->y, pGlxPixmap->w, pGlxPixmap->h);*/
    17071706    }
     
    17391738
    17401739        XLOCK(dpy);
    1741         XCopyArea(dpy, (Pixmap)draw, pGlxPixmap->hShmPixmap, pGlxPixmap->gc, 
     1740        XCopyArea(dpy, (Pixmap)draw, pGlxPixmap->hShmPixmap, pGlxPixmap->gc,
    17421741                  pRect->x, pRect->y, pRect->width, pRect->height, 0, 0);
    17431742        /* Have to make sure XCopyArea is processed */
     
    17511750            stub.spu->dispatch_table.PixelStorei(GL_UNPACK_ROW_LENGTH, pGlxPixmap->w);
    17521751        }
    1753         stub.spu->dispatch_table.TexSubImage2D(pGlxPixmap->target, 0, pRect->x, pRect->y, pRect->width, pRect->height, 
     1752        stub.spu->dispatch_table.TexSubImage2D(pGlxPixmap->target, 0, pRect->x, pRect->y, pRect->width, pRect->height,
    17541753                                               GL_BGRA, GL_UNSIGNED_BYTE, stub.xshmSI.shmaddr);
    17551754        stubSetUnpackState(&unpackState);
    17561755
    1757         /*crDebug("Region sync texture for drawable 0x%x(dmg handle 0x%x) [%i,%i,%i,%i]", 
    1758                 (unsigned int) draw, (unsigned int)pGlxPixmap->hDamage, 
     1756        /*crDebug("Region sync texture for drawable 0x%x(dmg handle 0x%x) [%i,%i,%i,%i]",
     1757                (unsigned int) draw, (unsigned int)pGlxPixmap->hDamage,
    17591758                pRect->x, pRect->y, pRect->width, pRect->height);*/
    17601759    }
     
    17691768        ContextInfo *context = stubGetCurrentContext();
    17701769        XDamageNotifyEvent *e = (XDamageNotifyEvent *) event;
    1771         /* we're interested in pixmaps only...and those have e->drawable set to 0 or other strange value for some odd reason 
     1770        /* we're interested in pixmaps only...and those have e->drawable set to 0 or other strange value for some odd reason
    17721771         * so have to walk glxpixmaps hashtable to find if we have damage event handle assigned to some pixmap
    17731772         */
     
    17821781#endif
    17831782
    1784 /*@todo check what error codes could we throw for failures here*/
     1783/** @todo check what error codes could we throw for failures here*/
    17851784DECLEXPORT(void) VBOXGLXTAG(glXBindTexImageEXT)(Display *dpy, GLXDrawable draw, int buffer, const int *attrib_list)
    17861785{
     
    18261825    if (stub.xshmSI.shmid<0)
    18271826    {
    1828         /*@todo add damage support here too*/
     1827        /** @todo add damage support here too*/
    18291828        XImage *pxim;
    18301829        CRPixelPackState unpackState;
     
    18601859        stubGetUnpackState(&unpackState);
    18611860        stubSetUnpackState(&defaultPacking);
    1862         stub.spu->dispatch_table.TexImage2D(pGlxPixmap->target, 0, pGlxPixmap->format, pxim->width, pxim->height, 0, 
     1861        stub.spu->dispatch_table.TexImage2D(pGlxPixmap->target, 0, pGlxPixmap->format, pxim->width, pxim->height, 0,
    18631862                                            GL_BGRA, GL_UNSIGNED_BYTE, (void*)(&(pxim->data[0])));
    18641863        stubSetUnpackState(&unpackState);
     
    19001899                    {
    19011900                        crWarning("glXBindTexImageEXT, damage regions seems to be broken, forcing full update");
    1902                         /*crDebug("**FULL** update for 0x%x, numRect=%li, *FS*=%li, CS=%li, DS=%li", 
     1901                        /*crDebug("**FULL** update for 0x%x, numRect=%li, *FS*=%li, CS=%li, DS=%li",
    19031902                                (unsigned int)draw, pGlxPixmap->pDamageRegion->numRects, fullArea, clipdamageArea, damageArea);*/
    19041903                        stubXshmUpdateWholeImage(dpy, draw, pGlxPixmap);
     
    19081907                        if (CR_MIN_DAMAGE_PROFIT_SIZE > (fullArea-damageArea))
    19091908                        {
    1910                             /*crDebug("**FULL** update for 0x%x, numRect=%li, *FS*=%li, CS=%li, DS=%li", 
     1909                            /*crDebug("**FULL** update for 0x%x, numRect=%li, *FS*=%li, CS=%li, DS=%li",
    19111910                                    (unsigned int)draw, pGlxPixmap->pDamageRegion->numRects, fullArea, clipdamageArea, damageArea);*/
    19121911                            stubXshmUpdateWholeImage(dpy, draw, pGlxPixmap);
     
    19141913                        else if (CR_MIN_DAMAGE_PROFIT_SIZE > (clipdamageArea-damageArea))
    19151914                        {
    1916                             /*crDebug("**PARTIAL** update for 0x%x, numRect=%li, FS=%li, *CS*=%li, DS=%li", 
     1915                            /*crDebug("**PARTIAL** update for 0x%x, numRect=%li, FS=%li, *CS*=%li, DS=%li",
    19171916                                    (unsigned int)draw, pGlxPixmap->pDamageRegion->numRects, fullArea, clipdamageArea, damageArea);*/
    19181917                            stubXshmUpdateImageRect(dpy, draw, pGlxPixmap, &damageClipBox);
     
    19201919                        else
    19211920                        {
    1922                             /*crDebug("**PARTIAL** update for 0x%x, numRect=*%li*, FS=%li, CS=%li, *DS*=%li", 
     1921                            /*crDebug("**PARTIAL** update for 0x%x, numRect=*%li*, FS=%li, CS=%li, *DS*=%li",
    19231922                                    (unsigned int)draw, pGlxPixmap->pDamageRegion->numRects, fullArea, clipdamageArea, damageArea);*/
    19241923                            for (i=0; i<pGlxPixmap->pDamageRegion->numRects; ++i)
     
    19261925                                XRectangle rect;
    19271926                                BoxPtr pBox = &pGlxPixmap->pDamageRegion->rects[i];
    1928                                
     1927
    19291928                                rect.x = pBox->x1;
    19301929                                rect.y = pBox->y1;
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