1

I found no option to switch to 1920x1080, even though Windows supports it. Xrandr can add a 1920x resolution options at 60Hz to the resolution selector, but when I click apply the GPU or internal monitor rejects it and the resolution just gets forced back to 1024x768@60Hz.

$ xrandr --verbose
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 16384 x 16384
VGA-1 connected primary 1024x768+0+0 (0x42) normal (normal left inverted right x axis y axis) 0mm x 0mm
    Identifier: 0x40
    Timestamp:  66227
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:    
    CRTC:       0
    CRTCs:      0 1
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    link-status: Good 
        supported: Good, Bad
    CTM: 2591090 1 7737 0 2017 -2147483648 41175 -2147483648 -1154733 0 44695 -2147483648 45328 0 21316 -2147483648 
        3727858 1 
    CONNECTOR_ID: 61 
        supported: 61
    non-desktop: 0 
        range: (0, 1)
  1024x768 (0x42) 65.000MHz -HSync -VSync *current
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x43) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x44) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  848x480 (0x45) 33.750MHz +HSync +VSync
        h: width   848 start  864 end  976 total 1088 skew    0 clock  31.02KHz
        v: height  480 start  486 end  494 total  517           clock  60.00Hz
  640x480 (0x46) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
$ lspci -k | grep -EA3 'VGA|3D|Display'
00:02.0 VGA compatible controller: Intel Corporation 4th Generation Core Processor Family Integrated Graphics Controller (rev 06)
    Subsystem: Gigabyte Technology Co., Ltd 4th Generation Core Processor Family Integrated Graphics Controller
    Kernel driver in use: i915
    Kernel modules: i915
  • Intel® Core™ i3-4130 CPU @ 3.40GHz × 4
  • Mesa Intel® HD Graphics 4400 (HSW GT2)
  • Memory: 4 GB
Daniel T
  • 4,594
  • @DanielT No it did not work, I did everything according to the answer, but nothing changes. The screen flashes for a moment, but it reverts back to 1024x768 – Arafat Rahman Feb 19 '24 at 06:28
  • Are you on X11 or Wayland? – Daniel T Feb 19 '24 at 06:37
  • I am on Wayland – Arafat Rahman Feb 19 '24 at 07:07
  • 1
    Please scroll down to the answer https://askubuntu.com/a/973582/1004020 . The steps for Wayland involve rebooting after changing the kernel parameters so the "screen flashes for a moment" looks like the X11 command – Daniel T Feb 19 '24 at 07:09
  • Yes, It flashes when booting up. I also tried going through all the steps again, but it did not help. By the way sorry for late reply, I was away from keyboard – Arafat Rahman Feb 19 '24 at 13:56
  • Update: So I switched to "Ubuntu on Xorg" and tried switching resolution through xrandr. Every 16:9 resolution except 1920x1080 works. 1920x1080 gives xrandr: Configure crtc 0 failed Any idea how I can fix that? @DanielT – Arafat Rahman Feb 20 '24 at 08:49
  • What is the frequency? Your GPU might not be powerful enough. Try 30Hz instead of 60Hz – Daniel T Feb 20 '24 at 15:43

2 Answers2

2

So, after 3 days of headbanging and researches in between, I have finally fixed it. For anyone looking to reproduce it:

  1. Switch to "Ubuntu on Xorg" on login screen
  2. Run this script like the following example ./xrandr.sh 1920 1080 50
#!/bin/bash
# Copyright © 2021 Chirag Bhatia
# SPDX-License-Identifier: MIT
# https://gist.github.com/chirag64/7853413

#If no argument is specified, ask for it and exit if [[ -z "$@" ]]; then echo "An argument is needed to run this script"; exit else arg="$@" #Basic check to make sure argument number is valid. If not, display error and exit if [[ $(($(echo $arg | grep -o "\s" | wc --chars) / 2 )) -ne 2 ]]; then echo "Invalid Parameters. You need to specify parameters in the format "width height refreshRate"" echo "For example setResolution "1920 1080 60"" exit fi

#Save stuff in variables and then use xrandr with those variables
modename=$(echo $arg | sed 's/\s/_/g')
display=$(xrandr | grep -Po '.+(?=\sconnected)')
if [[ "$(xrandr|grep $modename)" = "" ]];
then
    xrandr --newmode $modename $(gtf $(echo $arg) | grep -oP '(?<="\s\s).+') &&
    xrandr --addmode $display $modename     
fi
xrandr --output $display --mode $modename

#If no error occurred, display success message
if [[ $? -eq 0 ]];
then
    echo "Display changed successfully to $arg"
fi

fi

<<COMMENT #Manual steps with explanation ahead by @debloper

First we need to get the modeline string for xrandr

Luckily, the tool "gtf" will help you calculate it.

All you have to do is to pass the resolution & the-

refresh-rate as the command parameters:

gtf 1920 1080 60

In this case, the horizontal resolution is 1920px the

vertical resolution is 1080px & refresh-rate is 60Hz.

IMPORTANT: BE SURE THE MONITOR SUPPORTS THE RESOLUTION

Typically, it outputs a line starting with "Modeline"

e.g. "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync

Copy this entire string (except for the starting "Modeline")

Now, use "xrandr" to make the system recognize a new

display mode. Pass the copied string as the parameter

to the --newmode option:

xrandr --newmode "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync

Well, the string within the quotes is the nick/alias

of the display mode - you can as well pass something

as "MyAwesomeHDResolution". But, careful! :-|

Then all you have to do is to add the new mode to the

display you want to apply, like this:

xrandr --addmode VGA1 "1920x1080_60.00"

VGA1 is the display name, it might differ for you.

Run "xrandr" without any parameters to be sure.

The last parameter is the mode-alias/name which

you've set in the previous command (--newmode)

It should add the new mode to the display & apply it.

Usually unlikely, but if it doesn't apply automatically

then force it with this command:

xrandr --output VGA1 --mode "1920x1080_60.00"

That's it... Enjoy the new awesome high-res display!

COMMENT

And that's it. The only reason why it wasn't working on my monitor is because of something to do with the refresh rate. While it did run at 60Hz in windows, Ubuntu can run it in 50Hz.

This is one of the few ways to get the custom resolution. I thank DanielT for pointing me in the right direction! The posts he referred to gave me a basic idea of where my problem was arising.

Daniel T
  • 4,594
  • @ArafatRahwat Have you tried 59.97 or something? Windows might report those as 60 but some monitors are like that – Daniel T Feb 21 '24 at 19:35
2

I also tried to use 1920x resolution but experimenting with different timings in 1920x1280 mode still gave me errors. I looked closely and changed 1280 to 1080 and it worked. My monitor specs only officially support up to 1920x1080@60Hz. Windows 10 does not report the truth when it shows 1920x1280.

Daniel T
  • 4,594
kmonger
  • 21