My X screen has the incorrect dimensions and DPI (taken from running xdpyinfo). It’s an Acer XB273K GP 27" 4K screen:
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
I added the following files:
VendorName "NVIDIA Corporation"
BoardName "NVIDIA GeForce RTX 2080 Ti"
# HorizSync source: edid, VertRefresh source: edid
ModelName "Acer XB273K GP"
HorizSync 510.0 - 510.0
VertRefresh 48.0 - 144.0
DisplaySize 597.7 336.2
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-5"
Option "metamodes" "3840x2160_120 +0+0"
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
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: EDID — The Linux Kernel documentation