We are struggling with the following problem on laptops with switchable graphics (AMD Radeon 7670M + Intel 4000) in our WPF application:
The D3DImage we use to display some video only shows a black frame. This only happens when the discrete graphics (AMD) is active for the application (mode set to high performance). With the Intel graphics active (mode set to power saving) it works. It looks like we are not alone with this issue. A search on google revealed the following posts in the AMD forums:
I have found a workaround using D3DImage.CopyBackBuffer - it looks like the backbuffer does indeed contain the right frame - so I will try to display that instead.
But in order to only apply this workaround when it is necessary, this brings me to the subject of this question: How do I find out if the system actually has switchable graphics?
I suppose there might be some ways using WMI or looking through the registry, but I would be so glad if someone could point me in the right direction or might even have an example how to do so.
Update:
I have tried EnumDisplayDevices and System.Management.ManagementObjectSearcher. The first not returning all devices while the latter does. But perhaps there is still a better way?
Accessing Switchable Graphics Menu To configure Switchable Graphics settings, right-click the Desktop and select AMD Radeon Settings from the menu. Select System. Select Switchable Graphics.
What is the Switchable Graphics feature? The Switchable Graphics feature allows you to switch between using the Intel® graphics and a discrete graphics controller in a computer.
Combining this question and this one the solution would be to use System.Management like this:
internal class Program
{
private static void Main(string[] args)
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
var mos = searcher.Get();
foreach (ManagementObject mo in mos)
{
foreach (PropertyData property in mo.Properties)
{
if (property.Name == "Description")
{
Console.WriteLine(property.Value);
}
}
}
Console.ReadKey();
}
}
My hardware is:
And the result is:
Since I have a not-really-hardware device called "DameWare Development Mirror" you can also look at VideoProcessor property. For NVidea and Intel they will have its value, for non-existing device there will be null.
if (property.Name == "Description")
Console.WriteLine(property.Value);
if (property.Name == "VideoProcessor")
Console.WriteLine(property.Value);
And to determine active videocard you can check if "CurrentBitsPerPixel" property has value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With