
Display detection fails when Nvidia twinview is enabled under linux
Posted Tuesday, 5 October, 2010 - 03:48 by jdomnitz| Project: | The Open Toolkit library |
| Version: | 1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | fixed |
Jump to:
Description
I have been getting this reported by a few users and have narrowed the issue down to this. When nvidia twinview is enabled, the displaydevices array is empty even though there are 2 valid monitors available. When disabled (and no other changes) everything works fine.
I have attached a diff of the config file showing the changed options that could be effecting things.
| Attachment | Size |
|---|---|
| config changes.txt | 1.19 KB |


Comments
#1
Right now, OpenTK requires XRandR to detect available modes through Xinerama and XRandR. Unfortunately, XRandR doesn't work very well when Nvidia/TwinView is enabled. We probably need to fall back to the deprecated XF86VMextension when XRandR fails.
Which OpenTK version are you using? I recall an "empty DisplayDevice array" being fixed on a recent OpenTK version. If possible, try running your program with the debug version of OpenTK.dll and log the output from System.Diagnostics.Debug, which should point to the exact point of failure.
#2
This is using the latest openTK code (not more the a couple days old). I run the ubuntu 10.10 branch and can't repro the issue so I assume its fixed in the lastest nvidia drivers. Not all of my users will be using the latest branch though, so if theres a way to restore compatibility that would be great. If any users can repro the issue with a debugger and post that would be even better but I could look into implementing xf86 support. Are there any plans or existing code in that department or am I starting from scratch?
#3
The relevant code is in OpenTK/Platform/X11/X11DisplayDevice.cs. We'd need to implement QueryXF86() in a similar fashion to QueryXRandR() (see lines 76, 122 and 199).
The necessary DllImports are already in place as "API.XF86VidMode*" (man 3 xf86vm) so it's mainly a matter of piecing together out how they work.
#4
Alright I implemented queryxf86...just have to do some testing and then i'll send it your way.
I think I found the actual problem though...it wasn't just an issue with twinview, its an issue with xinerama and twinview. Xinerama query screens returns 0 screens....and the QueryXinerama function still returns true. Can we change the final line from return true to return (devices.Count>0)?
#5
Aha, yes, please do that.
#6
Done tested and working:
Only thing I couldn't get was bit depth for each of the supported resolutions (only was able to get current bit depth).
A few changes were needed to the APIs also... the main one being the dll path was wrong. I changed it to
private const string _dll_name_vid = "libXxf86vm.so.1but it could be left as is and a DllMap used - its up to you.
and lastly a few new P/Invokes for the API class:
#7
Sorry about the formatting...it looked right when I pasted it in but got screwed up after posting.
#8
Thanks, looking good!
#9
Commited to r2784. Many thanks!