~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to src/VBox/Additions/common/crOpenGL/glx.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1850
1850
 
1851
1851
    if (!XGetGeometry(dpy, (Pixmap)draw, &root, &x, &y, &w, &h, &border, &depth))
1852
1852
    {
1853
 
        crWarning("stubInitGlxPixmap failed in call to XGetGeometry for 0x%x", (int) draw);
1854
 
        return NULL;
 
1853
        XSync(dpy, False);
 
1854
        if (!XGetGeometry(dpy, (Pixmap)draw, &root, &x, &y, &w, &h, &border, &depth))
 
1855
        {
 
1856
            crWarning("stubInitGlxPixmap failed in call to XGetGeometry for 0x%x", (int) draw);
 
1857
            return NULL;
 
1858
        }
1855
1859
    }
1856
1860
 
1857
1861
    pGlxPixmap = crAlloc(sizeof(GLX_Pixmap_t));
1868
1872
    pGlxPixmap->border = border;
1869
1873
    pGlxPixmap->depth = depth;
1870
1874
    pGlxPixmap->root = root;
 
1875
    pGlxPixmap->format = pGlxPixmap->depth==24 ? GL_RGB : GL_RGBA;
1871
1876
 
1872
1877
    /* Try to allocate shared memory
1873
1878
     * As we're allocating huge chunk of memory, do it in this function, only if this extension is really used
1921
1926
     * Note that we're making empty texture by passing NULL as pixels pointer, so there's no overhead transferring data to host.*/
1922
1927
    if (CR_MAX_TRANSFER_SIZE < 4*pGlxPixmap->w*pGlxPixmap->h)
1923
1928
    {
1924
 
        stub.spu->dispatch_table.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pGlxPixmap->w, pGlxPixmap->h, 0, 
 
1929
        stub.spu->dispatch_table.TexImage2D(GL_TEXTURE_2D, 0, pGlxPixmap->format, pGlxPixmap->w, pGlxPixmap->h, 0, 
1925
1930
                                            GL_BGRA, GL_UNSIGNED_BYTE, NULL);
1926
1931
    }
1927
1932
 
1966
1971
                  pGlxPixmap->x, pGlxPixmap->y, pGlxPixmap->w, pGlxPixmap->h, 0, 0);
1967
1972
        /* Have to make sure XCopyArea is processed */
1968
1973
        XSync(dpy, False);
1969
 
        stub.spu->dispatch_table.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pGlxPixmap->w, pGlxPixmap->h, 0, 
 
1974
        stub.spu->dispatch_table.TexImage2D(GL_TEXTURE_2D, 0, pGlxPixmap->format, pGlxPixmap->w, pGlxPixmap->h, 0, 
1970
1975
                                            GL_BGRA, GL_UNSIGNED_BYTE, stub.xshmSI.shmaddr);
1971
1976
        /*crDebug("Sync texture for drawable 0x%x(dmg handle 0x%x) [%i,%i,%i,%i]", 
1972
1977
                  (unsigned int) draw, (unsigned int)pGlxPixmap->hDamage, 
2125
2130
            return;
2126
2131
        }
2127
2132
 
2128
 
        stub.spu->dispatch_table.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pxim->width, pxim->height, 0, 
 
2133
        stub.spu->dispatch_table.TexImage2D(GL_TEXTURE_2D, 0, pGlxPixmap->format, pxim->width, pxim->height, 0, 
2129
2134
                                            GL_BGRA, GL_UNSIGNED_BYTE, (void*)(&(pxim->data[0])));
2130
2135
        XDestroyImage(pxim);
2131
2136
    }