- Timestamp:
- Sep 16, 2015 5:09:28 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r57517 r57790 535 535 #endif 536 536 537 #ifdef IN_RING3 537 538 /** 538 539 * @interface_method_impl{PDMIDISPLAYPORT::pfnSetViewport} … … 543 544 544 545 Log(("vmsvgaPortSetViewPort: screen %d (%d,%d)(%d,%d)\n", uScreenId, x, y, cx, cy)); 546 VMSVGAVIEWPORT const OldViewport = pThis->svga.viewport; 545 547 546 548 if (x < pThis->svga.uWidth) … … 570 572 pThis->svga.viewport.yHighWC = 0; 571 573 } 574 575 # ifdef VBOX_WITH_VMSVGA3D 576 /* 577 * Now inform the 3D backend. 578 */ 579 if (pThis->svga.f3DEnabled) 580 vmsvga3dUpdateHostScreenViewport(pThis, uScreenId, &OldViewport); 581 # endif 572 582 } 583 #endif /* IN_RING3 */ 573 584 574 585 /** -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.h
r57154 r57790 43 43 VMSVGA3DCOCOA_DECL(void) vmsvga3dCocoaViewSetPosition(NativeNSViewRef pView, NativeNSViewRef pParentView, int x, int y); 44 44 VMSVGA3DCOCOA_DECL(void) vmsvga3dCocoaViewSetSize(NativeNSViewRef pView, int w, int h); 45 VMSVGA3DCOCOA_DECL(void) vmsvga3dCocoaViewUpdateViewport(NativeNSViewRef pView); 45 46 VMSVGA3DCOCOA_DECL(void) vmsvga3dCocoaViewMakeCurrentContext(NativeNSViewRef pView, NativeNSOpenGLContextRef pCtx); 46 47 VMSVGA3DCOCOA_DECL(void) vmsvga3dCocoaSwapBuffers(NativeNSViewRef pView, NativeNSOpenGLContextRef pCtx); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.m
r57372 r57790 118 118 - (void)vboxSetPos:(NSPoint)pos; 119 119 - (void)vboxSetSize:(NSSize)size; 120 - (void)vboxScheduleCtxUpdate; 120 121 - (void)vboxReshapePerform; 121 122 - (void)vboxReshape; 122 #if 0 // doesn't work or isn't needed :/ 123 - (void)vboxFrameDidChange; 123 - (void)vboxBoundsDidChange:(NSNotification *)pNotification; 124 - (void)vboxFrameDidChange:(NSNotification *)pNotification; 125 - (void)vboxFrameDidChangeGlobal:(NSNotification *)pNotification; 124 126 - (BOOL)postsFrameChangedNotifications; 125 #endif126 127 - (void)vboxRemoveFromSuperviewAndHide; 127 128 - (void)vboxUpdateCtxIfNecessary; … … 251 252 [pFmt release]; 252 253 253 #if 0 // doesn't work or isn't needed :/254 /*255 * Get notifications when we're moved...256 */257 if (pParams->pParentView)258 {259 [[NSNotificationCenter defaultCenter] addObserver:self260 selector:@selector(vboxFrameDidChange)261 name:NSViewFrameDidChangeNotification262 object:self];263 }264 #endif265 266 254 LogFlow(("OvlView createViewAndContext: returns successfully\n")); 267 255 return; … … 300 288 //self.autoresizingMask = NSViewMinXMargin | NSViewMaxXMargin | NSViewMinYMargin | NSViewMaxYMargin; 301 289 self.autoresizingMask = NSViewNotSizable; 290 291 /* 292 * Get notifications when we're moved or resized and when we're moved 293 * to a different screen or GPU or when the GL context simply needs updating. 294 */ 295 if (pParentView) 296 { 297 [[NSNotificationCenter defaultCenter] addObserver:self 298 selector:@selector(vboxBoundsDidChange:) 299 name:NSViewBoundsDidChangeNotification 300 object:self]; 301 [[NSNotificationCenter defaultCenter] addObserver:self 302 selector:@selector(vboxFrameDidChange:) 303 name:NSViewFrameDidChangeNotification 304 object:self]; 305 //[[NSNotificationCenter defaultCenter] addObserver:self 306 // selector:@selector(vboxFrameDidChange:) 307 // name:NSViewDidUpdateTrackingAreasNotification 308 // object:self]; 309 [[NSNotificationCenter defaultCenter] addObserver:self 310 selector:@selector(vboxFrameDidChangeGlobal:) 311 name:NSViewGlobalFrameDidChangeNotification 312 object:self]; 313 } 302 314 } 303 315 LogFlow(("OvlView(%p) initWithFrameAndFormat: returns %p\n", (void *)self, (void *)self)); … … 345 357 } 346 358 359 - (void)vboxScheduleCtxUpdate 360 { 361 m_fUpdateCtx = true; 362 } 347 363 348 364 - (void)vboxUpdateCtxIfNecessary … … 454 470 } 455 471 456 #if 0 // doesn't work or isn't needed :/ 457 - (void)vboxFrameDidChange 472 /** 473 * This is called when the bounds change. 474 * 475 * We indicate that the FIFO thread must update the GL context. 476 */ 477 - (void)vboxBoundsDidChange:(NSNotification *)pNotification 478 { 479 LogFlow(("OvlView(%p) vboxBoundsDidChange:\n", (void *)self)); 480 self->m_fUpdateCtx = true; 481 } 482 483 /** 484 * This is called when the frame changes size or position. 485 * 486 * We indicate that the FIFO thread must update the GL context. 487 */ 488 - (void)vboxFrameDidChange:(NSNotification *)pNotification 458 489 { 459 490 LogFlow(("OvlView(%p) vboxFrameDidChange:\n", (void *)self)); 460 } 461 491 self->m_fUpdateCtx = true; 492 } 493 494 /** 495 * This is called when moved to different screen/GPU or/and when the GL context 496 * needs updating. 497 * 498 * We indicate that the FIFO thread must update the GL context. 499 */ 500 - (void)vboxFrameDidChangeGlobal:(NSNotification *)pNotification 501 { 502 LogFlow(("OvlView(%p) vboxFrameDidChangeGlobal:\n", (void *)self)); 503 self->m_fUpdateCtx = true; 504 } 505 506 /** This enables the vboxFrameDidChange notification. */ 462 507 - (BOOL)postsFrameChangedNotifications 463 508 { … … 465 510 return YES; 466 511 } 467 #endif468 512 469 513 /** … … 493 537 LogFlow(("OvlView(%p) vboxRemoveFromSuperviewAndHide: calling setHidden\n", (void *)self)); 494 538 [self setHidden:YES]; 495 #if 0 /* doesn't work, or isn't really needed (scroll bar mess). */496 539 LogFlow(("OvlView(%p) vboxRemoveFromSuperviewAndHide: calling setHidden\n", (void *)self)); 497 540 [[NSNotificationCenter defaultCenter] removeObserver:self]; 498 #endif499 541 } 500 542 else … … 798 840 799 841 842 VMSVGA3DCOCOA_DECL(void) vmsvga3dCocoaViewUpdateViewport(NativeNSViewRef pView) 843 { 844 LogFlow(("vmsvga3dCocoaViewSetSize: pView=%p\n", (void *)pView)); 845 NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; 846 VMSVGA3DOverlayView *pOverlayView = (VMSVGA3DOverlayView *)pView; 847 848 /* Possible that we don't actually need to do this (i.e. this API), but right now I'm 849 leaving it to be sure things actually work right when scrolling. */ 850 [pOverlayView vboxScheduleCtxUpdate]; 851 852 [pPool release]; 853 LogFlow(("vmsvga3dCocoaViewSetSize: returns\n")); 854 } 855 856 800 857 VMSVGA3DCOCOA_DECL(void) vmsvga3dCocoaViewSetSize(NativeNSViewRef pView, int cx, int cy) 801 858 { -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r57519 r57790 1078 1078 1079 1079 return VINF_SUCCESS; 1080 } 1081 1082 1083 void vmsvga3dUpdateHostScreenViewport(PVGASTATE pThis, uint32_t idScreen, VMSVGAVIEWPORT const *pOldViewport) 1084 { 1085 /** @todo Move the visible framebuffer content here, don't wait for the guest to 1086 * redraw it. */ 1087 1088 #ifdef RT_OS_DARWIN 1089 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 1090 if ( pState 1091 && idScreen == 0 1092 && pState->SharedCtx.id == VMSVGA3D_SHARED_CTX_ID) 1093 { 1094 vmsvga3dCocoaViewUpdateViewport(pState->SharedCtx.cocoaView); 1095 } 1096 #else 1097 NOREF(pThis); NOREF(idScreen); 1098 #endif 1080 1099 } 1081 1100 … … 2995 3014 * => Copy = { .yDst = 2, .ySrc = 5, .cy = 2 } 2996 3015 * 3016 * Update: On darwin, it turns out that when we call [NSOpenGLContext updates] 3017 * when the view is resized, moved and otherwise messed with, 3018 * the visible part of the framebuffer is actually the bottom 3019 * one. It's easy to adjust for this, just have to adjust the 3020 * destination rectangle such that yBottom is zero. 2997 3021 */ 2998 3022 /* X - no inversion, so kind of simple. */ … … 3056 3080 { 3057 3081 /* adjustment #2 */ 3058 uint32_tcyAdjust = ClippedRect.y + ClippedRect.h - DstViewport.yHighWC;3082 cyAdjust = ClippedRect.y + ClippedRect.h - DstViewport.yHighWC; 3059 3083 ClippedRect.srcy += cyAdjust; 3060 3084 ClippedRect.h -= cyAdjust; … … 3079 3103 DstRect.xLeft -= DstViewport.x; 3080 3104 DstRect.xRight -= DstViewport.x; 3105 # ifdef RT_OS_DARWIN /* We actually seeing the bottom of the FB, not the top as on windows and X11. */ 3106 DstRect.yTop -= DstRect.yBottom; 3107 DstRect.yBottom = 0; 3108 # else 3081 3109 DstRect.yBottom += DstViewport.y; 3082 3110 DstRect.yTop += DstViewport.y; 3111 # endif 3083 3112 3084 3113 Log(("SrcRect: (%d,%d)(%d,%d) DstRect: (%d,%d)(%d,%d)\n", -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r57520 r57790 324 324 } 325 325 326 void vmsvga3dUpdateHostScreenViewport(PVGASTATE pThis, uint32_t idScreen, VMSVGAVIEWPORT const *pOldViewport) 327 { 328 /** @todo Scroll the screen content without requiring the guest to redraw. */ 329 NOREF(pThis); NOREF(idScreen); NOREF(pOldViewport); 330 } 326 331 327 332 static uint32_t vmsvga3dGetSurfaceFormatSupport(PVMSVGA3DSTATE pState3D, uint32_t idx3dCaps, D3DFORMAT format) -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
r57151 r57790 56 56 int vmsvga3dTerminate(PVGASTATE pThis); 57 57 int vmsvga3dReset(PVGASTATE pThis); 58 void vmsvga3dUpdateHostScreenViewport(PVGASTATE pThis, uint32_t idScreen, VMSVGAVIEWPORT const *pOldViewport); 58 59 int vmsvga3dQueryCaps(PVGASTATE pThis, uint32_t idx3dCaps, uint32_t *pu32Val); 59 60 -
trunk/src/VBox/Devices/Graphics/VBoxSVGA3DObjC.def
r57154 r57790 24 24 vmsvga3dCocoaViewSetPosition 25 25 vmsvga3dCocoaViewSetSize 26 vmsvga3dCocoaViewUpdateViewport 26 27 vmsvga3dCocoaViewMakeCurrentContext 27 28 vmsvga3dCocoaSwapBuffers
Note:
See TracChangeset
for help on using the changeset viewer.