Screen Resolution bug when running in Linux

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
xyzchyx
Posts: 6
Joined: Sun Nov 26, 2006 7:43 pm

Screen Resolution bug when running in Linux

Post by xyzchyx »

I'm using Linux, with recent Nvidia drivers on my geforce 7300 GS card (NVIDIA-Linux-x86-1.0-9629). I just tried compiling the Hello World demo using fullscreen mode with another resolution other than 640x480, and observed that although the screen changed to the specified resolution, the program itself only ran in the top left 640x480 area on the screen rather than actually filling the screen. I first noticed a similar behavior in the tech demo about a week ago, and remarked about it on the beginner's forum.
ssexton
Posts: 54
Joined: Wed Oct 25, 2006 7:46 am
Location: South Florida
Contact:

Post by ssexton »

Possibly a viewport problem. Or possibly, that particular app assumes its 640x480 somewhere else in the code.

fwiw, I run my app (not Hello World) on Linux fullscreen in 800x600 and don't have this issue.
xyzchyx
Posts: 6
Joined: Sun Nov 26, 2006 7:43 pm

Post by xyzchyx »

I can't see where else in the Hello World demo code that it's using any resolution other than the one mentioned in the CreateDevice call. Besides, this problem does not occur in 1.1 with the exact same drivers running, so I can't see it being a driver issue.

Peculiarly enough, I only notice this to be a problem at all at the resolution is specified at 800x600... at all other resolutions I tried, it filled the whole screen as normal.

(shrug)
CuteAlien
Admin
Posts: 9694
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I had the same problem and i think i found it.
In CIrrDeviceLinux.cpp in CIrrDeviceLinux::createWindow line 208
modes[bestMode]->vdisplay and modes[bestMode]->hdisplay should be swapped so it looks as follows:

Code: Select all

else if (bestMode!=-1
                        && modes[i]->hdisplay >= Width
                        && modes[i]->vdisplay >= Height
                        && modes[i]->hdisplay < modes[bestMode]->hdisplay
                        && modes[i]->vdisplay < modes[bestMode]->vdisplay)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, makes sense. Also that 640x480 is chosen (which is often the first resolution) while some got 800x600. I think my cards also don't have 640x480 so I got 800x600 correctly. I'll check in right now.
CuteAlien
Admin
Posts: 9694
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Hehe, now *that* was fast :-)

But i thought a little more about it and while it's somewhat better now, there still seems to be a problem. If a screen resolution is requested which is smaller than the smallest which can be offered by the system, than it will still look like xyzchyx has described. I tried that right now using 320x200 which is not supported on my machine.

I'm not deep enough in this code to know the best solution for that. Maybe the windowSize should not be const in this function so it can return the best available resolution and that could be used to create the driver. Or we should only allow for exact same sizes and not for >= Width. I would prefer the former (so you get fullscreen if you request it - even if it's not the same resolution), but i used here now the later (because it was easier to change).
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Now, the current situation is that you will get the smallest screen size offering at least the size requested. We cannot make it any smaller (because we cannot create the device then), and we cannot change the Width and Height (because this would kill fixed layouts). So the only chance is to make the screen size as good as possible and let the user try it. If the requested and returned sizes don't match the user might recreate the device or adapt the viewport later on.
Is that the correct way (or is there another possibility I don't see right now?)?
CuteAlien
Admin
Posts: 9694
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Hm, tricky. In my opinion making the screensize as good as possible ain't so good. Changing Width and Height will at least sometimes look corrrect while i couldn't think of a situation where having different resolutions for the window and the screen would seem to be correct. But for now i'll just avoid fullscreen if i can't set the resolution - and maybe that's not such a bad solution.
CuteAlien
Admin
Posts: 9694
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I think at least one more change should be made here:

In the randr-extension code the first mode with a resolution which is bigger or equal than the requested resolution is used. The requested resolutions should be prefered in any case when it's available.

Also i would recommend putting the check for the XRRQueryExtension in front of the XF86VidModeQueryExtension check. When randr has the correct resolution it can boost the framerate seriously.
Post Reply