Changeset 30474 in vbox
- Timestamp:
- Jun 28, 2010 3:58:12 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 63157
- Location:
- trunk/src/VBox/Additions/common/crOpenGL
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/context.c
r30440 r30474 152 152 153 153 GLboolean 154 stubIsWindowVisible( const WindowInfo *win)154 stubIsWindowVisible(WindowInfo *win) 155 155 { 156 156 #if defined(WINDOWS) … … 159 159 return GL_TRUE; 160 160 #elif defined(GLX) 161 if (win->dpy) { 162 XWindowAttributes attr; 163 XLOCK(win->dpy); 164 XGetWindowAttributes(win->dpy, win->drawable, &attr); 165 XUNLOCK(win->dpy); 166 return (attr.map_state != IsUnmapped); 161 Display *dpy = stubGetWindowDisplay(win); 162 if (dpy) 163 { 164 XWindowAttributes attr; 165 XLOCK(dpy); 166 XGetWindowAttributes(dpy, win->drawable, &attr); 167 XUNLOCK(dpy); 168 return (attr.map_state != IsUnmapped); 167 169 } 168 170 else { 169 /* probably created by crWindowCreate() */170 return win->mapped;171 /* probably created by crWindowCreate() */ 172 return win->mapped; 171 173 } 172 174 #endif … … 461 463 462 464 static void 463 GetCursorPosition( const WindowInfo *window, int pos[2])465 GetCursorPosition(WindowInfo *window, int pos[2]) 464 466 { 465 467 RECT rect; … … 569 571 570 572 void 571 stubGetWindowGeometry( const WindowInfo *window, int *x, int *y, 572 unsigned int *w, unsigned int *h ) 573 stubGetWindowGeometry(WindowInfo *window, int *x, int *y, unsigned int *w, unsigned int *h) 573 574 { 574 575 Window root, child; 575 576 unsigned int border, depth; 577 Display *dpy; 578 579 dpy = stubGetWindowDisplay(window); 576 580 577 581 //@todo: Performing those checks is expensive operation, especially for simple apps with high FPS. 578 582 // Disabling those tripples glxgears fps, thus using xevens instead of per frame polling is much more preffered. 579 583 //@todo: Check similiar on windows guests, though doubtfull as there're no XSync like calls on windows. 580 if (window && window->dpy)584 if (window && dpy) 581 585 { 582 XLOCK( window->dpy);586 XLOCK(dpy); 583 587 } 584 588 585 589 if (!window 586 || ! window->dpy590 || !dpy 587 591 || !window->drawable 588 || !XGetGeometry(window->dpy, window->drawable, &root, 589 x, y, w, h, &border, &depth) 590 || !XTranslateCoordinates(window->dpy, window->drawable, root, 591 0, 0, x, y, &child)) 592 || !XGetGeometry(dpy, window->drawable, &root, x, y, w, h, &border, &depth) 593 || !XTranslateCoordinates(dpy, window->drawable, root, 0, 0, x, y, &child)) 592 594 { 593 595 crWarning("Failed to get windows geometry for %p, try xwininfo", window); … … 596 598 } 597 599 598 if (window && window->dpy)600 if (window && dpy) 599 601 { 600 XUNLOCK( window->dpy);602 XUNLOCK(dpy); 601 603 } 602 604 } … … 650 652 */ 651 653 static void 652 GetCursorPosition( constWindowInfo *window, int pos[2] )654 GetCursorPosition(WindowInfo *window, int pos[2] ) 653 655 { 654 656 int rootX, rootY; … … 1078 1080 1079 1081 void 1080 stubSwapBuffers( const WindowInfo *window, GLint flags)1082 stubSwapBuffers(WindowInfo *window, GLint flags) 1081 1083 { 1082 1084 if (!window) -
trunk/src/VBox/Additions/common/crOpenGL/glx.c
r30440 r30474 1034 1034 DECLEXPORT(void) VBOXGLXTAG(glXSwapBuffers)( Display *dpy, GLXDrawable drawable ) 1035 1035 { 1036 constWindowInfo *window = stubGetWindowInfo(dpy, drawable);1036 WindowInfo *window = stubGetWindowInfo(dpy, drawable); 1037 1037 stubSwapBuffers( window, 0 ); 1038 1038 } -
trunk/src/VBox/Additions/common/crOpenGL/load.c
r30440 r30474 143 143 int x, y; 144 144 unsigned int border, depth, w, h; 145 146 XLOCK(pWindow->dpy); 147 if (!XGetGeometry(pWindow->dpy, pWindow->drawable, &root, &x, &y, &w, &h, &border, &depth)) 148 { 149 XUNLOCK(pWindow->dpy); 145 Display *dpy; 146 147 dpy = stubGetWindowDisplay(pWindow); 148 149 XLOCK(dpy); 150 if (!XGetGeometry(dpy, pWindow->drawable, &root, &x, &y, &w, &h, &border, &depth)) 151 { 152 XUNLOCK(dpy); 150 153 return false; 151 154 } 152 XUNLOCK( pWindow->dpy);155 XUNLOCK(dpy); 153 156 #endif 154 157 … … 782 785 crNetFreeConnection(ns.conn); 783 786 } 784 #if def CR_NEWWINTRACK787 #if 0 && defined(CR_NEWWINTRACK) 785 788 { 786 789 Status st = XInitThreads(); -
trunk/src/VBox/Additions/common/crOpenGL/stub.c
r30440 r30474 9 9 #include "cr_mem.h" 10 10 #include "stub.h" 11 #include <iprt/thread.h> 11 12 12 13 #ifdef GLX … … 28 29 } 29 30 31 Display* stubGetWindowDisplay(WindowInfo *pWindow) 32 { 33 #ifdef CR_NEWWINTRACK 34 if (RTThreadNativeSelf()==RTThreadGetNative(stub.hSyncThread)) 35 { 36 if (pWindow && pWindow->dpy && !pWindow->syncDpy) 37 { 38 crDebug("going to XOpenDisplay(%s)", pWindow->dpyName); 39 pWindow->syncDpy = XOpenDisplay(pWindow->dpyName); 40 if (!pWindow->syncDpy) 41 { 42 crWarning("Failed to open display %s", pWindow->dpyName); 43 } 44 return pWindow->syncDpy; 45 } 46 else 47 { 48 return pWindow ? pWindow->syncDpy:NULL; 49 } 50 } 51 else 52 #endif 53 { 54 return pWindow ? pWindow->dpy:NULL; 55 } 56 } 57 30 58 /** 31 59 * Returns -1 on error … … 81 109 void APIENTRY crSwapBuffers( GLint window, GLint flags ) 82 110 { 83 const WindowInfo *winInfo = (constWindowInfo *)111 WindowInfo *winInfo = (WindowInfo *) 84 112 crHashtableSearch(stub.windowTable, (unsigned int) window); 85 113 if (winInfo) … … 100 128 WindowInfo *winInfo = (WindowInfo *) 101 129 crHashtableSearch(stub.windowTable, (unsigned int) window); 102 if (winInfo && winInfo->type == CHROMIUM && stub.spu) { 130 if (winInfo && winInfo->type == CHROMIUM && stub.spu) 131 { 103 132 stub.spu->dispatch_table.WindowDestroy( winInfo->spuWindow ); 133 #ifdef CR_NEWWINTRACK 134 crLockMutex(&stub.mutex); 135 #endif 104 136 #ifdef WINDOWS 105 137 if (winInfo->hVisibleRegion != INVALID_HANDLE_VALUE) … … 112 144 XFree(winInfo->pVisibleRegions); 113 145 } 146 # ifdef CR_NEWWINTRACK 147 if (winInfo->syncDpy) 148 { 149 XCloseDisplay(winInfo->syncDpy); 150 } 151 # endif 152 #endif 153 #ifdef CR_NEWWINTRACK 154 crUnlockMutex(&stub.mutex); 114 155 #endif 115 156 crForcedFlush(); 116 117 157 crHashtableDelete(stub.windowTable, window, crFree); 118 158 } … … 446 486 XRectangle *pXRects; 447 487 GLint* pGLRects; 488 Display *dpy; 448 489 449 490 if (bExtensionsChecked || stubCheckXExtensions(pWindow)) … … 456 497 return GL_FALSE; 457 498 } 499 500 dpy = stubGetWindowDisplay(pWindow); 458 501 459 502 /*@todo see comment regarding size/position updates and XSync, same applies to those functions but 460 503 * it seems there's no way to get even based updates for this. Or I've failed to find the appropriate extension. 461 504 */ 462 XLOCK( pWindow->dpy);463 xreg = XCompositeCreateRegionFromBorderClip( pWindow->dpy, pWindow->drawable);464 pXRects = XFixesFetchRegion( pWindow->dpy, xreg, &cRects);465 XFixesDestroyRegion( pWindow->dpy, xreg);466 XUNLOCK( pWindow->dpy);505 XLOCK(dpy); 506 xreg = XCompositeCreateRegionFromBorderClip(dpy, pWindow->drawable); 507 pXRects = XFixesFetchRegion(dpy, xreg, &cRects); 508 XFixesDestroyRegion(dpy, xreg); 509 XUNLOCK(dpy); 467 510 468 511 /* @todo For some odd reason *first* run of compiz on freshly booted VM gives us 0 cRects all the time. -
trunk/src/VBox/Additions/common/crOpenGL/stub.h
r30440 r30474 46 46 #endif 47 47 48 #if def WINDOWS49 # define CR_NEWWINTRACK48 #if defined(WINDOWS) || defined(Linux) 49 # define CR_NEWWINTRACK 50 50 #endif 51 51 … … 54 54 #endif 55 55 56 #if defined(CR_NEWWINTRACK) && !defined(WINDOWS)56 #if 0 && defined(CR_NEWWINTRACK) && !defined(WINDOWS) 57 57 #define XLOCK(dpy) XLockDisplay(dpy) 58 58 #define XUNLOCK(dpy) XUnlockDisplay(dpy) … … 166 166 #elif defined(GLX) 167 167 Display *dpy; 168 # ifdef CR_NEWWINTRACK 169 Display *syncDpy; 170 # endif 168 171 GLXDrawable drawable; 169 172 XRectangle *pVisibleRegions; … … 279 282 extern WindowInfo *stubGetWindowInfo( Display *dpy, GLXDrawable drawable ); 280 283 extern void stubUseXFont( Display *dpy, Font font, int first, int count, int listbase ); 284 extern Display* stubGetWindowDisplay(WindowInfo *pWindow); 281 285 282 286 #endif … … 287 291 extern GLboolean stubMakeCurrent( WindowInfo *window, ContextInfo *context ); 288 292 extern GLint stubNewWindow( const char *dpyName, GLint visBits ); 289 extern void stubSwapBuffers( const WindowInfo *window, GLint flags);290 extern void stubGetWindowGeometry( const WindowInfo *win, int *x, int *y, unsigned int *w, unsigned int *h);293 extern void stubSwapBuffers(WindowInfo *window, GLint flags); 294 extern void stubGetWindowGeometry(WindowInfo *win, int *x, int *y, unsigned int *w, unsigned int *h); 291 295 extern GLboolean stubUpdateWindowGeometry(WindowInfo *pWindow, GLboolean bForceUpdate); 292 extern GLboolean stubIsWindowVisible( const WindowInfo *win);296 extern GLboolean stubIsWindowVisible(WindowInfo *win); 293 297 extern bool stubInit(void); 294 298
Note:
See TracChangeset
for help on using the changeset viewer.