Bug 1099812

Summary: modesetting driver: xrandr fails
Product: [openSUSE] openSUSE Tumbleweed Reporter: Peter Sütterlin <P.Suetterlin>
Component: X.OrgAssignee: E-mail List <xorg-maintainer-bugs>
Status: RESOLVED FIXED QA Contact: E-mail List <xorg-maintainer-bugs>
Severity: Major    
Priority: P5 - None CC: mjambor, msrb, P.Suetterlin, w01dnick
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=107099
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Peter Sütterlin 2018-07-02 09:23:17 UTC
I'm running TW on a Lenovo T460p (Skylake/HD530), using the modesetting driver.

Since at least TW 20180625 (I don't have older snapshots around) I can no longer properly change the resolution of the display.  I first noticed when running games that want to go fullscreen, but in a different resolution.  I either get an error message like

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  152 (XFree86-VidModeExtension)
  Minor opcode of failed request:  10 (XF86VidModeSwitchToMode)
  Value in failed request:  0x193
  Serial number of failed request:  46
  Current serial number in output stream:  50

and the program dies, or I am left with a black screen and have to switch to a VT and kill the program.  One of the latter is the atari800 emulator.  If I start it windowed, and then switch to fullscreen, I get only the black window.  I can however start it with proper resolution, atari800 -fullscreen -fs-width 2560 -fs-height 1440, then it works.

Next I tried xrandr, switching to 1920x1080.
This *also* left me with a black screen.  I tried logging in on VT, setting DISPLAY and XAUTHORITY, then calling xrandr so switch back, but this did not work.  an 'xrandr -s 0' reported an out-of-range index, as there are 0 resolutions available (xrandr without options lists some 20 of them....)

I then installed xf86-video-intel and restarted X, then programs and xrandr do work as expected.
Comment 2 Stefan Dirsch 2018-07-02 12:51:17 UTC
I'll add the patch to our xorg-x11-server package in obs://X11:XOrg, but I'm very sceptical, that it is going to fix the issue, since the patch claims to fix the rotation issue. And as far as I understood you are not using rotation at all.
Comment 3 Stefan Dirsch 2018-07-02 13:08:15 UTC
(In reply to Stefan Dirsch from comment #2)
> I'll add the patch to our xorg-x11-server package in obs://X11:XOrg, but I'm
> very sceptical, that it is going to fix the issue, since the patch claims to
> fix the rotation issue. And as far as I understood you are not using
> rotation at all.

Done. Package is rebuilding right now. Check for RPM changelog

-------------------------------------------------------------------
Mon Jul  2 12:46:54 UTC 2018 - sndirsch@suse.com

- U_modesetting-use-drmmode_bo_import-for-rotate_fb.patch
  * fixes rotation in modesetting driver (regression with
    xorg-server 1.20.0, fdo#106715)
  * might also fix boo#1099812 ...

--> https://build.opensuse.org/project/monitor/X11:XOrg

Please let me know, whether it fixes the RANDR issue in modesetting driver. It won't fix the vidmode issue. IMO the applications are wrong here.
They should verify first, if this extension exists and not just bail out ...
Comment 4 Michal Srb 2018-07-02 13:52:17 UTC
Copying here email I sent to opensuse-factory for the record:

I have seen this issue recently with "dosbox -fulscreen" failing to set the
resolution. It is broken with xf86-video-modesetting running on intel gpu, 
while xf86-video-intel works fine.

The issue is that X server is trying to set resolution with the doublescan 
flag but the i915 driver refuses it. The failure bubbles all the way up to the 
X client where it is reported as a BadValue error. When you use xf86-video-intel, those resolutions are filtered out, so are not even attempted.

The question is why are those resolutions even offered if they can not work. I did not debug deeper, so I don't know at what level they are added to the list.

(In reply to Stefan Dirsch from comment #3)
> Please let me know, whether it fixes the RANDR issue in modesetting driver.
> It won't fix the vidmode issue. IMO the applications are wrong here.
> They should verify first, if this extension exists and not just bail out ...

Actually the vidmode ("XFree86-VidModeExtension") exist and works when xf86-video-intel is in use.
Comment 5 Peter Sütterlin 2018-07-02 14:20:12 UTC
@Stefan: Thanks for implementing.  No idea either whether it helps, just the symptoms sounded very similar, and somehow rotation is also a resolution change...

Might take a moment to test this build.  I'm still at official TW xorg  1.19, so I can't just drop in the server package but need to pull a lot more.  ATM I need the machine for work :o
Comment 6 Peter Sütterlin 2018-07-03 08:24:59 UTC
Sorry, got too late yesterday to test....

So I've now updated to xorg-x11-server-1.20.0-545.1 from X11:XOrg.
As you suspected, it did not cure the problem:  Still the programs (quake) die with the same error, and xrandr makes the screen unusable.

As I regard xrandr a central/crucial system component I raise the severity of this one to major.  Revert if you think otherwise.
Comment 7 Peter Sütterlin 2018-07-03 09:21:37 UTC
Hmm, with that version (1.20.0-545.1) optirun doesn't work anymore.
The laptop has an optimus, HD530/940MX, I use bumblebee/optirun for using that card now and then.  With 1.20 the second X server is started, I can shortly see the window opening, but it's immediately closed/killed again.  No error messages from the second X server log, and nothing on the console starting the programs.
With the default 1.19.6 of TW this works.
Should I open a separate bug report for this?
Comment 8 Stefan Dirsch 2018-07-03 10:21:37 UTC
(In reply to Peter Sütterlin from comment #7)
> Hmm, with that version (1.20.0-545.1) optirun doesn't work anymore.
> The laptop has an optimus, HD530/940MX, I use bumblebee/optirun for using
> that card now and then.  With 1.20 the second X server is started, I can
> shortly see the window opening, but it's immediately closed/killed again. 
> No error messages from the second X server log, and nothing on the console
> starting the programs.
> With the default 1.19.6 of TW this works.
> Should I open a separate bug report for this?

Yes, please do so.
Comment 9 Peter Sütterlin 2018-07-03 11:19:25 UTC
-->  #1099974

While at it, I also opened an upstream bug for the current xrandr issue,
https://bugs.freedesktop.org/show_bug.cgi?id=107099
Comment 10 Mykola Krachkovsky 2018-07-18 10:12:51 UTC
After last Tumbleweed update (0714 or maybe 0712, haven't checked it) DoubleScan modes work fine for me.
Comment 11 Martin Jambor 2018-07-18 12:05:31 UTC
I can confirm that dosbox can run in fullscreen after some recent TW update too.
Comment 12 Peter Sütterlin 2018-07-18 12:16:22 UTC
Currently still at 20180712, the atari800 fullscreen still fails for me.  Will update later today and re-check.
Comment 13 Mykola Krachkovsky 2018-07-18 13:11:03 UTC
Yeah, it's 0714, changes for kernel has: "drm/i915: Allow DBLSCAN user modes with eDP/LVDS/DSI"
Comment 14 Swamp Workflow Management 2018-07-19 14:20:17 UTC
This is an autogenerated message for OBS integration:
This bug (1099812) was mentioned in
https://build.opensuse.org/request/show/624084 Factory / xorg-x11-server
Comment 15 Peter Sütterlin 2018-07-19 15:49:49 UTC
Just to confirm, after update to TW 20180714 all reported errors are solved, all FS programs and xrandr work as expected.