Re: xrandr with XPS 13" (3840x2160) HiDPI and 30" (2560x1600) LowDPI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



>> https://phabricator.kde.org/D12405#251159
> 
>> graesslin.Apr 21 2018, 7:01 PM
>> I also cannot imagine this to work due to the fact how X11 works. There is just no mapping from window to screen. No window can know on which screen it is. Not even KWin knows that as the window manager (screen is not a constant property, but evaluated every time it is accessed, it's based on the distance to closest screen). Especially for overlapping windows it's very difficult to try to get to which screen it belongs. It gets even more complicated when things like panning and overlapping screens get into it. So I wouldn't trust this thing in Qt to work due to the pain we have in KWin especially with these problems.

On 01/08/18 12:33, Bruno Pagani wrote:
> OK, then maybe you’ve just stumbled upon one of the numerous HiDPI Qt bugs…

Which brings me back to the original post.

If I could figure out how to do it this way,

https://blog.summercat.com/configuring-mixed-dpi-monitors-with-xrandr.html

because that sounds like it would avoid this problem.

> The tricky parts
> 
> There were two aspects I found problematic:
> 
> First, the fact that the two monitors have differing DPI means each monitor needs different settings to account for that. xrandr allows setting the DPI via --dpi, but this applies globally to all monitors. I dealt with this by setting the global DPI to that of the highest DPI monitor, and then used --scale to adjust the lower DPI monitor.
> 
> Second, switching back and forth between dual monitors to one monitor lead to interesting behaviour. For example, I kept losing the scale setting on the lower DPI monitor.

Previously on the list ProgAndy said:
> The panning option might be there as a workaround for a bug in xorg. 
> Since xorg 1.20 the patch to resolve that should be included, so you can try your configuration without panning.

I feel he might be right based on the results I had with

xrandr --output eDP1 --pos 5120x0 --auto \
       --output DP1 --pos 0x0 --auto --scale 2x2

> I had a semi-working setup with little trouble, but it involved restarting X when I wanted to switch between dual and single monitors. This worked, but obviously was inconvenient. I wanted a solution that would work without restarts.

I do think he might be right. It does seem like it might be also a
workaround for this Qt5 issue.

>From that blog post:

> Single monitor (external)
> 
> If I want to use only the lower DPI monitor, then I run this command:
> 
> xrandr --dpi 276 --fb 3840x2160 \
>     --output eDP-1 --off \
>     --output DP-1-2 --scale 2x2 --panning 3840x2160
> 
> Most of these options are similar to the first command's. The main difference is disabling the laptop monitor with --output eDP-1 --off.
> 
> Note 3840x2160 comes from 1920*2 x 1080*2.
> 
> You might wonder why I set high DPI and scale the lower DPI monitor here. Wouldn't it be simpler to set a lower DPI and use the monitor's native resolution? That's possible, but since I've configured other things (such as my X terminal fonts) to a size suitable for a high DPI screen, I'd have to adjust settings elsewhere. Keeping the DPI the same and continuing to scale allows me to avoid that. Since I'm scaling, I need to configure a large screen and set panning for the same reasons as before.

I was able to get that working using my numbers for the Dell 30" 3008WFP

xrandr --dpi 220 --fb 8960x5360 \
    --output eDP1 --mode 3840x2160 --pos 5120x0 \
    --output DP1 --scale 2x2 --pos 0x0 --panning 5120x3200+3840+0

However with the Dual Monitors not so much;

> Dual monitors
> 
> When I want to use both monitors, this is the command I run:
> 
> xrandr --dpi 276 --fb 7040x3960 \
>     --output eDP-1 --mode 3200x1800 \
>     --output DP-1-2 --scale 2x2 --pos 3200x0 --panning 3840x2160+3200+0
> 
> Here's an explanation of the options:
> 
>     Global options:
>         --dpi 276 sets the DPI to 276.
>         --fb 7040x3960 creates one screen with resolution 7040x3960. This is the combined resolution of the two monitors. The high DPI monitor has 3200x1800 resolution. The lower DPI monitor has 1920x1080 resolution, but I double it as I scale it by 2 (see below). Combine these like so: 3200+1920*2 x 1800+1080*2 = 7040x3960. Both monitors share this screen.
>     High DPI monitor options (--output eDP-1):
>         --mode 3200x1800 says to use resolution 3200x1800. This is the default, but specifying it is necessary if the monitor is disabled (as it is when using the external monitor by itself) as it enables the monitor.
>     Lower DPI monitor options (--output DP-1-2):
>         --scale 2x2 is similar to zooming out. This is necessary as we set the DPI globally to that of the high DPI monitor.
>         --pos positions it to the right of the laptop monitor.
>         --panning allows our pointer to access the whole area.


Using the numbers I calculated:

eDP1 (30"   @ 2560x1600)
DP1  (13.3" @ 3840x2160)

3840+2560*2=8960
2160+1600*2=5360

xrandr --dpi 220 --fb 8960x5360 \
    --output eDP1 --scale 1x1 --mode 3840x2160 --pos 5120x0 \
    --output DP1 --scale 2x2 --pos 0x0 --panning 5120x3200+3200+0

using that I am seeing https://i.imgur.com/gTAsRUe.jpg which is a bit
strange but getting closer.

I think i am messing up the last part of panning the +3200+0 bit.

Eric..

You have a very similar setup, to me. I shall give that a try soon.

-- 
Tyler



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux