Changeset 52622 in vbox
- Timestamp:
- Sep 5, 2014 6:25:38 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxOGLTest.h
r40858 r52622 4 4 */ 5 5 /* 6 * Copyright (C) 2012 Oracle Corporation6 * Copyright (C) 2012-2014 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 30 RT_C_DECLS_BEGIN 31 31 32 bool RTCALL VBoxOglIsOfflineRenderingAppropriate(); 32 33 bool RTCALL VBoxOglIs3DAccelerationSupported(); 33 34 -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/Info.plist
r42085 r52622 16 16 <key>LSCanProvideIMVideoDataSource</key> <false/> 17 17 <key>NSHighResolutionCapable</key> <true/> 18 <key>NSSupportsAutomaticGraphicsSwitching</key><true/> 18 19 <key>CFBundleDocumentTypes</key> 19 20 <array> -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VM-Info.plist
r42085 r52622 16 16 <key>LSCanProvideIMVideoDataSource</key> <true/> 17 17 <key>NSHighResolutionCapable</key> <true/> 18 <key>NSSupportsAutomaticGraphicsSwitching</key><true/> 18 19 </dict> 19 20 </plist> -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/vmstarter-Info.plist
r42085 r52622 16 16 <key>LSUIElement</key> <true/> 17 17 <key>NSHighResolutionCapable</key> <true/> 18 <key>NSSupportsAutomaticGraphicsSwitching</key><true/> 18 19 <key>CFBundleDocumentTypes</key> 19 20 <array> -
trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
r51676 r52622 5 5 6 6 # 7 # Copyright (C) 2008-201 2Oracle Corporation7 # Copyright (C) 2008-2014 Oracle Corporation 8 8 # 9 9 # This file is part of VirtualBox Open Source Edition (OSE), as … … 264 264 VBoxOGLrenderspu_OBJCFLAGS.darwin = -Wno-shadow 265 265 VBoxOGLrenderspu_SOURCES.darwin = \ 266 OpenGLTest/OpenGLTestDarwin.cpp \ 266 267 render/renderspu_cocoa.c \ 267 268 render/renderspu_cocoa_helper.m … … 272 273 VBoxOGLrenderspu_DEFS += VBOX_WITH_VDMA 273 274 endif 274 VBoxOGLrenderspu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLrenderspu.dylib 275 VBoxOGLrenderspu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLrenderspu.dylib -framework IOKit 275 276 VBoxOGLrenderspu_LIBS = \ 276 277 $(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \ -
trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp
r50406 r52622 6 6 7 7 /* 8 * Copyright (C) 2009-201 2Oracle Corporation8 * Copyright (C) 2009-2014 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 18 18 19 19 20 #include <IOKit/IOKitLib.h> 20 21 #include <OpenGL/OpenGL.h> 21 22 #include <ApplicationServices/ApplicationServices.h> … … 28 29 #include <iprt/log.h> 29 30 31 #include <iprt/asm.h> 32 #include <iprt/thread.h> 33 30 34 #include <VBox/VBoxOGLTest.h> 35 36 bool RTCALL VBoxOglIsOfflineRenderingAppropriate() 37 { 38 /* It is assumed that it is makes sense to enable offline rendering 39 only in case if host has more than one GPU installed. This routine 40 counts all the PCI devices in IORegistry which have IOName property 41 set to "display". If the amount of such devices if greater than one, 42 it returns TRUE or FALSE otherwise. */ 43 44 kern_return_t krc; 45 io_iterator_t matchingServices; 46 CFDictionaryRef pMatchingDictionary; 47 static bool fAppropriate = false; 48 49 /* In order to do not slowdown 3D engine which can ask about offline rendering several times, 50 let's cache the result and assume that renderers amount value is constant. Also prevent threads race 51 on startup. */ 52 53 static bool volatile fState = false; 54 if (!ASMAtomicCmpXchgBool(&fState, true, false)) 55 { 56 while (ASMAtomicReadBool(&fState) != true) 57 RTThreadSleep(5); 58 59 return fAppropriate; 60 } 61 62 #define VBOX_OGL_RENDERER_MATCH_KEYS_NUM (2) 63 64 CFStringRef ppDictionaryKeys[VBOX_OGL_RENDERER_MATCH_KEYS_NUM] = { CFSTR(kIOProviderClassKey), CFSTR(kIONameMatchKey) }; 65 CFStringRef ppDictionaryVals[VBOX_OGL_RENDERER_MATCH_KEYS_NUM] = { CFSTR("IOPCIDevice"), CFSTR("display") }; 66 67 pMatchingDictionary = CFDictionaryCreate(kCFAllocatorDefault, 68 (const void **)ppDictionaryKeys, 69 (const void **)ppDictionaryVals, 70 VBOX_OGL_RENDERER_MATCH_KEYS_NUM, 71 &kCFTypeDictionaryKeyCallBacks, 72 &kCFTypeDictionaryValueCallBacks); 73 if (pMatchingDictionary) 74 { 75 /* The reference to pMatchingDictionary is consumed by the function below => no IORelease(pMatchingDictionary)! */ 76 krc = IOServiceGetMatchingServices(kIOMasterPortDefault, pMatchingDictionary, &matchingServices); 77 if (krc == kIOReturnSuccess) 78 { 79 io_object_t matchingService; 80 int cMatchingServices = 0; 81 82 while ((matchingService = IOIteratorNext(matchingServices)) != 0) 83 { 84 cMatchingServices++; 85 IOObjectRelease(matchingService); 86 } 87 88 fAppropriate = (cMatchingServices > 1); 89 90 IOObjectRelease(matchingServices); 91 } 92 93 } 94 95 LogRel(("OpenGL: Offline rendering support is %s (PID=%d)\n", fAppropriate ? "ON" : "OFF", (int)getpid())); 96 97 return fAppropriate; 98 } 31 99 32 100 bool RTCALL VBoxOglIs3DAccelerationSupported() … … 49 117 kCGLPFADoubleBuffer, 50 118 kCGLPFAWindow, 119 VBoxOglIsOfflineRenderingAppropriate() ? kCGLPFAAllowOfflineRenderers : (CGLPixelFormatAttribute)NULL, 51 120 (CGLPixelFormatAttribute)NULL 52 121 }; -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
r52616 r52622 5 5 6 6 /* 7 * Copyright (C) 2009-201 2Oracle Corporation7 * Copyright (C) 2009-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 #include <iprt/time.h> 29 29 #include <iprt/assert.h> 30 #include <VBox/VBoxOGLTest.h> 30 31 31 32 #include <cr_vreg.h> … … 2418 2419 } 2419 2420 2421 if (VBoxOglIsOfflineRenderingAppropriate()) 2422 { 2423 DEBUG_MSG(("Offline rendering is enabled\n")); 2424 attribs[i++] = NSOpenGLPFAAllowOfflineRenderers; 2425 } 2426 2420 2427 /* Mark the end */ 2421 2428 attribs[i++] = 0;
Note:
See TracChangeset
for help on using the changeset viewer.