Bug 955

Summary: Implement the ability to use/list resolutions not listed by the nvidia driver
Product: [JogAmp] Newt Reporter: Maxime Caignart <maxime-jogamp>
Component: coreAssignee: Sven Gothel <sgothel>
Status: UNCONFIRMED ---    
Severity: enhancement CC: monsieur.max
Priority: ---    
Version: 1   
Hardware: All   
OS: linux   
Type: --- SCM Refs:
Workaround: TRUE
Attachments: linux-x11-nv331_38.txt

Description Maxime Caignart 2014-01-31 13:36:07 CET
The nvidia driver for linux prevents from using any non-native resolution : https://devtalk.nvidia.com/default/topic/525287/linux/non-native-resolutions-not-available-in-3xx-drivers-on-8700m-gt/

In Jogamp, the result is that :
- monitor modes listed are limited to native resolution
- fullscreen seems to be limited to native resolution

However, note that on the very same computer, most games ( from steam, for instance and probably not jogamp games) gives the possibility to choose from plenty of screen resolution.

As stated in the link at the top, it's seems to be related to xrandr.
Comment 1 Maxime Caignart 2014-01-31 13:42:20 CET
In the nvidia forum link, it is suggested the following :

________________________________
" They do provide modes for non-native resolutions. But only to xrandr1.1 and the xvidmode extension. You can see the modes with

xrandr --q1

and switch to them with

xrandr -s YYYxZZZ "
_________________________________

This suggestion is working, it's possible to force the resolution despite it not being listed by the nvidia drive.
Comment 2 Sven Gothel 2014-01-31 16:22:29 CET
Created attachment 584 [details]
linux-x11-nv331_38.txt
Comment 3 Sven Gothel 2014-01-31 16:23:52 CET
(In reply to comment #2)
> Created attachment 584 [details]
> linux-x11-nv331_38.txt

Shows screen modes are detected ..

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option         "UseEdidDpi" "false"
    # Option "CustomEDID" "DFP-0:/etc/X11/edid-sgothel-dfp0.bin"
    Option         "RandRRotation" "on"
    Option         "DynamicTwinView" "False"
EndSection

[    86.479] (II) NVIDIA(0): Display (Samsung SMS27A850 (DFP-0)) does not support NVIDIA 3D
[    86.479] (II) NVIDIA(0):     Vision stereo.
[    86.479] (II) NVIDIA(GPU-0): Found DRM driver nvidia-drm (20130102)
[    86.480] (II) NVIDIA(0): NVIDIA GPU GeForce GTX 660 (GK106) at PCI:1:0:0 (GPU-0)
Comment 4 Sven Gothel 2014-02-13 01:39:16 CET
@Maxime: I need more input to validate this NV driver issue.
Comment 5 Maxime Caignart 2014-02-13 09:52:33 CET
Hello Sven,

I can provide any needed input. 
What else do you need ?
Comment 6 Maxime Caignart 2014-08-09 11:18:42 CEST
Hello Sven,

I'm working back on trying to find a workaround/solution for this issue.

Exectuing the same test cases as yours leads to a different result for me :

Screen: NEWT-Screen[.x11_:0-1-s0, idx 0, refCount 1, vsize [ 0 / 0  1920 x 1080 ], X11GraphicsScreen[X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f82d8003640, owner true, ResourceToolkitLock[obj 0x23006ff2, isOwner false, <67cea89c, 309fcf02>[count 0, qsz 0, owner <NULL>]]], idx 0], NEWT-Display[.x11_:0-1, excl false, refCount 1, hasEDT true, edtRunning true, X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f82d8003640, owner true, ResourceToolkitLock[obj 0x23006ff2, isOwner false, <67cea89c, 309fcf02>[count 0, qsz 0, owner <NULL>]]]], monitors: [Monitor[Id 0x0, 344 x 193 mm, viewport [ 0 / 0  1920 x 1080 ], orig [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], curr [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], modeChanged false, modeCount 8]]]
All-0[000]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr]
All-0[001]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 90 degr]
All-0[002]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 180 degr]
All-0[003]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 270 degr]
All-0[004]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 0 degr]
All-0[005]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 90 degr]
All-0[006]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 180 degr]
All-0[007]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 270 degr]
All-1[000]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 270 degr]
All-1[001]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 180 degr]
All-1[002]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 90 degr]
All-1[003]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 0 degr]
All-1[004]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 270 degr]
All-1[005]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 180 degr]
All-1[006]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 90 degr]
All-1[007]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr]
0: Monitor[Id 0x0, 344 x 193 mm, viewport [ 0 / 0  1920 x 1080 ], orig [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], curr [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], modeChanged false, modeCount 8]
[00][000]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr]
[00][001]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 90 degr]
[00][002]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 180 degr]
[00][003]: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 270 degr]
[00][004]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 0 degr]
[00][005]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 90 degr]
[00][006]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 180 degr]
[00][007]: [Id 0x2df, [ 1920 x 1080 x 32 bpp ] @ 50.0 Hz, flags [], 270 degr]
[0] orig   : [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr]
[0] current: [Id 0x2de, [ 1920 x 1080 x 32 bpp ] @ 60.0 Hz, flags [], 0 degr]

_____________________________________________________________

It's confirmed by the xrandr output : 

maxime@W520:~$ xrandr
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
VGA-0 disconnected (normal left inverted right x axis y axis)
LVDS-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1920x1080      60.0*+   50.0  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)

_____________________________________________________________

As stated in my first message, using --q1 allows to see that multiple resolution are handled :

maxime@W520:~$ xrandr --q1
 SZ:    Pixels          Physical       Refresh
*0   1920 x 1080   ( 341mm x 190mm )  *50   51  
 1   1680 x 1050   ( 298mm x 185mm )   52  
 2   1440 x 900    ( 255mm x 158mm )   53  
 3   1366 x 768    ( 242mm x 135mm )   54  
 4   1280 x 1024   ( 227mm x 180mm )   55  
 5   1280 x 800    ( 227mm x 141mm )   56  
 6   1280 x 720    ( 227mm x 127mm )   57  
 7   1024 x 768    ( 181mm x 135mm )   58  
 8    800 x 600    ( 142mm x 105mm )   59  
 9    640 x 480    ( 113mm x  84mm )   60  
Current rotation - normal
Current reflection - none
Rotations possible - normal left inverted right 
Reflections possible - X Axis Y Axis

_______________________________________________________________

Using : 
maxime@W520:~$ xrandr -s 1440x900
maxime@W520:~$ xrandr -s 1920x1080

My screen changed resolution as expected.

_______________________________________________________________


The post I linked ( https://devtalk.nvidia.com/default/topic/525287/linux/non-native-resolutions-not-available-in-3xx-drivers-on-8700m-gt/ ) contains very interessant information about this :

"RandR 1.2 gives complete control of the display configuration, including choosing the actual mode timings to send to the display and how the desktop should be scaled to that resolution, to the X client applications (i.e. Wine in this case). When an application chooses to use RandR 1.2 requests rather than RandR 1.1 requests, it is assuming control of that configuration and needs to handle all of the options users might want to configure, including scaling."


From the previous statement, a posible workaround for this issue could be to force jogamp to use the Randr11 implem rather than Randr13. 
What do you think of it ?
Comment 7 Maxime Caignart 2014-08-09 11:23:30 CEST
Please note that when using the "Nouveau" driver, everything works as expected, ie all available resolutions are displayed.
Comment 8 Sven Gothel 2014-09-02 15:23:27 CEST
Copy/paste dialog:

(03:11:58 PM) sgothel: just tested .. I see all resolutions
(03:12:22 PM) monsieur_max: well, i've tested on a vanilla install of different ubuntu with proprietary nvidia on my computer, no custom changes on xorg.conf, so i'm afraid that this issue might happen for many users
(03:12:32 PM) sgothel: Debian Jessie here ..
(03:13:00 PM) monsieur_max: interesting
(03:13:02 PM) sgothel:     Option         "RandRRotation" "on"
(03:13:02 PM) sgothel:     Option         "DynamicTwinView" "False"
(03:13:02 PM) sgothel: ^^ was required w/ old NV drivers
(03:13:14 PM) sgothel: dunno its impact now
(03:13:38 PM) monsieur_max: mmmh i'll keep that in mind
(03:13:48 PM) monsieur_max: can you teell me your xrandr version please ?
(03:14:07 PM) sgothel: sven@risa:~/projects/JOGL/jogl/make$ xrandr --version
(03:14:07 PM) sgothel: xrandr program version       1.4.2
(03:14:07 PM) sgothel: Server reports RandR version 1.4
(03:14:31 PM) monsieur_max: ok
(03:14:38 PM) monsieur_max: thanks for the information
(03:15:29 PM) sgothel: -Dnewt.debug.Screen gives me ..
(03:16:06 PM) sgothel: RandR 1.4.0, jogamp.newt.driver.x11.RandR13@6f1fba17
(03:16:06 PM) sgothel: ScreenVirtualSize: 3840x2160 617x339 mm
(03:16:06 PM) sgothel: XRRGetScreenSizeRange: 8x8 .. 16384x16384
(03:16:06 PM) sgothel: XRRScreenResources 0x7f21647ec360: Crtc count 4
(03:16:08 PM) sgothel: etc
(03:16:45 PM) sgothel: I read NV's response .. a while ago, and they said it's also about the monitor .. i.e. does it support other native resolutions ?
(03:17:00 PM) monsieur_max: well, it does :-/
(03:17:47 PM) sgothel: try w/ '-Dnewt.debug.Screen' and above NV settings .. maybe we can solve it finally, I know it's annoying
(03:18:41 PM) monsieur_max: using nouveau withtout problem, and mutliple other games are able to switch resolution, also, using xrandr --q1 allows to switch with no problem. No fancy computer Thinkpad W520
(03:19:07 PM) sgothel: yeah .. but its a bit odd to use pre xrandr version .. hmm
(03:19:10 PM) monsieur_max: sgothel: ok, I'll get back to you then, I'll update the bug thread with everything soon
(03:19:15 PM) sgothel: well, we have both impl. ..
(03:19:33 PM) sgothel: if you find a good trigger in code, to switch to old impl. .. hmm
(03:19:39 PM) monsieur_max: sgothel: my idea was to force the old one, as a workaround
(03:19:44 PM) monsieur_max: yep
(03:19:53 PM) monsieur_max: not perfect but good enough
(03:20:16 PM) sgothel: try '-Dnewt.test.Screen.disableRandR13' :)
(03:20:42 PM) sgothel: x11.ScreenDriver line 93 :)
(03:21:07 PM) monsieur_max: haha :) ok noted, unfortunately, I'll have to wait a few hours for that
(03:21:24 PM) sgothel: still .. needs a working solution, w/o such magic
Comment 9 Maxime Caignart 2014-09-02 19:17:53 CEST
-Dnewt.test.Screen.disableRandR13 did the trick.

All expected modes are available.
For me, as it's a nvidia issue, failing to handle xrandr correctly, this is an acceptable solution.

Feel free to mark it as resolved.