Force refresh rate through HDMI + remap touchscreen of external monitor?

Hello everyone,

I hope that someone will be able to help me because I am losing my nerves. I am working on F37 Silverblue + Wayland / X11. System has nVidia Optimus, with proprietary nVidia drivers (not Nouveau).

Have recently bought an external touchscreen monitor to aid my setup. The monitor nominally supports up to 1080p resolutions over HDMI or USB-C (but I don’t have a USB-C capable video output, so I have to use HDMI). The touchscreen output is sent over a USB cable, and power is received through the same cable.

Force particular (60Hz) refresh rate over HDMI

The most persistent issue I have noticed with this monitor is that it refuses to set itself at any refresh rate other than 59 or 60 Hz (although it reports that it supports up to 120 Hz – I can choose this in Gnome settings, but to no avail).

That would be fine with me except that when I try to mirror the laptop display (also 1080p), the monitor turns off and says no input device found. Now, this same issue happens when extending if I try to set it to 120 / 100 / 50 / 30 / 29 / etc. hertz.

I believe that the issue is that when I try to mirror the display, Fedora / Gnome / whomever is trying to revert back to 120 Hz for the display (because that’s what it signals it maximally supports, in theory). This makes it reject the input signal and refuse to show anything. Alternatively, Gnome might be attempting to clone the refresh rate of my integrated laptop monitor, which is, weirdly, set at 60.02 Hz, so it is above 60 Hz, so it also gets rejected.

Unfortunately, while mirroring, I can’t set a (60Hz) refresh rate – there’s no such option in Gnome settings. I can only do this if I use the external monitor to extend the display.

Another peculiar thing I noticed is that if I drop down the resolution of the external touchscreen display (say to 1440 x 900), I can now clone the display and use it as a touchscreen – but of course, the image looks horrible.

How can I go about diagnosing this, and particularly, about forcing / limiting HDMI to only output at 60 Hz regardless of what the monitor signals it supports?

======

Persistent remap of touchscreen output

My second issue is with the touchscreen. It always works (sends out touch output even if the monitor itself is not displaying anything), detects multiple fingers and the like. The problem is that it somehow always gets mapped to my laptop screen. So I can touch and drag windows etc. which appear on the main laptop display blindly, but I don’t see them on the external touchscreen monitor. And windows that appear on the external touchscreen display are not affected by touch (i.e. because it is mapped on the main display).

Regardless of where I put the external touchscreen monitor in Gnome settings (left, right, above, below the laptop screen), or whether I select it as the primary or secondary monitor, the touchscreen output is persistently mapped to the laptop monitor. Only if I turn off the laptop monitor the image gets displayed solely on the external touchscreen monitor, only then I can use it as a touch device – but then I have one display unused for anything.

And of course, if I lower the resolution I can clone the display, and then the touch output corresponds to what is displayed on screen – but it looks horrible.

I guess the question is: how can I consistently remap the touchscreen to the appropriate monitor?

I prefer to work on these problems through Wayland, but X11 would be the second-best alternative. Is there a GUI tool to work with these kinds of issues? I’m still a newbie.

UPDATE:

If I login under Xorg I am unable to output ANYTHING to the external touchscreen. Nothing works, nor decreasing resolution, decreasing / setting refresh rates, nothing. Only the touchscreen finger output works, probably because it is a separate device of a sort.

Here’s the output from xrandr:

[username]@fedora37 ~]$ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 382mm x 215mm
   1920x1080     60.02*+  60.01    59.97    59.96    59.93  
   1680x1050     59.95    59.88  
   1400x1050     59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1280x800      59.99    59.97    59.81    59.91  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   640x400       59.88    59.98  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
DP-1-0 disconnected (normal left inverted right x axis y axis)
DP-1-1 disconnected (normal left inverted right x axis y axis)
HDMI-1-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
   1920x1080     60.00 + 120.00*  100.00    60.00    59.94    50.00    29.97    25.00    23.98  
   1440x900      59.89  
   1400x1050     59.98  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   640x480       75.00    72.81    59.94  
  1280x1024 (0x50) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x960 (0x53) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  1024x768 (0x61) 65.000MHz -HSync -VSync
        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 (0x70) 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 (0x71) 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
  640x480 (0x7d) 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

Using an external monitor with nvidia optimus config works best for me by following the procedure here.

Note that this only works when using xorg DE.
I have no issues with my external monitors, though I only have ones that are 60Hz refresh, and only connect one with HDMI.

I have no experience with an external touchscreen as my laptop does not have touchscreen.

I just can’t believe this should be so difficult. Like, where do I search for help? There’s no way to remap touchscreen input on wayland nor mutter. That’s so disappointing. Please help!

Imagine this, but I managed to solve it. This can only be solved through X11, unfortunately.

Solution under X11:

1. Make nVidia your primary graphics card, to avoid switching and blank screen / no input message on your external screen:

First, you need to switch to X11. Log out and in the login screen, after clicking your user name, there should appear a little cog in the lower right corner. Click it and select GNOME on Xorg.

Then you need to edit your nvidia.conf file. Doing this on Silverblue is a bit harder because root is locked. But you can enter editing the root filesystem by going in terminal and typing sudo rpm-ostree admin unlock --hotfix. The --hotfix tag keeps the changes you make to root fs ‘permanent’ i.e. rpm-ostree doesn’t revert back to the old snapshot, and with it to the unmodified version of nvidia.conf.

DO NOT MAKE EDITING YOUR ROOT FS A HABIT. AVOID IT LIKE YOUR LIFE DEPENDS ON IT. THERE IS A GOOD REASON WHY IMMUTABLE DISTROS LOCK IT.

Then copy nvidia.conf from /usr to /etc: sudo cp -p /usr/share/X11/xorg.conf.d/nvidia.conf /etc/X11/xorg.conf.d/nvidia.conf

Climb to the newly copied file and edit it sudo nano nvidia.conf. It should look something like this:

#This file is provided by xorg-x11-drv-nvidia
#Do not edit

Section "OutputClass"
	Identifier "nvidia"
	MatchDriver "nvidia-drm"
	Driver "nvidia"
	Option "AllowEmptyInitialConfiguration"
	Option "SLI" "Auto"
	Option "BaseMosaic" "on"
EndSection

Section "ServerLayout"
	Identifier "layout"
	Option "AllowNVIDIAGPUScreens"
EndSection

Add this to each of the sections: Option "PrimaryGPU" "yes".

So:

#This file is provided by xorg-x11-drv-nvidia
#Do not edit

Section "OutputClass"
	Identifier "nvidia"
	MatchDriver "nvidia-drm"
	Driver "nvidia"
	Option "AllowEmptyInitialConfiguration"
	Option "SLI" "Auto"
	Option "BaseMosaic" "on"
	Option "PrimaryGPU" "yes"
EndSection

Section "ServerLayout"
	Identifier "layout"
	Option "AllowNVIDIAGPUScreens"
	Option "PrimaryGPU" "yes"
EndSection

Save it, exit, and reboot. This will force X11 to use nVidia as the main graphics card. You can check this by typing in terminal: glxinfo | egrep "OpenGL vendor|OpenGL renderer". If it says nVidia under both OpenGL vendor and renderer, you are good to go.

2. Force refresh rate to external monitor:

Now that you’ve forced the nVidia driver, working with the external display should be a lot easier. It might even show and work as intended.

But if it doesn’t there probably is a fix through xrandr. Type (or install first in toolbox / terminal / distrobox / with dnf / with apt / with rpm-ostree / whatever) xrandr and you should get both your primary computer / laptop screen as well as the external one attached to HDMI. In my case it shows as HDMI-0.

To force resolution and refresh rate you can use xrandr like this: xrandr --output HDMI-0 --mode 1920x1080 --rate 60. --mode deals with resolution, --rate deals with refresh rate. Note that your screen might support 59.94 or some other weird refresh rate. The supported ones (in theory) are shown when typing xrandr without any parameters.

If this was successful your external screen should be now showing the desktop and working well. The problem that remains is the touchscreen, because my touchscreen continues to map to my laptop screen instead of itself.

3. Remap touchscreen input to external screen:

To remap the touchscreen we need another X11 utility called xinput. Type xinput in terminal (or install it first) and you should get a list of input devices. Among these there should be your touchscreen device. Something like ELAN touchscreen or Wacom touchscreen or similar. Remember its ID number on the right.

Now, we can use xinput to also remap the input. We do this by typing: xinput map-to-output 10 HDMI-0. 10 is the ID number of my touchscreen, it might differ. HDMI-0 is the name of the external screen provided previously by xrandr.

4. Wayland?

Unfortunately, this is undoable under Wayland on Gnome (Fedora or otherwise). The reason is that Gnome uses mutter (a Wayland compositor), and mutter sucks. It has no tools for remapping, it tries to do everything by itself and fails, it is not user-serviceable almost at all. Choosing mutter when there are better alternatives such as sway, sddm and the rest, is beyond me. Mutter sucks, at least right now.

So, if you want to achieve this under Fedora stick to X11.

Hope this helps anyone else having a similar problem.