You are not logged in.

#1 2021-07-05 19:26:25

Squiffy
Member
Registered: 2017-03-10
Posts: 18

xrandr --scale slows down overall performance

My laptop's primary, built-in monitor is 2560x1440. My home external monitor (which I use as a primary when plugged in to the laptop) is 1920x1080. My Office external monitor (which I use as a primary when plugged in to the laptop as well) is 3840x2160.

As recommended on https://wiki.archlinux.org/title/HiDPI, I want to set my desktop scaling to 2x (e.g. set 'Xft.dpi' in ~/.Xresources to '192', double the standard '96'), and then apply a zoom-out factor on xrandr.

Therefore when I'm plugged in to my home external monitor (1920x1080), I apply:

xrandr --output HDMI-1 --scale 2x2

The problem I'm having with this approach is that unless I'm scaling by

--scale 1x1

(i.e. no scaling), then performance on all apps feels noticably slower. I haven't found a good way to benchmark this and get solid results yet.. but for example if I have a 2x2 scale applied and open 10 tabs on chrome, then press ctrl-w quickly 10 times (to close 10 tabs), not all 10 tabs are closed and it feels like my PC can't cope with the task. If I repeat the same test with no scaling applied, when I quickly spam ctrl-w 10 times then all 10 tabs are successfully closed.

This performance issue is not just in chrome. I feel it typing on any app, or terminal, opening new windows etc.

The performance is worse when I set Xft.dpi to 192, or run chrome with --force-device-scale-factor=2.

Is this to be expected? I've had this issue for a while and my preference is to not apply any scaling at all and enjoy snapper performance.

Offline

#2 2021-07-05 20:46:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,523

Re: xrandr --scale slows down overall performance

Depends on your GPU and driver, please post your xorg log and "xrandr -q"

Eg. the nvidia blob will unconditionally enter the battery draining performance mode when you scale an output, but the simple matrix transformation is no serious challenge for the GPU.
If you're running some software driver or have a weak GPU (and/or the overall rootwindow size exceeds its capacity and thus forces a sw fallback) things will slow down because every frame has to be scaled in CPU.
You may want to check whether the issue remains if the outputs are in clone mode (ie. overlap or you otherwise stay below eg. 4096x4096 since you'l exceed 2048x2048 for sure)

Offline

#3 2021-07-06 23:18:05

Squiffy
Member
Registered: 2017-03-10
Posts: 18

Re: xrandr --scale slows down overall performance

Thanks Seth. I don't think I had the right drivers installed to make full use of my nvidia card. I thought I had the nouveau drivers installed but I have since switched to the proprietary nvidia drivers and my "benchmark" test of rapidly opening and closing browsers in chrome with `--scale 2x2` applied seems much better.

I am now facing the nvidia --scale 2x2 issue where if I apply a xrandr scale to 'zoom out', the zoomed out screen doesn't fit to the monitor so I am left with only the top left corner visible.

Looking at the linked issue from the above arch wiki page, there is a potential work around by applying 'ForceFullCompositionPipeline=On' with nvidia-settings.

nvidia-settings returns 'NULL' for me (the bit after '::' in the nvidia-settings -q command below), even after applying 'ForceFullCompositionPipeline=On' as detailed here. I think this is because 'nvidia-settings' can not be applied for an optimus setup, but I haven't been able to confirm this?

I have instead configured '/etc/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf' with the following in attempt to apply the workaround

Section "OutputClass"
    Identifier "intel"
    MatchDriver "i915"
    Driver "modesetting"
EndSection

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
    Option "ForceCompositionPipeline" "yes"
    Option "ForceFullCompositionPipeline" "yes"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

and I see the change picked up in '/var/log/Xorg.0.log', but the --scale option still behaves the same and I am left with only the top left corner of my screen visible.

Am I stuck with having my apps display in different sizes across my monitors for as long as I have an Nvidia Optimus setup? Unfortunately my BIOS does not have a setting to completely disable my Intel iGPU.

$ lspci | grep -E "(VGA|3D)"
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
02:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2)
$ nvidia-settings -q CurrentMetaMode

  Attribute 'CurrentMetaMode' (lewisk:0.0): id=50, switchable=yes, source=xconfig :: NULL
$ xrandr -q
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
eDP-1-1 connected (normal left inverted right x axis y axis)
   2560x1440     60.05 +  59.99    59.99    59.96    59.95  
   1920x1440     60.00  
   1856x1392     60.01  
   1792x1344     60.01  
   2048x1152     59.99    59.98    59.90    59.91  
   1920x1200     59.88    59.95  
   1920x1080     60.01    59.97    59.96    59.93  
   1600x1200     60.00  
   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-1 disconnected (normal left inverted right x axis y axis)
HDMI-1-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm
   1920x1080     60.00*+  50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1440x576      50.00  
   1024x768      75.03    70.07    60.00  
   1440x480      60.00    59.94  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  
DP-1-2 disconnected (normal left inverted right x axis y axis)
HDMI-1-2 disconnected (normal left inverted right x axis y axis)
DP-1-3 disconnected (normal left inverted right x axis y axis)
HDMI-1-3 disconnected (normal left inverted right x axis y axis)

xorg log: https://gist.github.com/SquiffyK7/e5eff … d8acfae40e

Last edited by Squiffy (2021-07-06 23:19:14)

Offline

#4 2021-07-07 05:53:27

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,523

Re: xrandr --scale slows down overall performance

Unlikely
1st because that issue is 6 years old
2nd because you're running into https://bbs.archlinux.org/viewtopic.php … 4#p1978844 (you're running on the 3D controller but all outputs are actually wired to the intel chip. You can only scale them on the intel chip ie. eg. w/ a regular prime configuration where the GPU is invoked by prime-run)

Offline

#5 2021-07-19 21:38:58

Squiffy
Member
Registered: 2017-03-10
Posts: 18

Re: xrandr --scale slows down overall performance

My original issue is that the cpu seems to struggle with scaling though. If I am to use prime-run as a way round this, I'd have to run every application with prime-run and even running chrome with prime-run I get the following:

[130780:130780:0719/221559.626404:ERROR:gles2_cmd_decoder_passthrough.cc(1518)]   GLES2DecoderPassthroughImpl: Context reset detected after MakeCurrent.
[130780:130780:0719/221559.627121:ERROR:gpu_service_impl.cc(1209)] Exiting GPU process because some drivers can't recover from errors. GPU process will restart shortly.
[130813:1:0719/221559.632084:ERROR:command_buffer_proxy_impl.cc(123)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.
[130742:130764:0719/221559.638294:ERROR:gpu_process_host.cc(1002)] GPU process exited unexpectedly: exit_code=8704
[130812:7:0719/221604.677401:ERROR:command_buffer_proxy_impl.cc(123)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.

So it's not possible to scale the outputs on the intel chip and nvidia GPU together? I wonder if its possible to scale outputs, then run

xrandr --setprovideroutputsource modesetting NVIDIA-0

Then when I connect to an external monitor, run the inverse of

xrandr --setprovideroutputsource modesetting NVIDIA-0

, scale outputs from the intel chip and switch to the nvidia card again.

I can't find an opposite to that xrandr command though if one exists.

Whatever the solution is to this seemingly common problem of scaling outputs from a laptop with a dedicated nvidia GPU.. it does not seem straight forward.

Sorry for the slow response time, I really appreciate your help on this so far.

Offline

#6 2021-07-19 22:00:58

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,523

Re: xrandr --scale slows down overall performance

I'd have to run every application with prime-run

Why?

I wonder if its possible to scale outputs, then run

No, because at this point you're already talking to the nvidia GPU and instructing it to scale the output will not work because the output is on the intel chip.

Then when I connect to an external monitor

Except that this might be a moment when you want to alter the scale, external/internal output are not relevant in this context since they all hang on the intel chip.

and switch to the nvidia card again

You'd have to restart the X11 server for this (switching to either GPU) at which point all previous randr changes (incl. scaling) would be lost.

Whatever the solution is to this seemingly common problem of scaling outputs from a laptop with a dedicated nvidia GPU.. it does not seem straight forward.

I'm not sure how common that is, but your problem is that you want to run the X11 server on the nvidia chip but scale the outputs of the intel chip.
Most (well, "many") optimus systems have an nvidia VGA chip that feeds the HDMI output (which can be scaled from the nvidia, but afaik not the intel chip)

If your BIOS/UEFI allows you to deactivate the internal (intel) GPU, that would allow you to run on the nvidia chip and also scale the outputs.

running chrome with prime-run I get

https://bugs.chromium.org/p/chromium/is … 107403#c74 ?

Offline

Board footer

Powered by FluxBB