• Setting the resolution for the graphical/framebuffer/drm console

    From Anton Shepelev@21:1/5 to All on Sun Dec 25 16:58:55 2022
    Hello, all.

    antiX Linux failed to autodetect and set the native
    resolution of my monitor, probably because of incorrect EDID
    information or a physical defect in EDID communication
    between display and GPU. I solved this problem for X11 by
    manual specification of driver and resolution in xorg.conf,
    but my virtual terminals -- or whatver is the term for the
    consoles accessible by CTRL+ALT+Fn -- still work in the
    wrong resolution, likely 1024x768. Can you help me configure
    the right one?

    To begin with, the machine in question is Newsmay AC8:

    http://www.newsmaytech.com/product/showproduct.php?lang=en&id=74

    It is connected to my Iyama ProLite E1902S display via VGA.
    The display's native resolution is 1280x1024. Here is my
    full inxi dump:

    https://pastebin.com/raw/7vA4ftUX

    of which the interesitng part is:

    Device-1: Intel JasperLake [UHD Graphics] driver: i915 v: kernel
    arch: Gen11 ports: active: DP-2 empty: DP-1,HDMI-A-1 bus-ID: 00:02.0
    chip-ID: 8086:4e61 class-ID: 0300
    Display: server: X.Org v: 1.20.11 driver: X: loaded: modesetting
    gpu: i915 display-ID: :0.0 screens: 1
    Screen-1: 0 s-res: 1280x1024 s-dpi: 96 s-size: 338x270mm (13.31x10.63")
    s-diag: 433mm (17.03")
    Monitor-1: DP-2 model-id: RGT 0x1252 serial: 16843009 res: 1280x1024
    hz: 75 dpi: 203 size: 160x90mm (6.3x3.54") diag: 1168mm (46") modes:
    max: 1024x768 min: 720x400
    OpenGL: renderer: Mesa Intel UHD Graphics (JSL) v: 4.6 Mesa 20.3.5
    direct render: Yes

    Observe the discrepancy between a max resolution of 1024x768
    and the actual resolution of 1280x1024 (the dump was
    collected from an X terminal emulator). I belive the first
    value is due to broken EDID.

    While running in X, my display reports its mode as 1280x1024
    at 75Hz, So my first impulse was to force that resulution
    via the corresponding GRUB parameter:

    GRUB_GFXMODE=1280x1024

    which failing, I logged on to GRUB and asked it what was the
    matter:

    grub> vbeinfo
    error: can't find command 'vbeinfo'
    grub> videoinfo
    Adapter 'Cirrus CLGD 5446 PCI Video Driver': No info available
    Adapter 'Bochs PCI Video Driver': No info available
    Adapter 'EFI GOP dirver':
    * 0x000 1024 x 768 x 32 ...
    0x001 640 x 480 x 32 ...
    0x002 800 x 600 x 32 ...
    EDID version: 1.4
    Preferred mode: 1024x768

    If this may explain my failure to set 1280x1024 in the
    console, what can I do make the resolution available?

    According to the kernel log (dmesg), the correct
    framebuffer/DRM driver is loaded:

    fbcon: Taking over console
    fbcon: i915drmfb (fb0) is primary device

    With the drm.debug=0xe kernel parameter, I see the following
    messages at startup

    https://pastebin.com/raw/ebnCTBU2

    including these:

    [ 3.141586] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:233:DP-2] probed modes :
    [ 3.141594] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1024x768": 60 65000 1024 1048 1184 1344 768 771 777 806 0x48 0x5
    [ 3.141600] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1920x1080": 60 148500 1920 2008 2052 2200 1080 1084 1089 1125 0x40 0xa
    [ 3.141606] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1400x1050": 60 121750 1400 1488 1632 1864 1050 1053 1057 1089 0x40 0x6
    [ 3.141612] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1600x900": 60 108000 1600 1624 1704 1800 900 901 904 1000 0x40 0x5
    [ 3.141617] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1280x1024": 75 135000 1280 1296 1440 1688 1024 1025 1028 1066 0x40 0x5
    [ 3.141623] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1280x1024": 60 108000 1280 1328 1440 1688 1024 1025 1028 1066 0x40 0x5
    [ 3.141628] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1440x900": 60 106500 1440 1520 1672 1904 900 903 909 934 0x40 0x6
    [ 3.141633] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1280x960": 60 108000 1280 1376 1488 1800 960 961 964 1000 0x40 0x5
    [ 3.141639] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1366x768": 60 85500 1366 1414 1557 1792 768 769 796 798 0x40 0x5
    [ 3.141644] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1280x800": 60 83500 1280 1344 1472 1680 800 801 829 831 0x40 0x5
    [ 3.141650] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1152x864": 75 108000 1152 1216 1344 1600 864 865 868 900 0x40 0x5
    [ 3.141655] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1280x768": 60 79500 1280 1328 1456 1664 768 769 796 798 0x40 0x5
    [ 3.141660] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1280x720": 60 74250 1280 1390 1430 1650 720 725 730 750 0x40 0x5
    [ 3.141666] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1024x768": 75 78750 1024 1040 1136 1312 768 769 772 800 0x40 0x5
    [ 3.141671] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1024x768": 70 75000 1024 1048 1184 1328 768 771 777 806 0x40 0xa
    [ 3.141676] [drm:drm_mode_debug_printmodeline [drm]] Modeline "1024x768": 60 65000 1024 1048 1184 1344 768 771 777 806 0x40 0xa
    [ 3.141770] [drm:drm_mode_debug_printmodeline [drm]] Modeline "832x624": 75 57284 832 864 928 1152 624 625 628 667 0x40 0xa
    [ 3.141776] [drm:drm_mode_debug_printmodeline [drm]] Modeline "800x600": 75 49500 800 816 896 1056 600 601 604 625 0x40 0x5
    [ 3.141781] [drm:drm_mode_debug_printmodeline [drm]] Modeline "800x600": 72 50000 800 856 976 1040 600 637 643 666 0x40 0x5
    [ 3.141875] [drm:drm_mode_debug_printmodeline [drm]] Modeline "800x600": 60 40000 800 840 968 1056 600 601 605 628 0x40 0x5
    [ 3.141881] [drm:drm_mode_debug_printmodeline [drm]] Modeline "640x480": 75 31500 640 656 720 840 480 481 484 500 0x40 0xa
    [ 3.141886] [drm:drm_mode_debug_printmodeline [drm]] Modeline "640x480": 73 31500 640 664 704 832 480 489 492 520 0x40 0xa
    [ 3.141892] [drm:drm_mode_debug_printmodeline [drm]] Modeline "640x480": 67 30240 640 704 768 864 480 483 486 525 0x40 0xa
    [ 3.141897] [drm:drm_mode_debug_printmodeline [drm]] Modeline "640x480": 60 25175 640 656 752 800 480 490 492 525 0x40 0xa
    [ 3.141902] [drm:drm_mode_debug_printmodeline [drm]] Modeline "720x400": 70 28320 720 738 846 900 400 412 414 449 0x40 0x6
    [ 3.141909] [drm:drm_client_modeset_probe [drm]] connector 215 enabled? no
    [ 3.141915] [drm:drm_client_modeset_probe [drm]] connector 225 enabled? no
    [ 3.141921] [drm:drm_client_modeset_probe [drm]] connector 233 enabled? yes
    [ 3.141931] [drm:drm_client_modeset_probe [drm]] Not using firmware configuration
    [ 3.141938] [drm:drm_client_modeset_probe [drm]] looking for cmdline mode on connector 233
    [ 3.141943] [drm:drm_client_modeset_probe [drm]] looking for preferred mode on connector 233 0
    [ 3.141948] [drm:drm_client_modeset_probe [drm]] found mode 1024x768
    [ 3.141954] [drm:drm_client_modeset_probe [drm]] picking CRTCs for 16384x16384 config
    [ 3.141960] [drm:drm_client_modeset_probe [drm]] desired mode 1024x768 set on crtc 91 (0,0)

    An attempt to set the native resolution via `fbset' fails as
    well:

    $ fbset 1280x1024-75
    ioctl FBIOPUT_VSCREENINFO: Invalid argument

    with the following in the kernel log:

    [ 1377.941980] i915 0000:00:02.0: [drm:drm_fb_helper_check_var [drm_kms_helper]] fbdev emulation doesn't support changing the pixel clock, value of pixclock is ignored
    [ 1377.941986] i915 0000:00:02.0: [drm:drm_fb_helper_check_var [drm_kms_helper]] fb requested width/height/bpp can't fit in current fb request 1280x1024-32 (virtual 1280x1024) > 1024x768-32

    With similar success, I have tried `fbset' with various
    1280x1024 modes pre-registered in /etc/fb.modes, as well as
    with ones generated by gtf(1), with 8-, 24, and 32-bit
    color.

    The following futher confirms that only 1024x768 is
    available for my consoles:

    $ cat /sys/class/graphics/fb0/modes
    U:1024x768p-0

    whereas

    cat /sys/class/graphics/fb0/mode

    prints nothing.

    Setting the desired mode directly fails:

    $ sudo echo U:1280x1024p-0 > /sys/class/graphics/fb0/mode
    -bash: /sys/class/graphics/fb0/mode: Permission denied

    Just in case, I have made certain that my consoles 1..6 are
    mapped to the framebuffer device:

    $ con2fbmap 1
    console 1 is mapped to framebuffer 0

    In desperation, I have tried setting the obsolete `vga'
    kernel parameter to 775, 794, and 795, but also in vain.

    This above largely exhausts the advice and information I
    have found concerning the configuration of the
    framebuffer/drm graphical consoles, so I find myself in
    need of your help in identifying the problem.

    --
    () ascii ribbon campaign -- against html e-mail
    /\ www.asciiribbon.org -- against proprietary attachments

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Shepelev@21:1/5 to All on Sun Dec 25 17:34:06 2022
    Andy Burns:

    I know you eventually want 1280x1024, but does 1024x768 or
    800x600 work (i.e. can greater than 640x480 work?)

    I think I have indicdated that the effective resolution in
    my virtual consoles looks like 1024x768. Yes, `fbset' can
    set both said 1024x768 and 640x480 without error, but in the
    latter case nothing changes except the console becomes
    limited to a smaller rectangle (640x480) in the upper-left
    part of the entire display area (1024x768). 800x600 will
    probably work, too, because it is listed GRUB's videoinfo
    (see OP). I will test it a bit later.

    One other idea I have is to query my current working X11
    modeline, convert it to the `fbset' mode entry, and try
    with `fbset'. Will report the issue of my adventures in
    that land.

    P.S.: Know you of a tool that would convert X11 modelines
    to fbset mode entries for me?

    --
    () ascii ribbon campaign -- against html e-mail
    /\ www.asciiribbon.org -- against proprietary attachments

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Anton Shepelev on Sun Dec 25 14:19:43 2022
    Anton Shepelev wrote:

    $ fbset 1280x1024-75
    ioctl FBIOPUT_VSCREENINFO: Invalid argument

    I know you eventually want 1280x1024, but does 1024x768 or 800x600 work (i.e. can greater than 640x480 work?)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Shepelev@21:1/5 to All on Sat Dec 31 18:18:50 2022
    I wrote:

    One other idea I have is to query my current working X11
    modeline, convert it to the `fbset' mode entry, and try
    with `fbset'.

    I failed to do so. My display reports its graphical mode as:

    1280x1024 H: 80.0 KHz V: 75.0Hz

    `xvidtune -show' expounds:

    "1280x1024" 135.00 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync

    But I fail to cause the modeline calculator:

    https://arachnoid.com/modelines/

    to generate exactly this line, which I wanted then to re-
    generate in FB format. The calculator's modeline differs
    from the original one no matter what adjustments to its
    inputs I try, e.g.

    # 1280x1024 @ 75.00 Hz (GTF) hsync: 80.18 kHz; pclk: 138.54 MHz
    Modeline "1280x1024_75.00" 138.54 1280 1368 1504 1728 1024 1025 1028 1069 -HSync +Vsync

    If I modify the refresh rate slighly to get the target pixel
    clock of 135.00 Hz, other parameters remain wrong. Can you
    help?

    --
    () ascii ribbon campaign -- against html e-mail
    /\ www.asciiribbon.org -- against proprietary attachments

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Shepelev@21:1/5 to All on Mon Jan 2 15:46:27 2023
    Now I have tried to use my working X mode in the
    framebuffer:

    ant@antix1:~
    $ xvidtune -show
    "1280x1024" 135.00 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync

    ant@antix1:~
    $ echo modeline <code>xvidtune -show</code> | ./modeline2fb
    # modes.fb - video mode descriptions for fbset
    #
    # See fbset(8) and fb.modes(5) for more information

    mode "1280x1024"
    geometry 1280 1024 1280 2444 32
    timings 7407 248 16 38 1 144 3
    hsync high
    vsync high
    endmode

    The last output being an entry for /etc/fb.modes, I renamed
    the entry to avoid collision with an existing one, and tried
    it via `fbset', but with neither success nor luck:

    $sudo fbset 1280x1024-ml2fb
    ioctl FBIOPUT_VSCREENINFO: Invalid argument
    $sudo dmesg | tail
    fb requested width/height/bpp can't fint in the fb request
    1280x1024-32 (virtual 1280x2444) > 1024x768-32

    I have also tried 8-, 16-, 24-bit color, and the a virtual
    resolution matching the physical one.

    --
    () ascii ribbon campaign -- against html e-mail
    /\ www.asciiribbon.org -- against proprietary attachments

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Shepelev@21:1/5 to All on Mon Jan 2 18:13:56 2023
    I have finally set the correct framebuffer mode via kernel
    boot option:

    DP-2:edid/1280x1024.bin

    where `DP-2' is my device id as seen by `xrandr' and
    `edid/1280x1024.bin' is a pseudo-path with the EDID firmware
    for the required resolution. There is not actual file at
    that location, the path is brutally hard-coded into the
    Linux kernel togeher with a corresponding blob:

    https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/drm_edid_load.c

    --
    () ascii ribbon campaign -- against html e-mail
    /\ www.asciiribbon.org -- against proprietary attachments

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Anton Shepelev on Mon Jan 2 16:06:43 2023
    Anton Shepelev wrote:

    I have finally set the correct framebuffer mode via kernel
    boot option:

    DP-2:edid/1280x1024.bin

    Well found ... it's been quite a few years since I had to roll my own modelines when driving a TV direct from a GPU over SCART.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)