Changeset 18637 in vbox
- Timestamp:
- Apr 2, 2009 1:49:59 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
include/VBox/HostServices/VBoxCrOpenGLSvc.h (modified) (2 diffs)
-
src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp (modified) (1 diff)
-
src/VBox/HostServices/SharedOpenGL/render/renderspu.h (modified) (4 diffs)
-
src/VBox/HostServices/SharedOpenGL/render/renderspu_agl.c (modified) (3 diffs)
-
src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c (modified) (3 diffs)
-
src/VBox/Main/VMMDevInterface.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/VBoxCrOpenGLSvc.h
r12806 r18637 38 38 /* crOpenGL host functions */ 39 39 #define SHCRGL_HOST_FN_SET_FRAMEBUFFER (1) 40 #define SHCRGL_HOST_FN_SET_VISIBLE_REGION (5) 40 41 /* crOpenGL guest functions */ 41 42 #define SHCRGL_GUEST_FN_WRITE (2) … … 45 46 /* Parameters count */ 46 47 #define SHCRGL_CPARMS_SET_FRAMEBUFFER (1) 48 #define SHCRGL_CPARMS_SET_VISIBLE_REGION (2) 47 49 #define SHCRGL_CPARMS_WRITE (1) 48 50 #define SHCRGL_CPARMS_READ (2) -
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r17021 r18637 412 412 break; 413 413 } 414 case SHCRGL_HOST_FN_SET_VISIBLE_REGION: 415 { 416 Log(("svcCall: SHCRGL_HOST_FN_SET_VISIBLE_REGION\n")); 417 418 if (cParms != SHCRGL_CPARMS_SET_VISIBLE_REGION) 419 { 420 rc = VERR_INVALID_PARAMETER; 421 break; 422 } 423 424 if ( paParms[0].type != VBOX_HGCM_SVC_PARM_PTR /* pRects */ 425 || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* cRects */ 426 ) 427 { 428 rc = VERR_INVALID_PARAMETER; 429 break; 430 } 431 432 Assert(sizeof(RTRECT)==4*sizeof(GLint)); 433 434 renderspuSetRootVisibleRegion(paParms[1].u.uint32, (GLint*)paParms[0].u.pointer.addr); 435 break; 436 } 414 437 default: 415 438 rc = VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
r15532 r18637 70 70 GLint bufferName; 71 71 AGLContext dummyContext; 72 RgnHandle hVisibleRegion; 72 73 /* unsigned long context_ptr; */ 73 74 #elif defined(GLX) … … 195 196 DWORD dwWinThreadId; 196 197 HANDLE hWinThreadReadyEvent; 198 #endif 199 200 #ifdef DARWIN 201 RgnHandle hRootVisibleRegion; 197 202 #endif 198 203 } RenderSPU; … … 245 250 extern void renderspu_SystemWindowPosition( WindowInfo *window, GLint x, GLint y ); 246 251 extern void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, GLint* pRects); 252 extern void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window); 253 #ifdef RT_OS_DARWIN 254 extern void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects); 255 #endif 247 256 extern void renderspu_SystemShowWindow( WindowInfo *window, GLboolean showIt ); 248 257 extern void renderspu_SystemMakeCurrent( WindowInfo *window, GLint windowInfor, ContextInfo *context ); … … 260 269 #endif 261 270 DECLEXPORT(void) renderspuSetWindowId(unsigned int winId); 271 DECLEXPORT(void) renderspuSetRootVisibleRegion(GLint cRects, GLint *pRects); 262 272 #ifdef __cplusplus 263 273 } -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_agl.c
r18610 r18637 425 425 window->visual = NULL; 426 426 window->window = NULL; 427 428 if (window->hVisibleRegion) 429 { 430 DisposeRgn(window->hVisibleRegion); 431 window->hVisibleRegion = 0; 432 } 427 433 } 428 434 … … 702 708 703 709 DEBUG_MSG_POETZSCH (("Visible region \n")); 704 ContextInfo *c; 705 c = renderspuGetWindowContext (window); 706 if (c && 707 c->context) 710 711 if (window->hVisibleRegion) 712 { 713 DisposeRgn(window->hVisibleRegion); 714 window->hVisibleRegion = 0; 715 } 716 717 if (cRects>0) 708 718 { 709 719 int i; … … 720 730 } 721 731 DisposeRgn (tmpRgn); 722 723 GLboolean result = true; 724 /* Set the clip region to the context */ 725 result = render_spu.ws.aglSetInteger(c->context, AGL_CLIP_REGION, (const GLint*)rgn); 726 CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): SetInteger Failed"); 727 result = render_spu.ws.aglEnable(c->context, AGL_CLIP_REGION); 728 CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): Enable Failed"); 729 /* Clear the region structure */ 730 DisposeRgn (rgn); 731 } 732 window->hVisibleRegion = rgn; 733 } 734 735 renderspu_SystemWindowApplyVisibleRegion(window); 736 } 737 738 void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects) 739 { 740 if (render_spu.hRootVisibleRegion) 741 { 742 DisposeRgn(render_spu.hRootVisibleRegion); 743 render_spu.hRootVisibleRegion = 0; 744 } 745 746 if (cRects>0) 747 { 748 int i; 749 render_spu.hRootVisibleRegion = NewRgn(); 750 SetEmptyRgn (render_spu.hRootVisibleRegion); 751 RgnHandle tmpRgn = NewRgn(); 752 for (i=0; i<cRects; ++i) 753 { 754 SetRectRgn (tmpRgn, 755 pRects[4*i] , pRects[4*i+1], 756 pRects[4*i+2], pRects[4*i+3]); 757 UnionRgn (render_spu.hRootVisibleRegion, tmpRgn, render_spu.hRootVisibleRegion); 758 } 759 DisposeRgn (tmpRgn); 760 } 761 } 762 763 /*Assumes that all regions are in the guest coordinates system*/ 764 void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window) 765 { 766 ContextInfo *c = renderspuGetWindowContext(window); 767 RgnHandle rgn; 768 GLboolean result = true; 769 770 if (!c || !c->context) return; 771 772 rgn = NewRgn(); 773 SetEmptyRgn (rgn); 774 775 if (render_spu.hRootVisibleRegion) 776 { 777 CopyRgn(render_spu.hRootVisibleRegion, rgn); 778 } 779 else /*@todo create tmp region rect with size of underlying framebuffer */ 780 { 781 /* SetRectRgn(0,0,fb->width,fb->height); */ 782 SetRectRgn(rgn,0,0,4000,4000); 783 } 784 785 if (window->hVisibleRegion) 786 { 787 SectRgn(rgn, window->hVisibleRegion, rgn); 788 } 789 790 /* If we'd need to set clip region in host screen coordinates, than shift it*/ 791 /* OffsetRgn(rgn, fb->hostleft, fb->hosttop); */ 792 793 /* Set the clip region to the context */ 794 result = render_spu.ws.aglSetInteger(c->context, AGL_CLIP_REGION, (const GLint*)rgn); 795 CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): SetInteger Failed"); 796 result = render_spu.ws.aglEnable(c->context, AGL_CLIP_REGION); 797 CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): Enable Failed"); 798 /* Clear the region structure */ 799 DisposeRgn (rgn); 732 800 } 733 801 -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c
r17484 r18637 207 207 } 208 208 } 209 #endif 210 211 #ifdef DARWIN 212 render_spu.hRootVisibleRegion = 0; 209 213 #endif 210 214 … … 326 330 render_spu.barrierHash = NULL; 327 331 332 #ifdef RT_OS_DARWIN 333 if (render_spu.hRootVisibleRegion) 334 { 335 DisposeRgn(render_spu.hRootVisibleRegion); 336 render_spu.hRootVisibleRegion = 0; 337 } 338 #endif 339 328 340 #ifdef RT_OS_WINDOWS 329 341 if (render_spu.dwWinThreadId) … … 357 369 } 358 370 359 voidrenderspuSetWindowId(unsigned int winId)371 DECLEXPORT(void) renderspuSetWindowId(unsigned int winId) 360 372 { 361 373 render_spu_parent_window_id = winId; 362 374 } 375 376 static void renderspuWindowVisibleRegionCB(unsigned long key, void *data1, void *data2) 377 { 378 WindowInfo *window = (WindowInfo *) data1; 379 CRASSERT(window); 380 381 renderspu_SystemWindowApplyVisibleRegion(window); 382 } 383 384 DECLEXPORT(void) renderspuSetRootVisibleRegion(GLint cRects, GLint *pRects) 385 { 386 #ifdef RT_OS_DARWIN 387 renderspu_SystemSetRootVisibleRegion(cRects, pRects); 388 389 crHashtableWalk(render_spu.windowTable, renderspuWindowVisibleRegionCB, NULL); 390 #endif 391 } 392 393 #ifndef RT_OS_DARWIN 394 void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window) 395 { 396 } 397 #endif -
trunk/src/VBox/Main/VMMDevInterface.cpp
r16468 r18637 36 36 #include "hgcm/HGCM.h" 37 37 #include "hgcm/HGCMObjects.h" 38 # if defined(RT_OS_DARWIN) && defined(VBOX_WITH_CROGL) 39 # include <VBox/HostServices/VBoxCrOpenGLSvc.h> 40 # endif 38 41 #endif 39 42 … … 350 353 IFramebuffer *framebuffer = pDrv->pVMMDev->getParent()->getDisplay()->getFramebuffer(); 351 354 if (framebuffer) 355 { 352 356 framebuffer->SetVisibleRegion((BYTE *)pRect, cRect); 357 #if defined(RT_OS_DARWIN) && defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) 358 { 359 BOOL is3denabled; 360 361 pDrv->pVMMDev->getParent()->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled); 362 363 if (is3denabled) 364 { 365 VBOXHGCMSVCPARM parms[2]; 366 367 parms[0].type = VBOX_HGCM_SVC_PARM_PTR; 368 parms[0].u.pointer.addr = pRect; 369 parms[0].u.pointer.size = 0; /* We don't actually care. */ 370 parms[1].type = VBOX_HGCM_SVC_PARM_32BIT; 371 parms[1].u.uint32 = cRect; 372 373 int rc = pDrv->pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_SET_VISIBLE_REGION, 2, &parms[0]); 374 return rc; 375 } 376 } 377 #endif 378 } 353 379 354 380 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.

