mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed NVIDIA IsPossible screen detection
Made the IsPossible deviceIdentification work correctly with the NvAPIWrapper logic. Issue was caused by me not really understanding what the NVIDIA documentation meant. This has been rectified. HeliosPlus will now invalidate any profiles that won't work with the currntly attached screens.
This commit is contained in:
parent
7fd4a8117d
commit
54f3f5271a
@ -139,7 +139,7 @@ namespace HeliosPlus.Shared
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Get the list of connected devices
|
// Get the list of connected devices
|
||||||
List<string> connectedDisplayIdentifiers = ProfileRepository.GenerateAllDisplayIdentifiers();
|
List<string> connectedDisplayIdentifiers = ProfileRepository.GenerateAllAvailableDisplayIdentifiers();
|
||||||
|
|
||||||
// Check each display in this profile and make sure it's currently available
|
// Check each display in this profile and make sure it's currently available
|
||||||
int validDisplayCount = 0;
|
int validDisplayCount = 0;
|
||||||
|
@ -27,7 +27,7 @@ using System.Net.NetworkInformation;
|
|||||||
using NvAPIWrapper.Mosaic;
|
using NvAPIWrapper.Mosaic;
|
||||||
using NvAPIWrapper.Native.Mosaic;
|
using NvAPIWrapper.Native.Mosaic;
|
||||||
using HeliosPlus.Shared.Topology;
|
using HeliosPlus.Shared.Topology;
|
||||||
|
using NvAPIWrapper.Native.GPU;
|
||||||
|
|
||||||
namespace HeliosPlus.Shared
|
namespace HeliosPlus.Shared
|
||||||
{
|
{
|
||||||
@ -714,29 +714,37 @@ namespace HeliosPlus.Shared
|
|||||||
return displayIdentifiers;
|
return displayIdentifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<string> GenerateAllDisplayIdentifiers()
|
public static List<string> GenerateAllAvailableDisplayIdentifiers()
|
||||||
{
|
{
|
||||||
List<string> displayIdentifiers = new List<string>();
|
List<string> displayIdentifiers = new List<string>();
|
||||||
|
|
||||||
// If the Video Card is an NVidia, then we should generate specific NVidia displayIdentifiers
|
// If the Video Card is an NVidia, then we should generate specific NVidia displayIdentifiers
|
||||||
NvAPIWrapper.GPU.LogicalGPU[] myLogicalGPUs = NvAPIWrapper.GPU.LogicalGPU.GetLogicalGPUs();
|
bool isNvidia = false;
|
||||||
if (myLogicalGPUs.Length > 0)
|
NvAPIWrapper.GPU.PhysicalGPU[] myPhysicalGPUs = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
myPhysicalGPUs = NvAPIWrapper.GPU.PhysicalGPU.GetPhysicalGPUs();
|
||||||
|
isNvidia = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
if (isNvidia && myPhysicalGPUs != null && myPhysicalGPUs.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (NvAPIWrapper.GPU.LogicalGPU myLogicalGPU in myLogicalGPUs)
|
|
||||||
{
|
|
||||||
NvAPIWrapper.GPU.PhysicalGPU[] myPhysicalGPUs = myLogicalGPU.CorrespondingPhysicalGPUs;
|
|
||||||
foreach (NvAPIWrapper.GPU.PhysicalGPU myPhysicalGPU in myPhysicalGPUs)
|
foreach (NvAPIWrapper.GPU.PhysicalGPU myPhysicalGPU in myPhysicalGPUs)
|
||||||
{
|
{
|
||||||
// get a list of all physical outputs attached to the GPUs
|
// get a list of all physical outputs attached to the GPUs
|
||||||
NvAPIWrapper.Display.DisplayDevice[] allDisplayDevices = myPhysicalGPU.GetDisplayDevices();
|
NvAPIWrapper.Display.DisplayDevice[] allDisplayDevices = myPhysicalGPU.GetConnectedDisplayDevices(ConnectedIdsFlag.None);
|
||||||
foreach (NvAPIWrapper.Display.DisplayDevice aDisplayDevice in allDisplayDevices)
|
foreach (NvAPIWrapper.Display.DisplayDevice aDisplayDevice in allDisplayDevices)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (aDisplayDevice.IsAvailable== true)
|
||||||
|
{
|
||||||
// Create an array of all the important display info we need to record
|
// Create an array of all the important display info we need to record
|
||||||
string[] displayInfo = {
|
string[] displayInfo = {
|
||||||
"NVIDIA",
|
"NVIDIA",
|
||||||
myLogicalGPU.ToString(),
|
myPhysicalGPU.CorrespondingLogicalGPU.ToString(),
|
||||||
myPhysicalGPU.ToString(),
|
myPhysicalGPU.ToString(),
|
||||||
myPhysicalGPU.ArchitectInformation.ShortName.ToString(),
|
myPhysicalGPU.ArchitectInformation.ShortName.ToString(),
|
||||||
myPhysicalGPU.ArchitectInformation.Revision.ToString(),
|
myPhysicalGPU.ArchitectInformation.Revision.ToString(),
|
||||||
@ -754,7 +762,6 @@ namespace HeliosPlus.Shared
|
|||||||
// Add it to the list of display identifiers so we can return it
|
// Add it to the list of display identifiers so we can return it
|
||||||
displayIdentifiers.Add(displayIdentifier);
|
displayIdentifiers.Add(displayIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user