[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / windowing / osx / CocoaDPMSSupport.cpp
blob963994d4d0d45c92dd22967e3567ba84f5603a0d
1 /*
2 * Copyright (C) 2009-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "CocoaDPMSSupport.h"
11 #include "ServiceBroker.h"
13 #include <CoreFoundation/CFNumber.h>
14 #include <IOKit/IOKitLib.h>
16 CCocoaDPMSSupport::CCocoaDPMSSupport()
18 m_supportedModes.push_back(OFF);
19 m_supportedModes.push_back(STANDBY);
22 bool CCocoaDPMSSupport::EnablePowerSaving(PowerSavingMode mode)
24 // http://lists.apple.com/archives/Cocoa-dev/2007/Nov/msg00267.html
25 // This is an unsupported system call that might kernel panic on PPC boxes
26 // The reported OSX-PPC panic is unverified so we are going to enable this until
27 // we find out which OSX-PPC boxes have problems, then add detect/disable for those boxes.
28 io_registry_entry_t r = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/IODisplayWrangler");
29 if (!r)
30 return false;
32 switch (mode)
34 case OFF:
35 case STANDBY:
36 return (IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"), kCFBooleanTrue) == 0);
37 default:
38 return false;
42 bool CCocoaDPMSSupport::DisablePowerSaving()
44 // http://lists.apple.com/archives/Cocoa-dev/2007/Nov/msg00267.html
45 // This is an unsupported system call that might kernel panic on PPC boxes
46 // The reported OSX-PPC panic is unverified so we are going to enable this until
47 // we find out which OSX-PPC boxes have problems, then add detect/disable for those boxes.
48 io_registry_entry_t r = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/IODisplayWrangler");
49 if (!r)
50 return false;
52 // Turn display on
53 return (IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"), kCFBooleanFalse) == 0);