Unable to add a custom resolution using xrandr

Hello,

The issue I am having is that I am completely unable to add a custom resolution using xrandr. I am using an NVIDIA GPU - GTX 1050ti with proprietary drivers. I am using KDE Plasma as my desktop environment. Running kernel 5.15.2-2

The way I’m trying to add the custom resolution and the errors that it outputs are as follows.

 gtf 1280 720 75                                                                                                                              ✔ 

  # 1280x720 @ 75.00 Hz (GTF) hsync: 56.40 kHz; pclk: 95.65 MHz
  Modeline "1280x720_75.00"  95.65  1280 1352 1488 1696  720 721 724 752  -HSync +Vsync

xrandr --newmode "1280x720_75.00"  95.65  1280 1352 1488 1696  720 721 724 752  -HSync +Vsync

xrandr --addmode DVI-D-0 "1280x720_75.00"                                                                                                    ✔ 
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  18 (RRAddOutputMode)
  Serial number of failed request:  37
  Current serial number in output stream:  38

I have also tried using a different name inside the quotes for the name of the mode but still see the same error. I have also tried the standard 60hz as apposed to 75hz and still the same. Here is the code from this.

gtf 1280 720 60                                                                                                                            1 ✘ 

  # 1280x720 @ 60.00 Hz (GTF) hsync: 44.76 kHz; pclk: 74.48 MHz
  Modeline "1280x720_60.00"  74.48  1280 1336 1472 1664  720 721 724 746  -HSync +Vsync

xrandr --newmode "720" 74.48  1280 1336 1472 1664  720 721 724 746  -HSync +Vsync   

xrandr --addmode DVI-D-0 "720"                                                                                                               ✔ 
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  18 (RRAddOutputMode)
  Serial number of failed request:  37
  Current serial number in output stream:  38

I also received an error message yesterday when trying to add this custom resolution, however I haven’t been able to reproduce it and I’m not sure what I’m doing differently now.

X Error of failed request: BadName (named color or font does not exist)

Any help is appreciated, please just ask if you’d like some more info from me.

Thanks

Add the output of xrandr to your post, please :smiley:
Also check this post out.
Finally try using cvt instead of gtf.

Quick tip

When using xrandr to add custom resolutions it can take a long time and can be frustrating, so I wrote this one-line command that gets the output of gtf/cvt, makes the new mode, adds that mode to your output and then sets that output’s mode to the new one.
Basically this:

> gtf/cvt 1280 720 75
# 1280x720 @ 75.00 Hz (GTF) hsync: 56.40 kHz; pclk: 95.65 MHz
  Modeline "1280x720_75.00"  95.65  1280 1352 1488 1696  720 721 724 752  -HSync +Vsync
> xrandr --newmode "1280x720_75.00"  95.65  1280 1352 1488 1696  720 721 724 752  -HSync +Vsync
> xrandr --output DVI-D-0 --mode "1280x720_75.00"

In one line:

#CVT
deviceName="DVI-D-0" && CVT=$(cvt 1280 720 75 | tail -1 | cut -d ' ' -f2-) && modeName=$(echo $CVT | cut -d ' ' -f1) && xrandr --newmode $CVT && xrandr --addmode $modeName $deviceName && xrandr --output $deviceName --mode $modeName

#GTF
deviceName="DVI-D-0" && GTF=$(gtf 1280 720 75 | tail -1 | cut -d ' ' -f2-) && modeName=$(echo $CVT | cut -d ' ' -f1) && xrandr --newmode $GTF && xrandr --addmode $modeName $deviceName && xrandr --output $deviceName --mode $modeName

Note: I haven’t tested this code properly, but it should work. Just change the values of the variables accordingly.

Unfortunately none of the advice from that post helped :confused:

I tried using cvt instead of gtf for the inputs of the modeline string, but same error. Here is my xrandr output. Thanks

Screen 0: minimum 8 x 8, current 1280 x 1024, maximum 32767 x 32767
DVI-D-0 connected primary 1280x1024+0+0 (normal left inverted right x axis y axis) 380mm x 300mm
   1280x1024     60.02*+  75.02  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32  
   640x480       75.00    72.81    59.94  
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)