deleting bad probed modeline
Gleb Smirnoff
glebius at glebi.us
Sat Sep 28 05:29:20 UTC 2024
Hi,
TLDR: I came upon a need to disable a reported modeline, cause it is not
working and there is a legacy binary application that stumbles upon it.
Looks like there is no tool for that?
Longer version: there is a legendary 1999 game Heroes of Might & Magic III,
which had been released for Linux by Loki games. The game itself is 100%
playable on a modern FreeBSD (I bet on Linux, too). The game switches to
800x600 with XF86VidModeSwitchToMode API call. Before that it lists available
modes with XF86VidModeGetAllModelines and chooses _the last_ 800x600 mode from
the list. Since it is a binary file we can't fix that. My fairly modern laptop
Thinkpad X1 Carbon Gen7 reports these 800x600 modes:
[ 51.809] (II) modeset(0): Modeline "800x600"x60.0 81.00 800 832 928 1080 600 600 602 625 doublescan +hsync +vsync (75.0 kHz d)
[ 51.809] (II) modeset(0): Modeline "800x600"x60.3 40.00 800 840 968 1056 600 601 605 628 +hsync +vsync (37.9 kHz d)
[ 51.809] (II) modeset(0): Modeline "800x600"x56.2 36.00 800 824 896 1024 600 601 603 625 +hsync +vsync (35.2 kHz d)
This is how they are seen with xrandr --verbose:
800x600 (0x6d) 81.000MHz +HSync +VSync DoubleScan
h: width 800 start 832 end 928 total 1080 skew 0 clock 75.00KHz
v: height 600 start 600 end 602 total 625 clock 60.00Hz
800x600 (0x6e) 40.000MHz +HSync +VSync
h: width 800 start 840 end 968 total 1056 skew 0 clock 37.88KHz
v: height 600 start 601 end 605 total 628 clock 60.32Hz
800x600 (0x6f) 36.000MHz +HSync +VSync
h: width 800 start 824 end 896 total 1024 skew 0 clock 35.16KHz
The server easily switches to the first one:
>xrandr --output eDP-1 --mode 800x600
But explicitly being asked for the third one it fails after a screen
blink:
>xrandr --output eDP-1 --mode 0x6f
xrandr: Configure crtc 0 failed
Same happens if I try to play Heroes III - it fails to switch the mode, cause
it picks the last one from available 800x600s. See that if server is compiled
with debug:
[ 76.795] SwitchToMode - scrn: 0 clock: 36000
[ 76.795] hdsp: 800 hbeg: 824 hend: 896 httl: 1024
[ 76.795] vdsp: 600 vbeg: 601 vend: 603 vttl: 625 flags: 5
...
[ 76.796] Checking against clock: 36000 (36000)
[ 76.796] hdsp: 800 hbeg: 824 hend: 896 httl: 1024
[ 76.796] vdsp: 600 vbeg: 601 vend: 603 vttl: 625 flags: 5
[ 76.815] (EE) modeset(0): failed to set mode: No such file or directory
To confirm that, I quickly hacked the server not to report this mode via
XF86VidModeGetAllModelines and after that Heroes sucessfully run.
So, looks like my laptop reports something it can not do and there is no way
to override that. Looks like hardware reported modes are not allowed to be
deleted via randr API:
>xrandr --delmode eDP-1 0x6f
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 19 (RRDeleteOutputMode)
Serial number of failed request: 32
Current serial number in output stream: 33
Reading through sources it seems the old API XF86VidModeDeleteModeline still
can delete it, but is there any working tool left that uses it old API?
xvidtune seems to be not functional at all.
Any ideas?
Sidenote: using legacy X.org Intel driver instead of modeset, I would not see
the second mode, but only first and faulty third one. Problem remains:
[ 67928.274] (EE) intel(0): failed to set mode: Invalid argument
--
Gleb Smirnoff
More information about the xorg
mailing list