Changeset 32420 in vbox
- Timestamp:
- Sep 10, 2010 4:25:10 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/context.c
r32149 r32420 150 150 } 151 151 152 #ifdef GLX 153 static XErrorHandler oldErrorHandler; 154 static unsigned char lastXError = Success; 155 156 static int 157 errorHandler (Display *dpy, XErrorEvent *e) 158 { 159 lastXError = e->error_code; 160 return 0; 161 } 162 #endif 152 163 153 164 GLboolean … … 166 177 XGetWindowAttributes(dpy, win->drawable, &attr); 167 178 XUNLOCK(dpy); 168 return (attr.map_state != IsUnmapped); 179 180 if (attr.map_state == IsUnmapped) 181 { 182 return GL_FALSE; 183 } 184 # if 1 185 return GL_TRUE; 186 # else 187 if (attr.override_redirect) 188 { 189 return GL_TRUE; 190 } 191 192 if (!stub.bXExtensionsChecked) 193 { 194 stubCheckXExtensions(win); 195 } 196 197 if (!stub.bHaveXComposite) 198 { 199 return GL_TRUE; 200 } 201 else 202 { 203 Pixmap p; 204 205 crLockMutex(&stub.mutex); 206 207 XLOCK(dpy); 208 XSync(dpy, false); 209 oldErrorHandler = XSetErrorHandler(errorHandler); 210 /*@todo this will create new pixmap for window every call*/ 211 p = XCompositeNameWindowPixmap(dpy, win->drawable); 212 XSync(dpy, false); 213 XSetErrorHandler(oldErrorHandler); 214 XUNLOCK(dpy); 215 216 switch (lastXError) 217 { 218 case Success: 219 XFreePixmap(dpy, p); 220 crUnlockMutex(&stub.mutex); 221 return GL_FALSE; 222 break; 223 case BadMatch: 224 /*Window isn't redirected*/ 225 lastXError = Success; 226 break; 227 default: 228 crWarning("Unexpected XError %i", (int)lastXError); 229 lastXError = Success; 230 } 231 232 crUnlockMutex(&stub.mutex); 233 234 return GL_TRUE; 235 } 236 # endif 169 237 } 170 238 else { … … 882 950 window->u32ClientID = stub.spu->dispatch_table.VBoxPackGetInjectID(); 883 951 #endif 884 885 952 } 886 953 } … … 938 1005 /*crDebug("(2)stubMakeCurrent ctx=%p(%i) window=%p(%i)", context, context->spuContext, window, window->spuWindow);*/ 939 1006 window->spuWindow = stub.spu->dispatch_table.WindowCreate( window->dpyName, context->visBits ); 1007 #ifdef CR_NEWWINTRACK 1008 window->u32ClientID = stub.spu->dispatch_table.VBoxPackGetInjectID(); 1009 #endif 940 1010 if (context->currentDrawable && context->currentDrawable->type==CHROMIUM 941 1011 && context->currentDrawable->pOwner==context) -
trunk/src/VBox/Additions/common/crOpenGL/glx.c
r32041 r32420 1032 1032 } 1033 1033 1034 static XErrorHandler oldErrorHandler; 1035 static unsigned char lastXError = Success; 1036 1037 static int 1038 errorHandler (Display *dpy, XErrorEvent *e) 1039 { 1040 lastXError = e->error_code; 1041 return 0; 1042 } 1043 1034 1044 DECLEXPORT(void) VBOXGLXTAG(glXSwapBuffers)( Display *dpy, GLXDrawable drawable ) 1035 1045 { 1036 1046 WindowInfo *window = stubGetWindowInfo(dpy, drawable); 1037 1047 stubSwapBuffers( window, 0 ); 1048 1049 #ifdef VBOX_TEST_MEGOO 1050 if (!stub.bXExtensionsChecked) 1051 { 1052 stubCheckXExtensions(window); 1053 } 1054 1055 if (!stub.bHaveXComposite) 1056 { 1057 return; 1058 } 1059 1060 { 1061 Pixmap p; 1062 XWindowAttributes attr; 1063 1064 XLOCK(dpy); 1065 XGetWindowAttributes(dpy, window->drawable, &attr); 1066 if (attr.override_redirect) 1067 { 1068 XUNLOCK(dpy); 1069 return; 1070 } 1071 1072 crLockMutex(&stub.mutex); 1073 1074 XSync(dpy, false); 1075 oldErrorHandler = XSetErrorHandler(errorHandler); 1076 /*@todo this creates new pixmap for window every call*/ 1077 /*p = XCompositeNameWindowPixmap(dpy, window->drawable);*/ 1078 XSync(dpy, false); 1079 XSetErrorHandler(oldErrorHandler); 1080 XUNLOCK(dpy); 1081 1082 if (lastXError==Success) 1083 { 1084 char *data, *imgdata; 1085 GC gc; 1086 XImage *image; 1087 XVisualInfo searchvis, *pret; 1088 int nvisuals; 1089 XGCValues gcValues; 1090 int i, rowsize; 1091 1092 XLOCK(dpy); 1093 1094 searchvis.visualid = attr.visual->visualid; 1095 pret = XGetVisualInfo(dpy, VisualIDMask, &searchvis, &nvisuals); 1096 if (nvisuals!=1) crWarning("XGetVisualInfo returned %i visuals for %x", nvisuals, (unsigned int) searchvis.visualid); 1097 CRASSERT(pret); 1098 1099 gc = XCreateGC(dpy, window->drawable, 0, &gcValues); 1100 if (!gc) crWarning("Failed to create gc!"); 1101 1102 data = crCalloc(window->width * window->height * 4); 1103 imgdata = crCalloc(window->width * window->height * 4); 1104 CRASSERT(data && imgdata); 1105 stub.spu->dispatch_table.ReadPixels(0, 0, window->width, window->height, GL_RGBA, GL_UNSIGNED_BYTE, data); 1106 /*y-invert image*/ 1107 rowsize = 4*window->width; 1108 for (i=0; i<window->height; ++i) 1109 { 1110 crMemcpy(imgdata+rowsize*i, data+rowsize*(window->height-i-1), rowsize); 1111 } 1112 crFree(data); 1113 1114 XSync(dpy, false); 1115 image = XCreateImage(dpy, attr.visual, pret->depth, ZPixmap, 0, imgdata, window->width, window->height, 32, 0); 1116 XPutImage(dpy, window->drawable, gc, image, 0, 0, 0, 0, window->width, window->height); 1117 1118 XFree(pret); 1119 /*XFreePixmap(dpy, p);*/ 1120 XFreeGC(dpy, gc); 1121 XDestroyImage(image); 1122 XUNLOCK(dpy); 1123 } 1124 lastXError=Success; 1125 crUnlockMutex(&stub.mutex); 1126 } 1127 #endif 1038 1128 } 1039 1129 … … 1342 1432 (void) dpy; 1343 1433 (void) config; 1434 1435 #if 0 1436 { 1437 int x, y; 1438 unsigned int w, h; 1439 unsigned int border; 1440 unsigned int depth; 1441 Window root; 1442 1443 crDebug("glXCreatePixmap called for %lu", pixmap); 1444 1445 XLOCK(dpy); 1446 if (!XGetGeometry(dpy, pixmap, &root, &x, &y, &w, &h, &border, &depth)) 1447 { 1448 XSync(dpy, False); 1449 if (!XGetGeometry(dpy, pixmap, &root, &x, &y, &w, &h, &border, &depth)) 1450 { 1451 crDebug("fail"); 1452 } 1453 } 1454 crDebug("root: %lu, [%i,%i %u,%u]", root, x, y, w, h); 1455 XUNLOCK(dpy); 1456 } 1457 #endif 1344 1458 1345 1459 pGlxPixmap = crCalloc(sizeof(GLX_Pixmap_t)); -
trunk/src/VBox/Additions/common/crOpenGL/load.c
r32241 r32420 391 391 } 392 392 #else 393 ASMAtomicWriteBool(&stub.bShutdownSyncThread, true); 394 { 395 /*RTThreadWait might return too early, which cause our code being unloaded while RT thread wrapper is still running*/ 396 int rc = pthread_join(RTThreadGetNative(stub.hSyncThread), NULL); 397 if (!rc) 398 { 399 crDebug("pthread_join failed %i", rc); 393 if (stub.hSyncThread!=NIL_RTTHREAD) 394 { 395 ASMAtomicWriteBool(&stub.bShutdownSyncThread, true); 396 { 397 /*RTThreadWait might return too early, which cause our code being unloaded while RT thread wrapper is still running*/ 398 int rc = pthread_join(RTThreadGetNative(stub.hSyncThread), NULL); 399 if (!rc) 400 { 401 crDebug("pthread_join failed %i", rc); 402 } 400 403 } 401 404 } … … 1124 1127 stub.bShmInitFailed = GL_FALSE; 1125 1128 stub.pGLXPixmapsHash = crAllocHashtable(); 1129 1130 stub.bXExtensionsChecked = GL_FALSE; 1131 stub.bHaveXComposite = GL_FALSE; 1132 stub.bHaveXFixes = GL_FALSE; 1126 1133 #endif 1127 1134 -
trunk/src/VBox/Additions/common/crOpenGL/stub.c
r30486 r32420 10 10 #include "stub.h" 11 11 #include <iprt/thread.h> 12 13 #ifdef GLX14 #include <X11/extensions/Xcomposite.h>15 #include <X11/extensions/Xfixes.h>16 #endif17 12 18 13 static void crForcedFlush() … … 33 28 { 34 29 #if defined(CR_NEWWINTRACK) 35 if ( RTThreadNativeSelf()==RTThreadGetNative(stub.hSyncThread))30 if ((NIL_RTTHREAD!=stub.hSyncThread) && (RTThreadNativeSelf()==RTThreadGetNative(stub.hSyncThread))) 36 31 { 37 32 if (pWindow && pWindow->dpy && !pWindow->syncDpy) … … 443 438 444 439 #elif defined(GLX) //#ifdef WINDOWS 445 static GLbooleanstubCheckXExtensions(WindowInfo *pWindow)440 void stubCheckXExtensions(WindowInfo *pWindow) 446 441 { 447 442 int evb, erb, vmi=0, vma=0; 448 443 Display *dpy = stubGetWindowDisplay(pWindow); 444 445 stub.bXExtensionsChecked = GL_TRUE; 446 stub.trackWindowVisibleRgn = 0; 449 447 450 448 XLOCK(dpy); … … 453 451 && (vma>0 || vmi>=4)) 454 452 { 453 stub.bHaveXComposite = GL_TRUE; 455 454 crDebug("XComposite %i.%i", vma, vmi); 456 455 vma=0; … … 461 460 { 462 461 crDebug("XFixes %i.%i", vma, vmi); 462 stub.bHaveXFixes = GL_TRUE; 463 stub.trackWindowVisibleRgn = 1; 463 464 XUNLOCK(dpy); 464 return GL_TRUE;465 return; 465 466 } 466 467 else … … 474 475 } 475 476 XUNLOCK(dpy); 476 return GL_FALSE;477 return; 477 478 } 478 479 … … 483 484 GLboolean stubUpdateWindowVisibileRegions(WindowInfo *pWindow) 484 485 { 485 static GLboolean bExtensionsChecked = GL_FALSE;486 487 486 XserverRegion xreg; 488 487 int cRects, i; … … 490 489 GLint* pGLRects; 491 490 Display *dpy; 492 493 if (bExtensionsChecked || stubCheckXExtensions(pWindow)) 494 {495 bExtensionsChecked = GL_TRUE;496 }497 else498 {499 stub.trackWindowVisibleRgn = 0;500 return GL_FALSE;491 bool bNoUpdate = false; 492 493 if (!stub.bXExtensionsChecked) 494 { 495 stubCheckXExtensions(pWindow); 496 if (!stub.trackWindowVisibleRgn) 497 { 498 return GL_FALSE; 499 } 501 500 } 502 501 … … 512 511 XUNLOCK(dpy); 513 512 514 /* @todo For some odd reason *first* run of compiz on freshly booted VM gives us 0 cRects all the time. 515 * In (!pWindow->pVisibleRegions && cRects) "&& cRects" is a workaround for that case, especially as this 516 * information is useless for full screen composing managers anyway. 517 * If this is changed, make sure to change crVBoxServerLoadState accordingly. 518 */ 519 if ((!pWindow->pVisibleRegions && cRects) 520 || pWindow->cVisibleRegions!=cRects 521 || (pWindow->pVisibleRegions && crMemcmp(pWindow->pVisibleRegions, pXRects, cRects * sizeof(XRectangle)))) 522 { 513 /* Check for compiz main window */ 514 if (!pWindow->pVisibleRegions && !cRects) 515 { 516 #ifdef VBOX_TEST_MEGOO 517 XWindowAttributes attr; 518 XLOCK(dpy); 519 XSync(dpy, false); 520 XGetWindowAttributes(dpy, pWindow->drawable, &attr); 521 XUNLOCK(dpy); 522 523 bNoUpdate = attr.override_redirect; 524 #else 525 bNoUpdate = true; 526 #endif 527 } 528 529 if (!bNoUpdate 530 && (!pWindow->pVisibleRegions 531 || pWindow->cVisibleRegions!=cRects 532 || (pWindow->pVisibleRegions && crMemcmp(pWindow->pVisibleRegions, pXRects, cRects * sizeof(XRectangle))))) 533 { 534 if (pWindow->pVisibleRegions) 535 { 536 XFree(pWindow->pVisibleRegions); 537 } 538 523 539 pWindow->pVisibleRegions = pXRects; 524 540 pWindow->cVisibleRegions = cRects; -
trunk/src/VBox/Additions/common/crOpenGL/stub.h
r30598 r32420 44 44 #include <sys/shm.h> 45 45 #include <X11/extensions/Xdamage.h> 46 #include <X11/extensions/Xcomposite.h> 47 #include <X11/extensions/Xfixes.h> 46 48 #endif 47 49 … … 53 55 # error CHROMIUM_THREADSAFE have to be defined 54 56 #endif 57 58 /*#define VBOX_TEST_MEGOO*/ 55 59 56 60 #if 0 && defined(CR_NEWWINTRACK) && !defined(WINDOWS) … … 232 236 233 237 CRHashTable *pGLXPixmapsHash; 238 239 GLboolean bXExtensionsChecked; 240 GLboolean bHaveXComposite; 241 GLboolean bHaveXFixes; 234 242 #endif 235 243 … … 284 292 extern Display* stubGetWindowDisplay(WindowInfo *pWindow); 285 293 294 extern void stubCheckXExtensions(WindowInfo *pWindow); 286 295 #endif 287 296 -
trunk/src/VBox/GuestHost/OpenGL/util/error.c
r30973 r32420 285 285 { 286 286 const char *fname = crGetenv( "CR_DEBUG_FILE" ); 287 char str[1024]; 288 289 #if defined(Linux) && defined(IN_GUEST) && defined(DEBUG_leo) 290 if (!fname) 291 { 292 char pname[1024]; 293 crGetProcName(pname, 1024); 294 sprintf(str, "/home/leo/crlog_%s.txt", pname); 295 fname = &str[0]; 296 } 297 #endif 298 287 299 first_time = 0; 288 300 if (fname) -
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r31808 r32420 304 304 if (!RT_SUCCESS(rc)) 305 305 { 306 Assert(VERR_NOT_SUPPORTED==rc); 307 svcClientVersionUnsupported(0, 0); 308 } 309 306 if (VERR_NOT_SUPPORTED==rc) 307 { 308 svcClientVersionUnsupported(0, 0); 309 } 310 else 311 { 312 crWarning("SHCRGL_GUEST_FN_INJECT failed to inject for %i from %i", u32InjectClientID, u32ClientID); 313 } 314 } 310 315 } 311 316 break; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r31808 r32420 378 378 int32_t crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t cbBuffer) 379 379 { 380 CRClient *pClient ;380 CRClient *pClient = NULL; 381 381 int32_t i; 382 382 … … 388 388 && cr_server.clients[i]->conn->u32ClientID==u32ClientID) 389 389 { 390 pClient = cr_server.clients[i]; 390 391 break; 391 392 } 392 393 } 393 pClient = cr_server.clients[i]; 394 CRASSERT(pClient); 394 if (!pClient) return VERR_INVALID_PARAMETER; 395 395 396 396 if (!pClient->conn->vMajor) return VERR_NOT_SUPPORTED;
Note:
See TracChangeset
for help on using the changeset viewer.