Skip to content

Instantly share code, notes, and snippets.

@mzpqnxow
Last active June 21, 2025 14:31
Show Gist options
  • Save mzpqnxow/c903bbf55aea7fe8829dcb40fdb119ba to your computer and use it in GitHub Desktop.
Save mzpqnxow/c903bbf55aea7fe8829dcb40fdb119ba to your computer and use it in GitHub Desktop.
Set single 6k display on Xorg/Debian with xrandr when not advertised via EDID (example: Dell U3224KB)
#!/bin/bash
# Set up modeline and activate it for DELL U3234KB 6k display
# For a single monitor, easy to modify to set more than one, if you can afford two 6k monitors ...
# Tested on cards capable of 6k @ 60hz using Xorg modesetting and intel drivers
# Set up/etc/X11/xorg.conf.d/20-intel.conf like this per Debian documentation:
#
# Section "Device"
# Identifier "Intel Graphics"
# Driver "modesetting"
# EndSection
#
# Optionally, you might use the "intel" driver, or "xe" driver, depending on
# your GPU and your needs
#
#
# Notes
# -----
# - Specifying -r with cvt is critically important in my case
# - Specifying --crtc 1 with xrandr is also critically important
# - Otherwise, nothing special here
# - It's probably not necessary, but you can also add video=DP-1:6144x3456@60 to grub
# - Alone, it won't do anything useful
#
# - mzpqnxow
#
# Output
# ------
# $ ./6k
# Getting info from cvt and xrandr ...
# Current active output: DP-1
# Generated new modeline: "6144x3456R" 1344.25 6144 6192 6224 6304 3456 3459 3464 3555 +hsync -vsync
# New modeline name: "6144x3456R"
#
# --- Create mode ...
# dry-run: xrandr --newmode "6144x3456R" 1344.25 6144 6192 6224 6304 3456 3459 3464 3555 +hsync -vsync
# --- Add mode to output DP-1 ...
# dry-run: xrandr --addmode DP-1 "6144x3456R"
# --- Set mode as active for output DP-1 ...
# dry-run: xrandr --output DP-1 --mode "6144x3456R" --crtc 1
# Success !!
# Resolution set to [email protected] !!
# $
#
set -eu
# Set to 1 to print the commands without running them
DRY_RUN=0
# Monitor parameters for Dell U3224KB 6K display on Intel GPU
hz=60
x=6144
y=3456
crtc=1
if [ $DRY_RUN -ne 0 ]; then
echo "DRY-RUN MODE !!!"
xrandr="echo dry-run: xrandr"
else
xrandr="xrandr"
fi
if [ $(xrandr | grep -c '\sconnected') -ne 1 ]; then
echo "This only works if you have a single display !!"
exit 1
fi
printf "Getting info from cvt and xrandr ...\n"
output=$(xrandr | grep '\sconnected' | cut -d ' ' -f 1)
printf "\tCurrent active output:\t%s\n" $output
modeline="$(cvt -r $x $y $hz | grep -Po '^Modeline\s+\K.*')"
printf "\tGenerated new modeline: %s\n" "$modeline"
modename="$(echo $modeline | grep -Po '\".*?\"')"
printf "\tNew modeline name: %s\n\n" $modename
printf " --- Create mode ...\n"
$xrandr --newmode $modeline
printf " --- Add mode to output %s ...\n" "$output"
$xrandr --addmode $output $modename
printf " --- Set mode as active for output %s ...\n" "$output"
$xrandr --output $output --mode $modename --crtc $crtc
if [ $? -eq 0 ]; then
printf "Success !!\nResolution set to %dx%d@%fhz !!\n" $x $y $hz
else
printf "Failure !!\nUnable to set resolution to %dx%d@%fhz !!\n" $x $y $hz
fi
@mzpqnxow
Copy link
Author

mzpqnxow commented Jun 21, 2025

In theory you can "simply" generate an EDID blob with a 6k resolution in it, put it into your initramfs, and tell the kernel command-line where to access it. A few problems with that...

  1. Few (no?) EDID generation tools support >= 4k resolution, so they produce corrupted output
  2. It's really painful looking up exactly how to do this (where exactly to put the blob under /lib/firmware, what kernel commandline parameter to specify, etc.)

Just use xrandr, if it works, count yourself lucky

I went in circles with this for days because of the need for --crtc 1 in xrandr, something I've never had to use before...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment