You are not logged in.

#1 2020-11-21 11:34:34

karb94
Member
Registered: 2019-12-15
Posts: 10

[SOLVED] Set default resolution and refresh rate with xorg.conf

This is the output of xrandr

Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 16384 x 16384
DisplayPort-0 disconnected primary (normal left inverted right x axis y axis)
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
DisplayPort-2 disconnected (normal left inverted right x axis y axis)
HDMI-A-0 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     99.95*+ 144.00   120.00    59.95
   3840x2160     60.00    50.00    59.94    30.00    25.00    24.00    29.97    23.98
   1920x1200     99.95
   1920x1080    120.00   119.88    60.00    60.00    50.00    59.94
   1600x1200     99.95
   1680x1050     59.88
   1600x900      60.00
   1280x1024     75.02    60.02
   1440x900      99.95
   1280x800      59.91
   1280x720      60.00    50.00    59.94
   1024x768      75.03    60.00
   800x600       75.00    60.32
   720x576       50.00
   720x480       60.00    59.94
   640x480       75.00    60.00    59.94
DVI-D-0 disconnected (normal left inverted right x axis y axis)

As you can see the default refresh rate is 99.95 Hz. I want to set the default to 144.00. This xrandr command sets the resolution and refresh rate to the desired one:

xrandr --output HDMI-A-0 --mode 2560x1440 --rate 144

I would like to set my xorg.conf to do this automatically on startup (instead of placing the above command in .profile). My current xorg.conf is as follows:

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

Section "Monitor"
    Identifier "HDMI"
    Modeline "2560x1440_144.00"  808.75  2560 2792 3072 3584  1440 1443 1448 1568 -hsync +vsync
    Option "PreferredMode" "2560x1440_144.00"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "AMD" # e.g. Radeon, Intel, nvidia
    Monitor "HDMI"
    DefaultDepth 24
    SubSection "Display"
        Depth       24
        Modes       "2560x1440_144.00"
    EndSubSection
EndSection

/etc/X11/xorg.conf.d/20-amdgpu.conf

Section "Device"
     Identifier "AMD"
     Driver "amdgpu"
     Option "TearFree" "true"
     Option "HDMI-A-0" "HDMI"
EndSection

This does not set the refresh rate to 144 Hz. What am I doing wrong?

Last edited by karb94 (2020-11-22 21:21:10)

Offline

#2 2020-11-21 12:23:00

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED] Set default resolution and refresh rate with xorg.conf

I'd suggest using different names then HDMI and AMD as they're to generic and used in many places in code already.
Descriptive entries like "aging fullhd monitor in computerroom" , "4k tvscreen in living room" , " my first (very expensive) amd videocard"  work better.

man xorg.conf wrote:

       With  RandR  1.2-enabled  drivers, monitor sections may be tied to specific outputs of the video card.  Using the name of the output
       defined by the video driver plus the identifier of a monitor section, one associates a monitor section with an output by  adding  an
       option to the Device section in the following format:

       Option "Monitor-outputname" "monitorsection"

       (for example, Option "Monitor-VGA" "VGA monitor" for a VGA output)

Try "Monitor-HDMI-1" or "Monitor-HDMI-A-0" (not sure which of those corresponds to outputname on your system)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2020-11-21 22:04:58

karb94
Member
Registered: 2019-12-15
Posts: 10

Re: [SOLVED] Set default resolution and refresh rate with xorg.conf

Option "Monitor-outputname" "monitorsection"

Good catch. I wrote my files based on the example in the wiki so I wasn't aware that you had to prefix the outputname with "Monitor-" in the Option line. Unfortunately, this didn't completely solve the problem. Now when Xorg server is launched the screen goes black sad. These are the modified files:

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

Section "Monitor"
    Identifier "LG 27GL850 HDMI"
    Modeline "2560x1440_144.00"  808.75  2560 2792 3072 3584  1440 1443 1448 1568 -hsync +vsync
    Option "PreferredMode" "2560x1440_144.00"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "RX 580"
    Monitor "LG 27GL850 HDMI"
    DefaultDepth 24
    SubSection "Display"
        Depth       24
        Modes       "2560x1440_144.00"
    EndSubSection
EndSection

/etc/X11/xorg.conf.d/20-amdgpu.conf

Section "Device"
     Identifier "RX 580"
     Driver "amdgpu"
     Option "TearFree" "true"
     Option "Monitor-HDMI-A-0" "LG 27GL850 HDMI"
EndSection

Last edited by karb94 (2020-11-22 11:02:58)

Offline

#4 2020-11-22 13:02:42

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED] Set default resolution and refresh rate with xorg.conf

Used names are much clearer now.

Many recent problems with graphics have been solved by configuring early KMS, see https://wiki.archlinux.org/index.php/Ke … _KMS_start

Once that's been configured reboot to ensure the amdgpou kernel module / card have been initialised successfully before X starts.
Post the xorg log* from that start.


* the location of xorg logs depends on how X is started, see ithttps://wiki.archlinux.org/index.php/Xorg#General


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2020-11-22 16:04:33

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] Set default resolution and refresh rate with xorg.conf

Here's the config file I use to set default resolution with the AMD driver:

Section "Monitor"
    Identifier "DisplayPort-0"
    Modeline "2560x1440_144"  586.00  2560 2568 2600 2640  1440 1465 1473 1543 +hsync -vsync
    Option "PreferredMode" "2560x1440_144"
EndSection

This is the whole file, there's nothing else needed.

You have to customize the "Identifier" to the output name where your monitor is connected ("HDMI-A-0").

You have to customize the "Modeline" to your monitor's data. You can find the modeline values of your monitor in the Xorg log file. The driver lists the monitor's modelines there.

I can tell you right now that the modeline you currently tried using in your config file is not good. The "pixel clock" value is unusually high. Monitors today use a "reduced blank" modeline which can't be generated by the normal "cvt" tool for a 144Hz refresh. The normal "cvt" tool can only do 60Hz or 120Hz. There's a special "cvt12" tool in the AUR if you want to generate a 144Hz modeline yourself.

Last edited by Ropid (2020-11-22 16:19:45)

Offline

#6 2020-11-22 21:19:15

karb94
Member
Registered: 2019-12-15
Posts: 10

Re: [SOLVED] Set default resolution and refresh rate with xorg.conf

Ropid wrote:

I can tell you right now that the modeline you currently tried using in your config file is not good. The "pixel clock" value is unusually high. Monitors today use a "reduced blank" modeline which can't be generated by the normal "cvt" tool for a 144Hz refresh. The normal "cvt" tool can only do 60Hz or 120Hz. There's a special "cvt12" tool in the AUR if you want to generate a 144Hz modeline yourself.

That was it! I got my timings from cvt as suggested in the arch wiki but they were nowhere near the correct ones. I checked the Xorg log file and found the right values for 2560x1440 144Hz and everything works fine now. Out of curiosity, is this explained anywhere in the wiki?

Offline

#7 2023-11-18 07:23:15

Jmvars
Member
Registered: 2023-11-05
Posts: 1

Re: [SOLVED] Set default resolution and refresh rate with xorg.conf

Ropid wrote:

You have to customize the "Modeline" to your monitor's data. You can find the modeline values of your monitor in the Xorg log file. The driver lists the monitor's modelines there.

Oh my god thanks! Couldn't find it explained anywhere where I'm supposed to find these values.

EDIT: If you have a multi-monitor setup, the above configuration will clone your main monitor to your other monitor (possibly every other monitor if you have more than two). Instead, I had to create this file and also edit another in /usr/share/xorg.conf.d:

10-monitor.conf:

Section "Monitor"
	Identifier	"DisplayPort-0" # Not sure if this needs to be the same as in "xrandr -q".
	Modeline	"2560x1440_144"	586.00	2560 2608 2640 2720	1440 1443 1448 1481 +hsync -vsync # Find these values in "/var/log/Xorg.0.log. They will be in this exact format so scroll until you find it.
	Option		"PreferredMode"	"2560x1440_144"
	Option		"LeftOf"	"HDMI-A-0" # This is needed to map your setup correctly, in my case my main monitor (DisplayPort-0) is on the left while my secondary (HDMI-A-0) is on the right. "RightOf" also exists.
EndSection

Section	"Monitor"
	Identifier	"HDMI-A-0" #
	Modeline	"1920x1080_60"	148.50	1920 2008 2052 2200	1080 1084 1089 1125 +hsync +vsync
	Option		"PreferredMode"	"1920x1080_60"
	Option		"RightOf"	"DisplayPort-0"
EndSection

Section	"Screen"
	Identifier	"Screen 0"
	Device		"Radeon" # Radeon, Intel or nvidia
	Monitor		"HDMI-A-0"
	DefaultDepth	24
	SubSection	"Display"
		Depth		24
		Virtual	4480 1440 # This will create the total span of your multi-monitor setup, it should be all widths added together (in my case 2560+1920=4480) and the height should be the highest height you have, in my case 1440.
	EndSubSection
EndSection

I renamed "10-amdgpu.conf" to "20-amdgpu.conf" to make it load after the first one because the wiki said so, I then added the lines:

Option "Monitor-DisplayPort-0" "DisplayPort-0"
Option "Monitor-HDMI-A-0" "HDMI-A-0"

under Section "OutputClass", making it:

Section "OutputClass"
	Identifier	"AMDgpu"
	MatchDriver	"amdgpu"
	Driver		"amdgpu"
	Option		"HotplugDriver"	"amdgpu"
	Option		"Monitor-DisplayPort-0"	"DisplayPort-0"
	Option		"Monitor-HDMI-A-0"	"HDMI-A-0"
EndSection

Now it works great, my main monitor persists on 144Hz and the other monitor works as it should.

Sources:
Ropid (post #5 in this topic)
Dualhead configuration using relative coordinates with custom resolutions

I kinda want to post this as a PSA somewhere since this was a pain to figure out but I have no idea where.

Last edited by Jmvars (2023-11-18 09:27:26)

Offline

Board footer

Powered by FluxBB