Obtain monitor capabilities

Blitz3D Forums/Blitz3D Userlibs/Obtain monitor capabilities

_PJ_(Posted 2011) [#1]
I've been trying to figure out how to get hardware deatils for the monitor, particularly with respect to the supported resolutions/aspect ratios.

From what I've been able to find out, GDI+ only knows the "current" resolution.
The video card seems to get the informatiopn from the EDID of the monitor, but Windows still gets access to this information. I'm just not sure what Windows does with it. i.e. where it might keep it.

This article seemed to be the most explanatory, as mentioned, it's only the supported resolutions I am really interested in.

However, I have no idea where I should start 'looking' for this data. If anyone can help at all, I'd be really grateful, thanks!

http://en.wikipedia.org/wiki/Extended_display_identification_data


xlsior(Posted 2011) [#2]
the EDID information is stored in the registry -- each videocard has the EDID string of the currently connected monitor associated with it.

Few things to keep in mind:
1) Not all monitors report EDID correctly, some don't sent any info, or even pass on generic/incorrect information that doesn't apply to the actual screen. Some are even malformed, so keep this in mind when parsing it out, and never take the provided info for granted.

2) Slightly useful bit: EDID has a place to provide an 'overscan' size as well. LCD doesn't use overscan, CRT does... Which means that if there is an overscan specified in EDID, you know you're dealing with a CRT. If there isn't, there's a good chance it's an LCD.

When looking for EDID info myself in the past, this is what I found in the registry:

HKEY_LOCAL_MACHINE\Hardware\System\CurrentControlSet\Enum\Display\

Under there, you see the various monitors that have been connected to the computer at one point or another. Under these you'll find one long string name, under there there is 'Device Parameters', and under there there is a registry key named 'EDID' which contained the binary EDID code that was provided by the display, which can be parsed out.

Unfortunately I do not know how to determine which of the listed monitors is active at the moment. (I personally have 4 different displays listed in the registry, while only two are currently hooked up)
Three of them have an EDID key, one of them a BAD_EDID instead (?)
I also noticed that two of them have a 'control' subfolder, while two others don't... But no idea if that signifies anything.


_PJ_(Posted 2011) [#3]
Yeah, I've looked through the current controlset registry keys. I was hoping that wasn't the way to go, since I'm gonna have to enumerate the PID's and VID's etc. Since there's no way to tell (in the program) WHAT subkey to look at beforehand.

Thanks for the infformation, it's really useful, and yeah, one of my monitors lists "unsupported" for all the EDID info according to ATI's Catalyst utility.

What I'm aiming for, really, is a means to identify a 'safe' default graphics resolution.
In the past, 800x600 or 1024x768 has been fine, but with a trend towards widescreen formats (and a lot of netbooks having that 1024x600 thing, not allowing greater height) I needed a different approach than just picking one from the adapter's list.
Seems like a lotof hassle for a simple thing, if the EDID is 'that' unreliable, I would have to just "pick a value" anyway...


Yasha(Posted 2011) [#4]
I needed a different approach than just picking one from the adapter's list.


I don't get it... why can't you just use the builtin CountGfxModes procedure?


Charrua(Posted 2011) [#5]
hi
CountGfxModes give us the modes of the graphic card, but some may not be correct for the monitor, isn't it?

out of topic: i had a cable to monitor converter, and when changing resolution pressing a + key on the remote controller, it enter in an out of sync for my Samsung lcd and... no image came. Unfortunately, i press not the - to go backard and... i have to change the lcd to an analog monitor that get in sync and reverse my incorrect handling.

i think that Malice need to be sure about wiht gfx mode is safely in the plugged monitor, but, at first i think that there is no secure way to know it, else than asking and reverting to the last working mode if the new fails, like windows do when changing resolution (should it be the reason of this mothod?)

Juan


xlsior(Posted 2011) [#6]
By default Windows hides the modes that it knows the monitor won't support (through EDID, presumably). Doesn't blitzmax use this trimmed down list already when queried?


_PJ_(Posted 2011) [#7]

CountGfxModes give us the modes of the graphic card, but some may not be correct for the monitor, isn't it?


Yeah, the GFX... commands only apply to the card, and especially nowadays, graphics cards support a huge variety of resolutions that trhe monitor may not be capable of displaying.

i think that Malice need to be sure about wiht gfx mode is safely in the plugged monitor, but, at first i think that there is no secure way to know it, else than asking and reverting to the last working mode if the new fails

That's about the size of it. But that still leaves something of an issue with the DEFAULT choice that the game will use on first ever running (before user changes any resolutions).


Doesn't blitzmax use this trimmed down list already when queried?


If it does, That's nice for Blitzmax, I'm using B3D XD (sounds like another reason to upgrade!)
---

Another thought, which seems much more practical:


I can grab the current desktop resolution, which, logically MUST be supported (at least in 2D mode), by both the Adapter AND the monitor, so perhaps making a smaller "settings" app that's separate from the main program, (but writes the configuration data for the main prog to read), can always default to this mode - that would save a lot off messing about
:)


Yasha(Posted 2011) [#8]
making a smaller "settings" app


My preferred solution has always been for this initial settings app to appear in a relatively small resolution in windowed mode - seems to solve the problem adequately for my purposes, as I don't think the monitor much cares what the resolution of a window is.


Rroff(Posted 2011) [#9]
Proper way to do it is to set the current desktop mode on first run and have a "safe mode" shortcut that does a default run at 800x600 (or 640x480) windowed as per post above - then let the user configure it themselves if needed from the native B3D enumerated list.

I use the code as per my post here:

http://www.blitzbasic.com/Community/posts.php?topic=92282#1055609

Expect other people have posted similiar versions of this code too.

Last edited 2011


_PJ_(Posted 2011) [#10]
Proper way to do it is to set the current desktop mode on first run and have a "safe mode" shortcut that does a default run at 800x600 (or 640x480) windowed as per post above - then let the user configure it themselves if needed from the native B3D enumerated list.


It was the 'safe mode' default resolution that I was really concerned about, Rroff. Is 800x600 or 640x480 really viable on all systems these days?

Thanks for the input, though.


Yasha(Posted 2011) [#11]
Is 800x600 or 640x480 really viable on all systems these days?


Not in fullscreen, but windowed mode is safe in any resolution (doesn't have to be graphics-card supported) that fits on the screen (and probably that doesn't fit on the screen). So windowed 800x600 should always be viable.

'Course this solution may be of no use to you.

Last edited 2011


_PJ_(Posted 2011) [#12]
Thanks again.

I should remember to keep the options minimal. A big problem with too-small resolutions I've seen, is when the "apply" button is off-screen as well as the window handle :D


_33(Posted 2011) [#13]
It is to be noted that a lot of people today have moved to flat panels that are either in 16:10 or 16:9 (like me) aspect ratio. So if you develop your game thinking that 5:4 or 4:3 is your objective aspect ratio, then a lot of the people that will try out your game or product on their shiny flat screen with native 1920x1080 will display in said 16:9 ratio and thus deform slightly the image by stretching it to fill the screen. This of course won't happen if you're running in windowed mode. A good thing would be to consider different aspect ratios and adapt the image output of your game depending on the aspect ratio. In 2D platformers for example, it would be to display slightly more graphics horisontally in order to keep the aspect ratio of your graphics in proportion.

Good luck!


xlsior(Posted 2011) [#14]
That depends on the graphics card settings, PLUS the monitor: both have the ability to keep aspect ratio, and automatically put vertical black bars on the side.


_33(Posted 2011) [#15]
On the ATI Catalyst control center, by default, image scaling is set to off, but you can turn it on and tick the "maintain aspect ratio". But by default it is off. This option is what I consider an advanced user setting because most people don't bother with these options in the Catalyst. I have no clue for Nvidia.

Last edited 2011

Last edited 2011