Пример #1
0
        public override void TickSpecificLoad(AdlpmActivity activity)
        {
            var adlSpeed = new AdlFanSpeedValue();

            if (AdlApi.AdlGetFanSpeed(Gpu.AdapterIndex, 0, ref adlSpeed) == AdlApi.AdlOk)
            {
                _rpmCurrentSensor.Update(adlSpeed);
                _rpmCurrentSensor.SetActive(true);
            }
            else
            {
                _rpmCurrentSensor.SetActive(false);
            }

            var adlSpeedInfo = new AdlFanSpeedInfo();

            if (AdlApi.AdlGetFanSpeedInfo(Gpu.AdapterIndex, 0, ref adlSpeedInfo) != AdlApi.AdlOk)
            {
                _rpmMaxSensor.Update(adlSpeedInfo);
                _rpmMinSensor.Update(adlSpeedInfo);
                _rpmMaxSensor.SetActive(true);
                _rpmMinSensor.SetActive(true);
            }
            else
            {
                _rpmMaxSensor.SetActive(false);
                _rpmMinSensor.SetActive(false);
            }

            IsSensorActive = true;
        }
Пример #2
0
        private void ProcessAdlAdapter(RadeonGpu gpu)
        {
            AdlApi.AdlGetAdapterIsActive(gpu.AdapterIndex, out var isActive);
            AdlApi.AdlAdapterGetId(gpu.AdapterIndex, out var adapterId);

            gpu.SetActive(isActive == 1);
            gpu.SetAdapterId(adapterId);
        }
Пример #3
0
        public override bool Open()
        {
            if (!AdlApi.Initialize())
            {
                return(false);
            }

            try {
                InitializeHardware();
            } catch (Exception e) {
                Logger.Error("Unable to initialize module hardware", e);
                return(false);
            }

            return(true);
        }
Пример #4
0
        public override void Tick()
        {
            var temperature = new AdlTemperature();

            if (AdlApi.AdlGetAdapterTemperature(Gpu.AdapterIndex, 0, ref temperature) == AdlApi.AdlOk)
            {
                _sensorTemperature.Update(temperature);
                IsSensorActive = true;
                _sensorTemperature.SetActive(IsSensorActive);
            }
            else
            {
                IsSensorActive = false;
                _sensorTemperature.SetActive(IsSensorActive);
            }
        }
Пример #5
0
        public override bool InitializeHardware()
        {
            var adaptersCount = 0;

            AdlApi.AdlGetNumberOfAdapters(ref adaptersCount);

            if (adaptersCount <= 0)
            {
                return(false);
            }

            if (AdlApi.AldAdapterGetInfo(adaptersCount, out var adaptersInfo) != AdlApi.AdlOk)
            {
                return(false);
            }

            for (var i = 0; i < adaptersCount; i++)
            {
                if (string.IsNullOrEmpty(adaptersInfo[i].UDID) || adaptersInfo[i].VendorID != AdlApi.AtiVendorId)
                {
                    continue;
                }

                if (Hardware.Any(hwd => hwd is RadeonGpu && ((RadeonGpu)hwd).IsSameDeviceAs(adaptersInfo[i])))
                {
                    continue;
                }

                var radeonAdapter = new RadeonGpu(adaptersInfo[i]);
                ProcessAdlAdapter(radeonAdapter);
                try {
                    radeonAdapter.InitializeSensors();
                    AddHardware(radeonAdapter);
                } catch (Exception e) {
                    Logger.Error($"Unable to initialize sensors for {radeonAdapter}", e);
                }
            }

            return(true);
        }
Пример #6
0
 public override bool CheckForSystemSupport()
 {
     return(AdlApi.IfSupported());
 }
Пример #7
0
 public override void Close()
 {
     AdlApi.Shutdown();
 }
Пример #8
0
 public bool ObtainPmActivity()
 {
     return(AdlApi.AdlGetCurrentActivity(Gpu.AdapterIndex, ref Activity) == AdlApi.AdlOk);
 }