6

I have found a lot of very solid articles/answers about this topic:

And of course:

However, I'm still struggling. My laptop is Dell XPS15. Its display is 3840x2160. I have tried different external monitors, but at the moment the one I use is also Dell with resolution 1920x1080.

When I connect external monitor, some of the panels immediately become very small on 3840x2160 screen. When I try to scale up build-in display, chrome scales, my IDE scales, but displays window along with other windows like NVIDIA X Server settings stay very small. I have tried to play with Scale all window contents to match in Display but to no avail. It's either too big on the external screen or to small on the build-in. I have also tried xrandr with scale param but it gives me:

xrandr --output HDMI-1 --scale 2x2
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  26 (RRSetCrtcTransform)
  Value in failed request:  0x40
  Serial number of failed request:  38
  Current serial number in output stream:  39

Ideally, I want several windows of the same application(let's say Chrome or Intellij Idea to be open on different displays and scale independently on them).

EDIT

I am not looking for Scale for menus and title bar, I like the way the bars are. I want windows contents scaled independently. Displays UI forces me to either scale all windows to match Built-id display or the external display. As a result:

  1. Scale all window contents to match Build-In Display:

    Build-In Display - everything looks perfect; External Display - everything is huge.

  2. Scale all window contents to match External Display:

    Build-In Display - very small; External Display - everything looks perfect.

yuranos
  • 720
  • 1
    You missed the AskUbuntu link that had 100 bounty on the answer: http://askubuntu.com/questions/823529/how-do-you-set-scaling-for-a-high-dpi-monitor-and-low-dpi-monitor-independently/823535#823535 – WinEunuuchs2Unix Nov 06 '16 at 17:11
  • 1
    Kindly visit the link in my previous comment, review it and add it to your list of links you've visited. Also write a short summary of how it does or doesn't work. Thank you :) – WinEunuuchs2Unix Nov 06 '16 at 17:29
  • 1
    @WinEunuuchs2Unix, while I see a question in your link very similar, I don't see a helpful answer there. In fact, I don't even find anything to try, it's all totally irrelevant. I'm not looking for changing overall DPI value. I need a solution for 2 monitors with different resolutions. – yuranos Nov 06 '16 at 18:09
  • 1
    you need to scroll down to the accepted answer that won the 100 bounty. If that answer doesn't solve your issues then I'll develop a solution for different DPI's (say 144 and 168) on two separate monitors (say 55" TV and 17" laptop) which you can adapt to your situation. It will be tonight though as I'm preparing to go out shopping soon. – WinEunuuchs2Unix Nov 06 '16 at 18:16
  • 1
    @WinEunuuchs2Unix, I've seen both answers. How is that bounty answer different from what I provided in the first place. I've already spent a lot of time playing with --scale. Or am I missing something? – yuranos Nov 06 '16 at 18:25
  • 1
    I actually don't have the problem that link had and you have. I was hoping the accepted answer there solved all your problem. Since it does not I'll invest some time tonight writing an answer which I hope solves your problem. I wanted to tweak the DPI on my TV differently than my Laptop anyway but, it was a low priority project. Now you've given me reason to bump it up the priority list :). Check back in around 6-9 hours. – WinEunuuchs2Unix Nov 06 '16 at 18:58
  • 1
    @WinEunuuchs2Unix, I would immeasurably appreciate your effort! Check my edit. I provided an example to make it more clear. – yuranos Nov 06 '16 at 19:04
  • 1
    I'm getting bogged down with pixel calculator: http://pxcalc.com/ referenced by this DPI setup article: https://wiki.archlinux.org/index.php/xorg#Display_size_and_DPI and this multi-monitor setup article: https://wiki.archlinux.org/index.php/Multihead I think you might be able to figure this out faster than me. – WinEunuuchs2Unix Nov 07 '16 at 00:59
  • @WinEunuuchs2Unix, thanks for the links, but they are for the most part about coordinates and DPIs. I don't have any problem with either of those. What I need is scaling. Even when DPI is recognised correctly, there can be a problem with windows sizes when monitors with very different resolutions are used simultaneously. – yuranos Nov 11 '16 at 08:34
  • Could you update your question with the output from xrandr --listmonitors please? – WinEunuuchs2Unix Nov 11 '16 at 12:43
  • I have exactly the same laptop (Dell XPS 15 ) and the same usage (IntelliJ, Chrome, ... ) and obviously the same problem.

    I would really an answer to this question, so let me offer a bounty on this.

    The output of xrandr -listmonitors is this

     ❯ xrandr --listmonitors                                                                                                               
    Monitors: 2
     0: +*eDP-1-1 3840/346x2160/194+0+0  eDP-1-1
     1: +HDMI-1-1 1920/527x1080/296+3840+0  HDMI-1-1
    
    – systho Jan 03 '17 at 08:26
  • @systho, Could you add an update to the question , add the output of sudo apt-get install pastebinit; sudo sh -c "lsb_release -sd; dmidecode -s system-product-name; echo ==; lshw -c display; echo ==; xrandr --verbose; echo ==; cat /etx/X11/xorg.conf" | tee ~/Desktop/ubuntu-graphic-info.txt | pastebinit – user.dz Jan 03 '17 at 11:01
  • @systho, try using single command, may be xrandr modify previous monitor setup when it is run on two steps example: xrandr --output VGA-0 --scale 2x2 --mode 1440x900 --fb 2880x2600 --pos 0x800 --output DP-3 --mode 1280x800 --scale 1x1 --pos 0x0 , yours could be: xrandr --output HDMI-1-1 --scale 2x2 --mode 1920x1080 --fb 7680x2160 --pos 3840x0 --output eDP-1-1 --mode 3840x2160 --scale 1x1 --pos 0x0 – user.dz Jan 03 '17 at 11:14
  • 1
    @user.dz Hi sorry for the delay, the bounty has cost me so much rep that I could not comment again...

    Here is the output you asked (it's quite long)

    https://gist.github.com/anonymous/3ca481fb78d3b61502ce7b69e37edaff

    – systho Jan 04 '17 at 08:09
  • @user.dz Any attempt to use scale in xrandr generate the same error, even 1x1

    xrandr --output eDP-1-1 --scale 1x1

    X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 26 (RRSetCrtcTransform) Value in failed request: 0x3f Serial number of failed request: 38 Current serial number in output stream: 39

    – systho Jan 04 '17 at 08:14
  • 1
    @user.dz I'm currently using nvidia drivers 375.26 – systho Jan 04 '17 at 08:16
  • @systho, I will undelete my previous answer and update it even some methods did not work for me or you, it may work for others or may lead us to better solution. – user.dz Jan 04 '17 at 10:03
  • @systho, updated my answer also found a trick to make nvidia-settings works. Please, logout/login before trying each method. drivers/xrandr too buggy, many weird behaviors I can't explain. – user.dz Jan 04 '17 at 14:32
  • i have the same screen in my laptop (dell precision m3800) , if i am using my external 40inch 4k screen i set the laptop to be 1920x1080 and its the same scale as the screen. I've not got it to work with the scale reliably. – Amias Jan 04 '17 at 14:36

2 Answers2

3

I have nvidia driver 340.98 with GT218M [NVS 3100M], Xubuntu 16.04, any results below are from this environment if I don't mention otherwise. Here is my testing environment info, the output of:

sudo apt-get install pastebinit; \
sudo sh -c "lsb_release -sd; \
 dmidecode -s system-product-name; echo ==; \
 lshw -c display; echo ==; \
 xrandr --verbose; echo ==; \
 cat /etx/X11/xorg.conf" \
 | tee ~/Desktop/ubuntu-graphic-info.txt \
 | pastebinit

Weird and complex stack to debug specially using proprietary drivers. Most of the time, I get unexpected behaviors, may be due to lack of knowledge about the current Linux graphics stack setup.

  • I wrote this answer before, that may introduce some debugging tools like xtrace
  • Avoid running multiple/sequential xrandr commands, only after X server reset. Same command may have different result depending on previous commands. I have noticed that with --scale (see test case from my answer, linked above) --transform & --fb. Still don't know an easy way only by logout/login. So always logout/login before making another trial.
  • Screenshots take only pixel size image from FB, so I will add camera photos to show the real results.

Method 1: xrandr --output .. --scale HCoefxVCoef or --scale-from WxH

Note, works fine for me. --scale is a shortcut for --transform, see method3

(VGA-0 below DP-3)

xrandr \
--output DP-3 --mode 1280x800 --scale 1x1 --pos 0x0 --fb 2880x2600 \
--output VGA-0 --mode 1440x900 --scale 2x2 --pos 0x800

or:

xrandr \
--output DP-3 --mode 1280x800 --pos 0x0 --fb 2880x2600 \
--output VGA-0 --mode 1440x900 --scale-from 2880x1800 --pos 0x800

FrameBuffer size calculation:

width = max(1280,1440*2) = 2880
height = 800+900*2 = 2600

Results:

  • nvidia xrandr scale screenshot

    nvidia xrandr scale screenshot

  • nvidia xrandr scale photo

    nvidia xrandr scale photo

Method 2: nvidia-settings View Port In/Out

Note, doesn't work well. nvidia-settings does not change frame-buffer to the required size as in xrandr command. It seems a bug (kind of, nvidia has its own FB), need more research.

Tried to replicate xrandr setup directly using nvidia-settings (I used xrandr from method1, marked down nvidia setting, reset settings, then used nvidia-settings directly):

  1. gksu nvidia-settings → X Server Display Configuration
  2. Select external monitor → advanced...
  3. Make ViewPortIn & Panning double of ViewPortOut (which is the same as original resolution)
  4. Leave internal monitor unchanged then Apply

Example:

Results: Notice the mouse pointer, it can reach all edges of the 2nd monitor even it only draws the top left quarter.

  • nvidia-settings viewportin screenshot

    nvidia-settings viewportin screenshot

  • nvidia-settings viewportin photo

    nvidia-settings viewportin photo

Update: Well, I could finally get a workaround trick. Add 1px to the width or height of panning (Panning)

    Panning:     2881x1800 or 2880x1801

New Results: I can't explain this, just the background is corrupted if i use below, otherwise every thing seems ok.

  • nvidia-settings viewportin with panning trick screenshot

    nvidia-settings viewportin with panning trick screenshot - below lowered the color quality of above picture to make less then 2MB imgur limit nvidia-settings viewportin with panning trick screenshot - right of

  • nvidia -settings viewportin with panning trick photo

    nvidia-settings viewportin with panning trick photo - below nvidia-settings viewportin with panning trick photo - right of

Method 3: xrandr --output .. --transform "H,0,0,0,V,0,0,0,1"

Note, works fine for me, same as method1

(VGA-0 right of DP-3)

xrandr \
--output DP-3  -primary --mode 1280x800 --pos 0x0 --transform "1,0,0,0,1,0,0,0,1" --fb 4160x1800 \
--output VGA-0 --mode 1440x900 --transform "2,0,0,0,2,0,0,0,1" --right-of DP-3

FrameBuffer size calculation:

width = 1280+1440*2 = 4160
height = max(800,900*2) = 1800

Results:

  • nvidia xrandr transform screenshot

    nvidia xrandr transform screenshot

  • nvidia xrandr transform photo

    nvidia xrandr transform photo

user.dz
  • 48,105
  • 1
    Thanks a lot for this detailed answer.

    Here is a gist with the requested info : https://gist.github.com/anonymous/233d23a02035085d29944d1a4ba7ecc1

    None of your method works, but as I said even a simple --scale 1x1 causes an error.

    Therefore I think it might be a problem with the nvidia drivers (I use the 375)

    Therefore I tried with the nouveau driver and everything worked. But slowly.

    I would really like to be able to use the nvidia drivers so I'll try again with the 340 version tomorrow.

    If you have any other idea, please let me know.

    – systho Jan 04 '17 at 16:08
  • @systho, Could you share the complete xtrace xrandr... log and after it run grep -i nvidia /var/log/Xorg.0.log. Which scaling command did you run exactly, so I can verify with yours ? – user.dz Jan 04 '17 at 17:42
  • 1
    Here are the commands and their results : https://gist.github.com/anonymous/d665633ec10e30a7f8adcfa3514f2600 – systho Jan 05 '17 at 07:39
  • @systho, your xorg log does list the nvidia mode change events. Anyway, the interesting thing that I could use 1/2 of screen size for fb, this confirm that we are dealing with at least two frame buffers one controlled xrandr and another one only by nvidia (for real output). So this worked for me, xrandr --fb 640x400 --output DP-3 --primary --mode 1280x800 --scale 0.5x0.5 --output VGA-0 --off. Let's break the issue down with only one monitor, logout/login then see with xtrace xrandr --fb 1920x1080 --output eDP-1-1 --primary --mode 3840x2160 --scale 0.5x0.5 --output HDMI-1-1 --off – user.dz Jan 05 '17 at 09:18
  • @systho, Could you tell me what exact setup you have tried for nvidia-settings and what did you get an error message? any change of monitors mode even trivial? – user.dz Jan 05 '17 at 09:23
  • Sorry I have tried too many things to remember exactly what I have done but in the end I'm convinced there is aproblem with the nvidia driver since even a 1X1 scale causes problems.

    Thank you a lot for your help, you very certainly deserve the bounty.

    – systho Jan 09 '17 at 10:14
  • 1
    @systho, thank you I have made an update for my other linked answer for Nvidia debuging, while I was looking for this issue and some other Nvidia related issues. Also I could find some posts with exact same case error on --scale whatever the ratio including 1x1. If I get my hand on such case, i will try debuging it and report here. Also, if you posted this issue to Nvidia forums, please let me know so I can follow too. – user.dz Jan 09 '17 at 11:59
0

I found a simple solution. I am running Ubuntu 18.04. This is my xrandr output:

light@light:~$ xrandr
Screen 0: minimum 8 x 8, current 5760 x 2160, maximum 32767 x 32767
HDMI-0 connected 1920x1080+3840+92 (normal left inverted right x axis y axis) 476mm x 268mm
   1920x1080     60.00*+  59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94    59.93  
DP-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 382mm x 214mm
   3840x2160     60.02*+  48.02  
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-1-1 disconnected (normal left inverted right x axis y axis)
HDMI-1-1 disconnected (normal left inverted right x axis y axis)
DP-1-2 disconnected (normal left inverted right x axis y axis)
HDMI-1-2 disconnected (normal left inverted right x axis y axis)
light@light:~$

I simply ran the below command and it worked perfectly:

light@light:~$ xrandr --output HDMI-0 --scale 2x2 --mode 1920x1080
light@light:~$

--scale 2x2 implies make everything on external screen twice as small.

--mode is the resolution you want.

That's it

  • That didn't work for me on Ubuntu 18.04 because the mouse boundaries are incorrect - you can't reach some of the screen (also another serious problem that was maybe fixable, but I didn't look further because it was already unusable!). – robocat Dec 05 '18 at 02:51