Fedora 34 Xorg Screen Size

My X screen has the incorrect dimensions and DPI (taken from running xdpyinfo). It’s an Acer XB273K GP 27" 4K screen:

screen #0:
  dimensions:    3840x2160 pixels (1016x572 millimeters)
  resolution:    96x96 dots per inch

Its real dimensions are approx 597mm x 336mm.

Previously I would add the correct dimensions to /etc/X11/xorg.conf but it’s been a few years since I configured a Linux desktop, so I wanted to check that I’m doing it the right way. $XDG_SESSION_TYPE says I’m running x11, not Wayland, which is fine as last I read, Emacs had trouble with Wayland. I’m using the nvidia drivers “xorg-x11-drv-nvidia-470.57.02” from the rpmfusion-nonfree-updates repo.

What is the correct method for adding/modifying the screen dimensions in x11 on Fedora 34?

I think I solved my own question, after some more digging around :slight_smile:

I added the following files:

/etc/X11/xorg.conf.d/40-device.conf

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce RTX 2080 Ti"
EndSection

/etc/X11/xorg.conf.d/50-monitor.conf

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Acer"
    ModelName      "Acer XB273K GP"
    HorizSync       510.0 - 510.0
    VertRefresh     48.0 - 144.0
    Option         "DPMS"
    DisplaySize    597.7 336.2
EndSection

/etc/X11/xorg.conf.d/60-screen.conf

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-5"
    Option         "metamodes" "3840x2160_120 +0+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

All these values were taken from the xorg.conf that the NVidia X server settings application creates for you.

(If I’m doing this incorrectly, please let me know!!)

Normally, the kernel gets EDID information from the monitor to know its properties including its size. If this information is incorrect, it is possible to create your own EDID file and tell the kernel to use it using boot command line options. This is perhaps more complicated than doing the Xorg configuration you have done, but on the other hand it will not be limited to X. If/when you switch to Wayland, it will work in that environment too, for example.

I once did this and it took me some googling. I have not kept the links, but this seems to be a place to start: https://www.kernel.org/doc/html/latest/admin-guide/edid.html