- Timestamp:
- Nov 24, 2010 11:52:39 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/glx.c
r34138 r34309 633 633 } 634 634 635 typedef struct _stubFindPixmapParms_t { 636 ContextInfo *pCtx; 637 GLX_Pixmap_t *pGlxPixmap; 638 GLXDrawable draw; 639 } stubFindPixmapParms_t; 640 641 static void stubFindPixmapCB(unsigned long key, void *data1, void *data2) 642 { 643 ContextInfo *pCtx = (ContextInfo *) data1; 644 stubFindPixmapParms_t *pParms = (stubFindPixmapParms_t *) data2; 645 GLX_Pixmap_t *pGlxPixmap = (GLX_Pixmap_t *) crHashtableSearch(pCtx->pGLXPixmapsHash, (unsigned int) pParms->draw); 646 647 if (pGlxPixmap) 648 { 649 pParms->pCtx = pCtx; 650 pParms->pGlxPixmap = pGlxPixmap; 651 } 652 } 635 653 636 654 DECLEXPORT(Bool) VBOXGLXTAG(glXMakeCurrent)( Display *dpy, GLXDrawable drawable, GLXContext ctx ) … … 641 659 642 660 /*crDebug("glXMakeCurrent(%p, 0x%x, 0x%x)", (void *) dpy, (int) drawable, (int) ctx);*/ 661 662 /*check if passed drawable is GLXPixmap and not X Window*/ 663 if (drawable) 664 { 665 GLX_Pixmap_t *pGlxPixmap = (GLX_Pixmap_t *) crHashtableSearch(stub.pGLXPixmapsHash, (unsigned int) drawable); 666 667 if (!pGlxPixmap) 668 { 669 stubFindPixmapParms_t parms; 670 parms.pGlxPixmap = NULL; 671 parms.draw = drawable; 672 crHashtableWalk(stub.contextTable, stubFindPixmapCB, &parms); 673 pGlxPixmap = parms.pGlxPixmap; 674 } 675 676 if (pGlxPixmap) 677 { 678 /*@todo*/ 679 crWarning("Unimplemented glxMakeCurrent call with GLXPixmap passed, unexpected things might happen."); 680 } 681 } 643 682 644 683 if (ctx && drawable) { … … 1647 1686 GLXFBConfig *realcfg; 1648 1687 int nconfigs; 1649 //XVisualInfo *vis;1650 (void) dpy;1651 1688 (void) config; 1652 (void) win; 1653 (void) attrib_list; 1654 //crWarning("glXCreateWindow not implemented by Chromium"); 1655 //vis = VBOXGLXTAG(glXGetVisualFromFBConfig)(config); 1689 1656 1690 if (stub.wsInterface.glXGetFBConfigs) 1657 1691 { … … 1669 1703 else 1670 1704 { 1671 crWarning("glXCreateWindow stub.wsInterface.glXChooseFBConfig==NULL"); 1672 return 0; 1705 if (attrib_list && *attrib_list!=None) 1706 { 1707 crWarning("Non empty attrib list in glXCreateWindow"); 1708 return 0; 1709 } 1710 return (GLXWindow)win; 1673 1711 } 1674 1712 } … … 1683 1721 DECLEXPORT(void) VBOXGLXTAG(glXDestroyPixmap)(Display *dpy, GLXPixmap pixmap) 1684 1722 { 1685 GLX_Pixmap_t *pGlxPixmap; 1686 1687 if (!stub.currentContext) 1688 { 1689 crWarning("glXDestroyPixmap failed, no current context"); 1723 stubFindPixmapParms_t parms; 1724 1725 if (crHashtableSearch(stub.pGLXPixmapsHash, (unsigned int) pixmap)) 1726 { 1727 /*it's valid but never used glxpixmap, so simple free stored ptr*/ 1728 crHashtableDelete(stub.pGLXPixmapsHash, (unsigned int) pixmap, crFree); 1690 1729 return; 1691 1730 } 1692 1693 pGlxPixmap = (GLX_Pixmap_t *) crHashtableSearch(stub.currentContext->pGLXPixmapsHash, (unsigned int) pixmap); 1694 1695 if (pGlxPixmap) 1696 { 1697 XLOCK(dpy); 1698 if (pGlxPixmap->gc) 1699 { 1700 XFreeGC(dpy, pGlxPixmap->gc); 1701 } 1702 1703 if (pGlxPixmap->hShmPixmap>0) 1704 { 1705 XFreePixmap(dpy, pGlxPixmap->hShmPixmap); 1706 } 1707 XUNLOCK(dpy); 1708 1709 if (pGlxPixmap->hDamage>0) 1710 { 1711 //crDebug("Destroy: Damage for drawable 0x%x, handle 0x%x", (unsigned int) pixmap, (unsigned int) pGlxPixmap->damage); 1712 XDamageDestroy(stub.currentContext->damageDpy, pGlxPixmap->hDamage); 1713 } 1714 1715 if (pGlxPixmap->pDamageRegion) 1716 { 1717 XDestroyRegion(pGlxPixmap->pDamageRegion); 1718 } 1719 1720 crHashtableDelete(stub.currentContext->pGLXPixmapsHash, (unsigned int) pixmap, crFree); 1721 } 1722 /*else 1731 else 1732 { 1733 /*it's either invalid glxpixmap or one which was already initialized, so it's stored in appropriate ctx hash*/ 1734 parms.pCtx = NULL; 1735 parms.pGlxPixmap = NULL; 1736 parms.draw = pixmap; 1737 crHashtableWalk(stub.contextTable, stubFindPixmapCB, &parms); 1738 } 1739 1740 if (!parms.pGlxPixmap) 1723 1741 { 1724 1742 crWarning("glXDestroyPixmap called for unknown glxpixmap 0x%x", (unsigned int) pixmap); 1725 }*/ 1743 return; 1744 } 1745 1746 XLOCK(dpy); 1747 if (parms.pGlxPixmap->gc) 1748 { 1749 XFreeGC(dpy, parms.pGlxPixmap->gc); 1750 } 1751 1752 if (parms.pGlxPixmap->hShmPixmap>0) 1753 { 1754 XFreePixmap(dpy, parms.pGlxPixmap->hShmPixmap); 1755 } 1756 XUNLOCK(dpy); 1757 1758 if (parms.pGlxPixmap->hDamage>0) 1759 { 1760 //crDebug("Destroy: Damage for drawable 0x%x, handle 0x%x", (unsigned int) pixmap, (unsigned int) parms.pGlxPixmap->damage); 1761 XDamageDestroy(parms.pCtx->damageDpy, parms.pGlxPixmap->hDamage); 1762 } 1763 1764 if (parms.pGlxPixmap->pDamageRegion) 1765 { 1766 XDestroyRegion(parms.pGlxPixmap->pDamageRegion); 1767 } 1768 1769 crHashtableDelete(parms.pCtx->pGLXPixmapsHash, (unsigned int) pixmap, crFree); 1726 1770 } 1727 1771 … … 1730 1774 (void) dpy; 1731 1775 (void) win; 1732 crWarning("glXDestroyWindow not implemented by Chromium");1776 /*crWarning("glXDestroyWindow not implemented by Chromium");*/ 1733 1777 } 1734 1778 1735 1779 DECLEXPORT(GLXDrawable) VBOXGLXTAG(glXGetCurrentReadDrawable)(void) 1736 1780 { 1737 //crWarning("glXGetCurrentReadDrawable not implemented by Chromium");1738 1781 return currentReadDrawable; 1739 1782 } … … 1993 2036 DECLEXPORT(Bool) VBOXGLXTAG(glXMakeContextCurrent)(Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx) 1994 2037 { 1995 (void) display;1996 (void) draw;1997 (void) read;1998 (void) ctx;1999 //crWarning("glXMakeContextCurrent not implemented by Chromium");2000 2038 currentReadDrawable = read; 2001 2039 return VBOXGLXTAG(glXMakeCurrent)(display, draw, ctx);
Note:
See TracChangeset
for help on using the changeset viewer.