Changeset 30440 in vbox
- Timestamp:
- Jun 24, 2010 6:51:20 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/VBoxCrOpenGLSvc.h
r28800 r30440 43 43 #define SHCRGL_GUEST_FN_WRITE_READ (4) 44 44 #define SHCRGL_GUEST_FN_SET_VERSION (6) 45 #define SHCRGL_GUEST_FN_INJECT (9) 45 46 46 47 /* Parameters count */ … … 53 54 #define SHCRGL_CPARMS_SET_VERSION (2) 54 55 #define SHCRGL_CPARMS_SCREEN_CHANGED (1) 56 #define SHCRGL_CPARMS_INJECT (2) 55 57 56 58 /** … … 125 127 } CRVBOXHGCMSETVERSION; 126 128 129 /** GUEST_FN_INJECT Parameters structure. */ 130 typedef struct 131 { 132 VBoxGuestHGCMCallInfo hdr; 133 134 /** 32bit, in 135 * ClientID to inject commands buffer for 136 */ 137 HGCMFunctionParameter u32ClientID; 138 /** pointer, in 139 * Data buffer 140 */ 141 HGCMFunctionParameter pBuffer; 142 } CRVBOXHGCMINJECT; 143 127 144 #endif -
trunk/src/VBox/Additions/common/crOpenGL/Makefile.kmk
r29790 r30440 130 130 VBoxOGL_SOURCES.solaris += \ 131 131 $(VBOX_PATH_CROGL_GENFILES)/solaris_glxapi_exports.asm \ 132 $(VBOX_PATH_CROGL_GENFILES)/solaris_exports_dri.asm \132 $(VBOX_PATH_CROGL_GENFILES)/solaris_exports_dri.asm 133 133 VBoxOGL_SOURCES.linux += \ 134 134 $(VBOX_PATH_CROGL_GENFILES)/linux_glxapi_exports.asm \ … … 136 136 VBoxOGL_SOURCES.freebsd += \ 137 137 $(VBOX_PATH_CROGL_GENFILES)/freebsd_glxapi_exports.asm \ 138 $(VBOX_PATH_CROGL_GENFILES)/freebsd_exports_dri.asm \ 139 138 $(VBOX_PATH_CROGL_GENFILES)/freebsd_exports_dri.asm 140 139 else 141 140 VBoxOGL_SOURCES.solaris += \ -
trunk/src/VBox/Additions/common/crOpenGL/context.c
r29454 r30440 140 140 winInfo->cVisibleRegions = 0; 141 141 #endif 142 #ifdef CR_NEWWINTRACK 143 winInfo->u32ClientID = stub.spu->dispatch_table.VBoxPackGetInjectID(); 144 #endif 142 145 winInfo->spuWindow = spuWin; 143 146 … … 158 161 if (win->dpy) { 159 162 XWindowAttributes attr; 163 XLOCK(win->dpy); 160 164 XGetWindowAttributes(win->dpy, win->drawable, &attr); 165 XUNLOCK(win->dpy); 161 166 return (attr.map_state != IsUnmapped); 162 167 } … … 216 221 winInfo->mapped = -1; /* don't know */ 217 222 winInfo->pOwner = NULL; 223 #ifdef CR_NEWWINTRACK 224 winInfo->u32ClientID = -1; 225 #endif 218 226 #ifndef WINDOWS 219 227 crHashtableAdd(stub.windowTable, (unsigned int) drawable, winInfo); … … 570 578 // Disabling those tripples glxgears fps, thus using xevens instead of per frame polling is much more preffered. 571 579 //@todo: Check similiar on windows guests, though doubtfull as there're no XSync like calls on windows. 580 if (window && window->dpy) 581 { 582 XLOCK(window->dpy); 583 } 584 572 585 if (!window 573 586 || !window->dpy … … 581 594 *x = *y = 0; 582 595 *w = *h = 0; 596 } 597 598 if (window && window->dpy) 599 { 600 XUNLOCK(window->dpy); 583 601 } 584 602 } … … 638 656 unsigned int mask; 639 657 int x, y; 658 659 XLOCK(window->dpy); 660 640 661 Bool q = XQueryPointer(window->dpy, window->drawable, &root, &child, 641 662 &rootX, &rootY, &pos[0], &pos[1], &mask); … … 649 670 pos[0] = pos[1] = 0; 650 671 } 672 673 XUNLOCK(window->dpy); 651 674 } 652 675 … … 854 877 /*crDebug("(1)stubMakeCurrent ctx=%p(%i) window=%p(%i)", context, context->spuContext, window, window->spuWindow);*/ 855 878 window->spuWindow = stub.spu->dispatch_table.WindowCreate( window->dpyName, context->visBits ); 879 #ifdef CR_NEWWINTRACK 880 window->u32ClientID = stub.spu->dispatch_table.VBoxPackGetInjectID(); 881 #endif 882 856 883 } 857 884 } … … 922 949 unsigned int border, depth, w, h; 923 950 951 XLOCK(context->currentDrawable->dpy); 924 952 if (!XGetGeometry(context->currentDrawable->dpy, context->currentDrawable->drawable, &root, &x, &y, &w, &h, &border, &depth)) 925 953 { 926 954 crWindowDestroy((GLint)context->currentDrawable->drawable); 927 955 } 956 XUNLOCK(context->currentDrawable->dpy); 928 957 #endif 929 958 … … 980 1009 if (stub.trackWindowSize) 981 1010 stub.spuDispatch.WindowSize( window->spuWindow, winW, winH ); 1011 if (stub.trackWindowPos) 1012 stub.spuDispatch.WindowPosition(window->spuWindow, x, y); 982 1013 if (winW > 0 && winH > 0) 983 1014 stub.spu->dispatch_table.Viewport( 0, 0, winW, winH ); -
trunk/src/VBox/Additions/common/crOpenGL/fakedri_drv.c
r28800 r30440 334 334 void __attribute__ ((constructor)) vbox_install_into_mesa(void) 335 335 { 336 if (!stubInit())337 {338 crDebug("vboxdriInitScreen: stubInit failed");339 return;340 }341 342 336 { 343 337 void (*pxf86Msg)(MessageType type, const char *format, ...) _printf_attribute(2,3); … … 354 348 return; 355 349 } 350 } 351 352 if (!stubInit()) 353 { 354 crDebug("vboxdriInitScreen: stubInit failed"); 355 return; 356 356 } 357 357 -
trunk/src/VBox/Additions/common/crOpenGL/glx.c
r28190 r30440 457 457 return NULL; 458 458 459 XLOCK(dpy); 459 460 searchvis.visualid = XVisualIDFromVisual(DefaultVisual(dpy, screen)); 460 461 pret = XGetVisualInfo(dpy, VisualIDMask, &searchvis, &nvisuals); 462 XUNLOCK(dpy); 461 463 462 464 if (nvisuals!=1) crWarning("glXChooseVisual: XGetVisualInfo returned %i visuals for %x", nvisuals, (unsigned int) searchvis.visualid); … … 644 646 645 647 if (context && context->type == UNDECIDED) { 648 XLOCK(dpy); 646 649 XSync(dpy, 0); /* sync to force window creation on the server */ 650 XUNLOCK(dpy); 647 651 } 648 652 } … … 1452 1456 if (pGlxPixmap) 1453 1457 { 1458 XLOCK(dpy); 1454 1459 if (pGlxPixmap->gc) 1455 1460 { … … 1461 1466 XFreePixmap(dpy, pGlxPixmap->hShmPixmap); 1462 1467 } 1468 XUNLOCK(dpy); 1463 1469 1464 1470 if (pGlxPixmap->hDamage>0) … … 1637 1643 /*@todo doesn't really list all the common visuals, have to use some static list*/ 1638 1644 searchvis.screen = screen; 1645 XLOCK(dpy); 1639 1646 pVisuals = XGetVisualInfo(dpy, VisualScreenMask, &searchvis, nelements); 1647 XUNLOCK(dpy); 1640 1648 1641 1649 if (*nelements) … … 1664 1672 1665 1673 *nelements = 1; 1674 XLOCK(dpy); 1666 1675 *pGLXFBConfigs = (GLXFBConfig) XVisualIDFromVisual(DefaultVisual(dpy, screen)); 1676 XUNLOCK(dpy); 1667 1677 1668 1678 crDebug("glXGetFBConfigs returned %i configs", *nelements); … … 1712 1722 1713 1723 temp.visualid = (VisualID)config; 1724 XLOCK(dpy); 1714 1725 pret = XGetVisualInfo(dpy, VisualIDMask, &temp, &nret); 1726 XUNLOCK(dpy); 1715 1727 1716 1728 if (nret!=1) crWarning("XGetVisualInfo returned %i visuals for %p", nret, config); … … 1781 1793 1782 1794 /* Check for extension and pixmaps format */ 1783 1795 XLOCK(dpy); 1784 1796 if (!XShmQueryExtension(dpy)) 1785 1797 { 1786 1798 crWarning("No XSHM extension"); 1799 XUNLOCK(dpy); 1787 1800 return; 1788 1801 } … … 1791 1804 { 1792 1805 crWarning("XSHM extension doesn't support pixmaps"); 1806 XUNLOCK(dpy); 1793 1807 return; 1794 1808 } … … 1797 1811 { 1798 1812 crWarning("XSHM extension doesn't support ZPixmap format"); 1813 XUNLOCK(dpy); 1799 1814 return; 1800 1815 } 1816 XUNLOCK(dpy); 1801 1817 1802 1818 /* Alloc shared memory, so far using hardcoded value...could fail for bigger displays one day */ … … 1817 1833 } 1818 1834 1819 1835 XLOCK(dpy); 1820 1836 if (!XShmAttach(dpy, &stub.xshmSI)) 1821 1837 { … … 1823 1839 shmctl(stub.xshmSI.shmid, IPC_RMID, 0); 1824 1840 shmdt(stub.xshmSI.shmaddr); 1841 XUNLOCK(dpy); 1825 1842 return; 1826 1843 } 1844 XUNLOCK(dpy); 1827 1845 1828 1846 stub.bShmInitFailed = GL_FALSE; … … 1915 1933 CRASSERT(pContext && pCreateInfoPixmap); 1916 1934 1935 XLOCK(dpy); 1917 1936 if (!XGetGeometry(dpy, (Pixmap)draw, &root, &x, &y, &w, &h, &border, &depth)) 1918 1937 { … … 1921 1940 { 1922 1941 crWarning("stubInitGlxPixmap failed in call to XGetGeometry for 0x%x", (int) draw); 1942 XUNLOCK(dpy); 1923 1943 return NULL; 1924 1944 } … … 1929 1949 { 1930 1950 crWarning("stubInitGlxPixmap failed to allocate memory"); 1951 XUNLOCK(dpy); 1931 1952 return NULL; 1932 1953 } … … 1965 1986 pGlxPixmap->hShmPixmap = 0; 1966 1987 } 1988 XUNLOCK(dpy); 1967 1989 1968 1990 stubInitXDamageExtension(pContext); … … 2036 2058 else 2037 2059 { 2060 XLOCK(dpy); 2038 2061 XCopyArea(dpy, (Pixmap)draw, pGlxPixmap->hShmPixmap, pGlxPixmap->gc, 2039 2062 pGlxPixmap->x, pGlxPixmap->y, pGlxPixmap->w, pGlxPixmap->h, 0, 0); 2040 2063 /* Have to make sure XCopyArea is processed */ 2041 2064 XSync(dpy, False); 2065 XUNLOCK(dpy); 2042 2066 stub.spu->dispatch_table.TexImage2D(pGlxPixmap->target, 0, pGlxPixmap->format, pGlxPixmap->w, pGlxPixmap->h, 0, 2043 2067 GL_BGRA, GL_UNSIGNED_BYTE, stub.xshmSI.shmaddr); … … 2078 2102 GLint origUnpackRowLength; 2079 2103 2104 XLOCK(dpy); 2080 2105 XCopyArea(dpy, (Pixmap)draw, pGlxPixmap->hShmPixmap, pGlxPixmap->gc, 2081 2106 pRect->x, pRect->y, pRect->width, pRect->height, 0, 0); 2082 2107 /* Have to make sure XCopyArea is processed */ 2083 2108 XSync(dpy, False); 2109 XUNLOCK(dpy); 2084 2110 2085 2111 /* Save original value, doesn't cause sync as it's reported by state tracker*/ … … 2159 2185 /* Sync connections, note that order of syncs is important here. 2160 2186 * First make sure client commands are finished, then make sure we get all the damage events back*/ 2187 XLOCK(dpy); 2161 2188 XSync(dpy, False); 2189 XUNLOCK(dpy); 2162 2190 XSync(stub.currentContext->damageDpy, False); 2163 2191 … … 2179 2207 XImage *pxim; 2180 2208 2209 XLOCK(dpy); 2181 2210 pxim = XGetImage(dpy, (Pixmap)draw, pGlxPixmap->x, pGlxPixmap->y, pGlxPixmap->w, pGlxPixmap->h, AllPlanes, ZPixmap); 2211 XUNLOCK(dpy); 2182 2212 /*if (pxim) 2183 2213 { -
trunk/src/VBox/Additions/common/crOpenGL/load.c
r26909 r30440 19 19 #include <string.h> 20 20 #include <signal.h> 21 #include <iprt/initterm.h> 22 #include <iprt/thread.h> 23 #include <iprt/err.h> 24 #include <iprt/asm.h> 21 25 #ifndef WINDOWS 22 # include <sys/types.h>23 # include <unistd.h>26 # include <sys/types.h> 27 # include <unistd.h> 24 28 #endif 25 29 #ifdef CHROMIUM_THREADSAFE … … 80 84 static ScissorFunc_t origScissor; 81 85 82 static void stubCheckWindowState(WindowInfo *window )86 static void stubCheckWindowState(WindowInfo *window, GLboolean bFlushOnChange) 83 87 { 84 88 bool bForceUpdate = false; 89 bool bChanged = false; 85 90 86 91 #ifdef WINDOWS … … 102 107 #endif 103 108 104 stubUpdateWindowGeometry(window, bForceUpdate);109 bChanged = stubUpdateWindowGeometry(window, bForceUpdate) || bForceUpdate; 105 110 106 111 #if defined(GLX) || defined (WINDOWS) 107 112 if (stub.trackWindowVisibleRgn) 108 113 { 109 stubUpdateWindowVisibileRegions(window);114 bChanged = stubUpdateWindowVisibileRegions(window) || bChanged; 110 115 } 111 116 #endif … … 117 122 stub.spu->dispatch_table.WindowShow(window->spuWindow, mapped); 118 123 window->mapped = mapped; 119 } 124 bChanged = true; 125 } 126 } 127 128 if (bFlushOnChange && bChanged) 129 { 130 stub.spu->dispatch_table.Flush(); 120 131 } 121 132 } … … 133 144 unsigned int border, depth, w, h; 134 145 146 XLOCK(pWindow->dpy); 135 147 if (!XGetGeometry(pWindow->dpy, pWindow->drawable, &root, &x, &y, &w, &h, &border, &depth)) 136 148 { 149 XUNLOCK(pWindow->dpy); 137 150 return false; 138 151 } 152 XUNLOCK(pWindow->dpy); 139 153 #endif 140 154 … … 164 178 } 165 179 166 stubCheckWindowState(pWindow );180 stubCheckWindowState(pWindow, GL_FALSE); 167 181 } 168 182 … … 174 188 return; 175 189 176 stubCheckWindowState(stub.currentContext->currentDrawable); 177 190 #if defined(CR_NEWWINTRACK) && !defined(WINDOWS) 191 crLockMutex(&stub.mutex); 192 #endif 193 194 stubCheckWindowState(stub.currentContext->currentDrawable, GL_TRUE); 178 195 crHashtableWalk(stub.windowTable, stubCheckWindowsCB, stub.currentContext); 196 197 #if defined(CR_NEWWINTRACK) && !defined(WINDOWS) 198 crUnlockMutex(&stub.mutex); 199 #endif 179 200 } 180 201 … … 253 274 origDrawBuffer = stub.spuDispatch.DrawBuffer; 254 275 origScissor = stub.spuDispatch.Scissor; 276 #ifndef CR_NEWWINTRACK 255 277 stub.spuDispatch.Clear = trapClear; 256 278 stub.spuDispatch.Viewport = trapViewport; 279 #endif 257 280 if (stub.viewportHack) 258 281 stub.spuDispatch.Scissor = trapScissor; … … 282 305 283 306 #ifdef WINDOWS 307 # ifndef CR_NEWWINTRACK 284 308 stubUninstallWindowMessageHook(); 309 # endif 310 #endif 311 312 #ifdef CR_NEWWINTRACK 313 ASMAtomicWriteBool(&stub.bShutdownSyncThread, true); 285 314 #endif 286 315 … … 330 359 #endif 331 360 crDebug("stubSPUSafeTearDown"); 361 362 #ifdef WINDOWS 363 # ifndef CR_NEWWINTRACK 364 stubUninstallWindowMessageHook(); 365 # endif 366 #endif 367 368 #if defined(WINDOWS) && defined(CR_NEWWINTRACK) 369 crUnlockMutex(mutex); 370 if (RTThreadGetState(stub.hSyncThread)!=RTTHREADSTATE_TERMINATED) 371 { 372 ASMAtomicWriteBool(&stub.bShutdownSyncThread, true); 373 if (PostThreadMessage(RTThreadGetNative(stub.hSyncThread), WM_QUIT, 0, 0)) 374 { 375 RTThreadWait(stub.hSyncThread, 1000, NULL); 376 } 377 else 378 { 379 crDebug("Sync thread killed before DLL_PROCESS_DETACH"); 380 } 381 } 382 crLockMutex(mutex); 383 #endif 384 332 385 crNetTearDown(); 333 #ifdef WINDOWS334 stubUninstallWindowMessageHook();335 #endif336 386 crMemset(&stub, 0, sizeof(stub)); 337 387 #ifdef CHROMIUM_THREADSAFE … … 393 443 394 444 stub.windowTable = crAllocHashtable(); 445 446 #ifdef CR_NEWWINTRACK 447 stub.bShutdownSyncThread = false; 448 stub.hSyncThread = NIL_RTTHREAD; 449 #endif 395 450 396 451 defaultWin = (WindowInfo *) crCalloc(sizeof(WindowInfo)); … … 595 650 } 596 651 652 #ifdef CR_NEWWINTRACK 653 static void stubSyncTrCheckWindowsCB(unsigned long key, void *data1, void *data2) 654 { 655 WindowInfo *pWindow = (WindowInfo *) data1; 656 ContextInfo *pCtx = (ContextInfo *) data2; 657 658 if (pWindow->type!=CHROMIUM || pWindow->spuWindow==0) 659 { 660 return; 661 } 662 663 stub.spu->dispatch_table.VBoxPackSetInjectID(pWindow->u32ClientID); 664 665 if (!stubSystemWindowExist(pWindow)) 666 { 667 #ifdef WINDOWS 668 crWindowDestroy((GLint)pWindow->hWnd); 669 #else 670 crWindowDestroy((GLint)pWindow->drawable); 671 #endif 672 /*No need to flush here as crWindowDestroy does it*/ 673 return; 674 } 675 676 stubCheckWindowState(pWindow, GL_TRUE); 677 } 678 679 static DECLCALLBACK(int) stubSyncThreadProc(RTTHREAD ThreadSelf, void *pvUser) 680 { 681 #ifdef WINDOWS 682 MSG msg; 683 #endif 684 685 (void) pvUser; 686 687 crDebug("Sync thread started"); 688 #ifdef WINDOWS 689 PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE); 690 #endif 691 692 crLockMutex(&stub.mutex); 693 stub.spu->dispatch_table.VBoxPackSetInjectThread(); 694 crUnlockMutex(&stub.mutex); 695 696 RTThreadUserSignal(ThreadSelf); 697 698 while(!stub.bShutdownSyncThread) 699 { 700 #ifdef WINDOWS 701 if (!PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) 702 { 703 crHashtableWalk(stub.windowTable, stubSyncTrCheckWindowsCB, NULL); 704 RTThreadSleep(50); 705 } 706 else 707 { 708 if (WM_QUIT==msg.message) 709 { 710 crDebug("Sync thread got WM_QUIT"); 711 break; 712 } 713 else 714 { 715 TranslateMessage(&msg); 716 DispatchMessage(&msg); 717 } 718 } 719 #else 720 crLockMutex(&stub.mutex); 721 crHashtableWalk(stub.windowTable, stubSyncTrCheckWindowsCB, NULL); 722 crUnlockMutex(&stub.mutex); 723 RTThreadSleep(50); 724 #endif 725 } 726 727 crDebug("Sync thread stopped"); 728 return 0; 729 } 730 #endif 731 597 732 /** 598 733 * Do one-time initializations for the faker. … … 623 758 stubInitVars(); 624 759 760 crGetProcName(response, 1024); 761 crDebug("Stub launched for %s", response); 762 625 763 /* @todo check if it'd be of any use on other than guests, no use for windows */ 626 764 app_id = crGetenv( "CR_APPLICATION_ID_NUMBER" ); … … 644 782 crNetFreeConnection(ns.conn); 645 783 } 784 #ifdef CR_NEWWINTRACK 785 { 786 Status st = XInitThreads(); 787 if (st==0) 788 { 789 crWarning("XInitThreads returned %i", (int)st); 790 } 791 } 792 #endif 646 793 } 647 794 #endif … … 692 839 693 840 #ifdef WINDOWS 841 # ifndef CR_NEWWINTRACK 694 842 stubInstallWindowMessageHook(); 843 # endif 844 #endif 845 846 #ifdef CR_NEWWINTRACK 847 { 848 int rc; 849 850 RTR3Init(); 851 852 crDebug("Starting sync thread"); 853 854 rc = RTThreadCreate(&stub.hSyncThread, stubSyncThreadProc, NULL, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "Sync"); 855 if (RT_FAILURE(rc)) 856 { 857 crError("Failed to start sync thread! (%x)", rc); 858 } 859 RTThreadUserWait(stub.hSyncThread, 60 * 1000); 860 RTThreadUserReset(stub.hSyncThread); 861 862 crDebug("Going on"); 863 } 695 864 #endif 696 865 … … 704 873 return true; 705 874 } 706 707 708 875 709 876 /* Sigh -- we can't do initialization at load time, since Windows forbids -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h
r20879 r30440 35 35 CRPackContext *packer; 36 36 int writeback; 37 GLboolean bInjectThread; 37 38 }; 38 39 -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
r21308 r30440 36 36 thread->id = id; 37 37 thread->currentContext = NULL; 38 thread->bInjectThread = GL_FALSE; 38 39 39 40 /* connect to the server */ -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
r27091 r30440 108 108 int writeback = 1; 109 109 110 crPackFlush(); 111 112 if (packspuSyncOnFlushes()) 113 { 114 crPackWriteback(&writeback); 110 if (!thread->bInjectThread) 111 { 112 crPackFlush(); 113 if (packspuSyncOnFlushes()) 114 { 115 crPackWriteback(&writeback); 116 packspuFlush( (void *) thread ); 117 while (writeback) 118 crNetRecv(); 119 } 120 } 121 else 122 { 115 123 packspuFlush( (void *) thread ); 116 while (writeback)117 crNetRecv();118 124 } 119 125 } … … 336 342 } 337 343 } 344 345 #ifdef CHROMIUM_THREADSAFE 346 void PACKSPU_APIENTRY packspu_VBoxPackSetInjectThread(void) 347 { 348 crLockMutex(&_PackMutex); 349 { 350 GET_THREAD(thread); 351 CRASSERT(!thread); 352 CRASSERT((pack_spu.numThreads>0) && (pack_spu.numThreads<MAX_THREADS)); 353 354 thread = &(pack_spu.thread[pack_spu.numThreads]); 355 thread->id = crThreadID(); 356 thread->currentContext = NULL; 357 thread->bInjectThread = GL_TRUE; 358 359 thread->netServer.name = crStrdup(pack_spu.name); 360 thread->netServer.buffer_size = 64 * 1024; 361 362 crNetNewClient(pack_spu.thread[0].netServer.conn, &(thread->netServer)); 363 CRASSERT(thread->netServer.conn); 364 365 CRASSERT(thread->packer == NULL); 366 thread->packer = crPackNewContext( pack_spu.swap ); 367 CRASSERT(thread->packer); 368 crPackInitBuffer(&(thread->buffer), crNetAlloc(thread->netServer.conn), 369 thread->netServer.conn->buffer_size, thread->netServer.conn->mtu); 370 thread->buffer.canBarf = thread->netServer.conn->Barf ? GL_TRUE : GL_FALSE; 371 372 crPackSetBuffer( thread->packer, &thread->buffer ); 373 crPackFlushFunc( thread->packer, packspuFlush ); 374 crPackFlushArg( thread->packer, (void *) thread ); 375 crPackSendHugeFunc( thread->packer, packspuHuge ); 376 crPackSetContext( thread->packer ); 377 378 crSetTSD(&_PackTSD, thread); 379 380 pack_spu.numThreads++; 381 } 382 crUnlockMutex(&_PackMutex); 383 } 384 385 GLuint PACKSPU_APIENTRY packspu_VBoxPackGetInjectID(void) 386 { 387 GLuint ret; 388 389 crLockMutex(&_PackMutex); 390 { 391 GET_THREAD(thread); 392 CRASSERT(thread && thread->netServer.conn && thread->netServer.conn->type==CR_VBOXHGCM); 393 ret = thread->netServer.conn->u32ClientID; 394 } 395 crUnlockMutex(&_PackMutex); 396 397 return ret; 398 } 399 400 void PACKSPU_APIENTRY packspu_VBoxPackSetInjectID(GLuint id) 401 { 402 crLockMutex(&_PackMutex); 403 { 404 GET_THREAD(thread); 405 CRASSERT(thread && thread->netServer.conn && thread->netServer.conn->type==CR_VBOXHGCM); 406 thread->netServer.conn->u32InjectClientID = id; 407 } 408 crUnlockMutex(&_PackMutex); 409 } 410 #else /*ifdef CHROMIUM_THREADSAFE*/ 411 void PACKSPU_APIENTRY packspu_VBoxPackSetInjectThread(void) 412 { 413 } 414 415 GLuint PACKSPU_APIENTRY packspu_VBoxPackGetInjectID(void) 416 { 417 return 0; 418 } 419 420 void PACKSPU_APIENTRY packspu_VBoxPackSetInjectID(GLuint id) 421 { 422 (void) id; 423 } 424 #endif /*CHROMIUM_THREADSAFE*/ -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_special
r28552 r30440 102 102 GetCompressedTexImageARB 103 103 BindRenderbufferEXT 104 VBoxPackSetInjectThread 105 VBoxPackGetInjectID 106 VBoxPackSetInjectID -
trunk/src/VBox/Additions/common/crOpenGL/stub.c
r29017 r30440 17 17 static void crForcedFlush() 18 18 { 19 #if 0 19 20 GLint buffer; 20 21 stub.spu->dispatch_table.GetIntegerv(GL_DRAW_BUFFER, &buffer); … … 22 23 stub.spu->dispatch_table.Flush(); 23 24 stub.spu->dispatch_table.DrawBuffer(buffer); 25 #else 26 stub.spu->dispatch_table.Flush(); 27 #endif 24 28 } 25 29 … … 291 295 } 292 296 297 # ifndef CR_NEWWINTRACK 293 298 static void stubCBCheckWindowsInfo(unsigned long key, void *data1, void *data2) 294 299 { … … 393 398 UnhookWindowsHookEx(stub.hMessageHook); 394 399 } 400 # endif /*# ifndef CR_NEWWINTRACK*/ 401 395 402 #elif defined(GLX) //#ifdef WINDOWS 396 403 static GLboolean stubCheckXExtensions(WindowInfo *pWindow) … … 398 405 int evb, erb, vmi=0, vma=0; 399 406 407 XLOCK(pWindow->dpy); 400 408 if (XCompositeQueryExtension(pWindow->dpy, &evb, &erb) 401 409 && XCompositeQueryVersion(pWindow->dpy, &vma, &vmi) … … 410 418 { 411 419 crDebug("XFixes %i.%i", vma, vmi); 420 XUNLOCK(pWindow->dpy); 412 421 return GL_TRUE; 413 422 } … … 421 430 crWarning("XComposite not found or old version (%i.%i), no VisibilityTracking", vma, vmi); 422 431 } 432 XUNLOCK(pWindow->dpy); 423 433 return GL_FALSE; 424 434 } … … 450 460 * it seems there's no way to get even based updates for this. Or I've failed to find the appropriate extension. 451 461 */ 462 XLOCK(pWindow->dpy); 452 463 xreg = XCompositeCreateRegionFromBorderClip(pWindow->dpy, pWindow->drawable); 453 464 pXRects = XFixesFetchRegion(pWindow->dpy, xreg, &cRects); 454 465 XFixesDestroyRegion(pWindow->dpy, xreg); 466 XUNLOCK(pWindow->dpy); 455 467 456 468 /* @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
r26909 r30440 46 46 #endif 47 47 48 #ifdef WINDOWS 49 #define CR_NEWWINTRACK 50 #endif 51 52 #if !defined(CHROMIUM_THREADSAFE) && defined(CR_NEWWINTRACK) 53 # error CHROMIUM_THREADSAFE have to be defined 54 #endif 55 56 #if defined(CR_NEWWINTRACK) && !defined(WINDOWS) 57 #define XLOCK(dpy) XLockDisplay(dpy) 58 #define XUNLOCK(dpy) XUnlockDisplay(dpy) 59 #else 60 #define XLOCK(dpy) 61 #define XUNLOCK(dpy) 62 #endif 48 63 49 64 /* When we first create a rendering context we can't be sure whether … … 140 155 GLboolean mapped; 141 156 #ifdef WINDOWS 142 HDC drawable;143 HRGN hVisibleRegion;144 DWORD dmPelsWidth;145 DWORD dmPelsHeight;146 HWND hWnd;157 HDC drawable; 158 HRGN hVisibleRegion; 159 DWORD dmPelsWidth; 160 DWORD dmPelsHeight; 161 HWND hWnd; 147 162 #elif defined(DARWIN) 148 163 CGSConnectionID connection; … … 154 169 XRectangle *pVisibleRegions; 155 170 GLint cVisibleRegions; 171 #endif 172 #ifdef CR_NEWWINTRACK 173 uint32_t u32ClientID; 156 174 #endif 157 175 }; … … 214 232 215 233 #ifdef WINDOWS 216 HHOOK hMessageHook; 217 #endif 234 # ifndef CR_NEWWINTRACK 235 HHOOK hMessageHook; 236 # endif 237 #endif 238 239 #ifdef CR_NEWWINTRACK 240 RTTHREAD hSyncThread; 241 bool volatile bShutdownSyncThread; 242 #endif 243 218 244 } Stub; 219 245 -
trunk/src/VBox/GuestHost/OpenGL/glapi_parser/APIspec.txt
r27244 r30440 8500 8500 chromium extpack 8501 8501 8502 name VBoxPackSetInjectThread 8503 return void 8504 category VBox 8505 chromium nopack 8506 8507 name VBoxPackGetInjectID 8508 return GLuint 8509 category VBox 8510 chromium nopack 8511 8512 name VBoxPackSetInjectID 8513 return void 8514 param id GLuint 8515 category VBox 8516 chromium nopack 8502 8517 8503 8518 # OpenGL 1.5 -
trunk/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py
r27267 r30440 353 353 cat == "1.2" or 354 354 cat == "Chromium" or 355 cat == "GL_chromium"): 355 cat == "GL_chromium" or 356 cat == "VBox"): 356 357 return '' 357 358 elif (cat == '1.3' or -
trunk/src/VBox/GuestHost/OpenGL/include/cr_net.h
r21523 r30440 220 220 uint32_t cbHostBufferAllocated; 221 221 uint32_t cbHostBuffer; 222 #ifdef IN_GUEST 223 uint32_t u32InjectClientID; 224 #endif 222 225 /* Used on host side to indicate that we are not allowed to store above pointers for later use 223 226 * in crVBoxHGCMReceiveMessage. As those messages are going to be processed after the correspoding -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c
r29930 r30440 232 232 * Ensures context bits are reset */ 233 233 crStateFreeContext(defaultContext); 234 #ifdef CHROMIUM_THREADSAFE 235 crSetTSD(&__contextTSD, NULL); 236 #else 237 __currentContext = NULL; 238 #endif 234 239 } 235 240 -
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
r28800 r30440 331 331 static void crVBoxHGCMWriteExact(CRConnection *conn, const void *buf, unsigned int len) 332 332 { 333 CRVBOXHGCMWRITE parms;334 333 int rc; 335 336 parms.hdr.result = VERR_WRONG_ORDER; 337 parms.hdr.u32ClientID = conn->u32ClientID; 338 parms.hdr.u32Function = SHCRGL_GUEST_FN_WRITE; 339 parms.hdr.cParms = SHCRGL_CPARMS_WRITE; 340 341 parms.pBuffer.type = VMMDevHGCMParmType_LinAddr_In; 342 parms.pBuffer.u.Pointer.size = len; 343 parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) buf; 344 345 rc = crVBoxHGCMCall(&parms, sizeof(parms)); 346 347 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.result)) 348 { 349 crWarning("SHCRGL_GUEST_FN_WRITE failed with %x %x\n", rc, parms.hdr.result); 334 int32_t callRes; 335 336 #ifdef IN_GUEST 337 if (conn->u32InjectClientID) 338 { 339 CRVBOXHGCMINJECT parms; 340 341 parms.hdr.result = VERR_WRONG_ORDER; 342 parms.hdr.u32ClientID = conn->u32ClientID; 343 parms.hdr.u32Function = SHCRGL_GUEST_FN_INJECT; 344 parms.hdr.cParms = SHCRGL_CPARMS_INJECT; 345 346 parms.u32ClientID.type = VMMDevHGCMParmType_32bit; 347 parms.u32ClientID.u.value32 = conn->u32InjectClientID; 348 349 parms.pBuffer.type = VMMDevHGCMParmType_LinAddr_In; 350 parms.pBuffer.u.Pointer.size = len; 351 parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) buf; 352 353 rc = crVBoxHGCMCall(&parms, sizeof(parms)); 354 callRes = parms.hdr.result; 355 } 356 else 357 #endif 358 { 359 CRVBOXHGCMWRITE parms; 360 361 parms.hdr.result = VERR_WRONG_ORDER; 362 parms.hdr.u32ClientID = conn->u32ClientID; 363 parms.hdr.u32Function = SHCRGL_GUEST_FN_WRITE; 364 parms.hdr.cParms = SHCRGL_CPARMS_WRITE; 365 366 parms.pBuffer.type = VMMDevHGCMParmType_LinAddr_In; 367 parms.pBuffer.u.Pointer.size = len; 368 parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) buf; 369 370 rc = crVBoxHGCMCall(&parms, sizeof(parms)); 371 callRes = parms.hdr.result; 372 } 373 374 if (RT_FAILURE(rc) || RT_FAILURE(callRes)) 375 { 376 crWarning("SHCRGL_GUEST_FN_WRITE failed with %x %x\n", rc, callRes); 350 377 } 351 378 } … … 476 503 _crVBoxHGCMWriteBytes(conn, start, len); 477 504 #else 505 CRASSERT(!conn->u32InjectClientID); 478 506 crDebug("SHCRGL: sending userbuf with %d bytes\n", len); 479 507 crVBoxHGCMWriteReadExact(conn, start, len, CR_VBOXHGCM_USERALLOCATED); … … 493 521 * No need to prepend it to the buffer 494 522 */ 523 #ifdef IN_GUEST 524 if (conn->u32InjectClientID) 525 { 526 crVBoxHGCMWriteExact(conn, start, len); 527 } 528 else 529 #endif 495 530 crVBoxHGCMWriteReadExact(conn, start, len, hgcm_buffer->kind); 496 531 -
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r29019 r30440 277 277 } 278 278 279 case SHCRGL_GUEST_FN_INJECT: 280 { 281 Log(("svcCall: SHCRGL_GUEST_FN_INJECT\n")); 282 283 /* Verify parameter count and types. */ 284 if (cParms != SHCRGL_CPARMS_INJECT) 285 { 286 rc = VERR_INVALID_PARAMETER; 287 } 288 else 289 if ( paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* u32ClientID */ 290 || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR /* pBuffer */ 291 ) 292 { 293 rc = VERR_INVALID_PARAMETER; 294 } 295 else 296 { 297 /* Fetch parameters. */ 298 uint32_t u32InjectClientID = paParms[0].u.uint32; 299 uint8_t *pBuffer = (uint8_t *)paParms[1].u.pointer.addr; 300 uint32_t cbBuffer = paParms[1].u.pointer.size; 301 302 /* Execute the function. */ 303 rc = crVBoxServerClientWrite(u32InjectClientID, pBuffer, cbBuffer); 304 if (!RT_SUCCESS(rc)) 305 { 306 Assert(VERR_NOT_SUPPORTED==rc); 307 svcClientVersionUnsupported(0, 0); 308 } 309 310 } 311 break; 312 } 313 279 314 case SHCRGL_GUEST_FN_READ: 280 315 { -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r29930 r30440 381 381 int32_t i; 382 382 383 / /crDebug("crServer: [%x] ClientWrite u32ClientID=%d", crThreadID(), u32ClientID);383 /*crDebug("=>crServer: ClientWrite u32ClientID=%d", u32ClientID);*/ 384 384 385 385 for (i = 0; i < cr_server.numClients; i++) … … 451 451 452 452 CRASSERT(!pClient->conn->allow_redir_ptr || crNetNumMessages(pClient->conn)==0); 453 454 /*crDebug("<=crServer: ClientWrite u32ClientID=%d", u32ClientID);*/ 453 455 454 456 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.