Triple 4K monitor display failed (modesetting driver limited to 8192x8192)

Bug #1714178 reported by ethan.hsieh on 2017-08-31
44
This bug affects 4 people
Affects Status Importance Assigned to Milestone
X.Org X server
Confirmed
Medium
linux (Ubuntu)
Undecided
Unassigned
Bionic
Undecided
Unassigned
mesa (Ubuntu)
Medium
Timo Aaltonen
Bionic
Undecided
Timo Aaltonen
xorg-server (Ubuntu)
Medium
Unassigned
Bionic
Undecided
Timo Aaltonen

Bug Description

Title: Triple monitor display failed with Dell Dock (HiDPI) (modesetting)

Summary: Triple monitor display failed with Dell Dock (HiDPI) (modesetting)

Steps:
1. a laptop with Built-in 4K LCD
2. Cold boot system with Dell Dock connected
3. Connect a 4K monitor to Dock
4. Connect 2nd 4K monitor to Dock
5. Go to [All Settings]=>[Displays] to have the following configuration.
Resolution: 4kx2k@60Hz (one Built-in LCD + two external monitors)
Mirror displays: disable

Expected results: Triple monitor display should works without issues
Actual results: Triple monitor display failed with Dell Dock

Additional information:
1. Linux distribution: Ubuntu 16.04+modesetting, 16.04.3, and 17.04
2. Laptop: Dell Precision 5520
3. Dell Business Thunderbolt Dock - TB16
https://goo.gl/vFDjpi

WORKAROUND (UBUNTU 18.04+):
Log in to "Ubuntu on Wayland" instead of "Ubuntu".

---
.tmp.unity_support_test.0:

ApportVersion: 2.20.1-0ubuntu2.10
Architecture: amd64
CompizPlugins: No value set for `/apps/compiz-1/general/screen0/options/active_plugins'
CompositorRunning: compiz
CompositorUnredirectDriverBlacklist: '(nouveau|Intel).*Mesa 8.0'
CompositorUnredirectFSW: true
CurrentDesktop: Unity
DistUpgraded: Fresh install
DistributionChannelDescriptor:
 # This is a distribution channel descriptor
 # For more information see http://wiki.ubuntu.com/DistributionChannelDescriptor
 canonical-oem-somerville-xenial-amd64-20160624-2
DistroCodename: xenial
DistroRelease: Ubuntu 16.04
DistroVariant: ubuntu
ExtraDebuggingInterest: Yes
GraphicsCard:
 Intel Corporation Device [8086:591d] (rev 04) (prog-if 00 [VGA controller])
   Subsystem: Dell Device [1028:07bf]
   Subsystem: Dell Device [1028:07bf]
InstallationDate: Installed on 2017-08-29 (2 days ago)
InstallationMedia: Ubuntu 16.04 "Xenial" - Build amd64 LIVE Binary 20160624-10:47
MachineType: Dell Inc. Precision 5520
Package: xorg-server (not installed)
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.11.0-14-generic.efi.signed root=UUID=b79ae801-0652-4785-beaf-e8387d798948 ro acpi_rev_override quiet splash vt.handoff=7
ProcVersionSignature: Ubuntu 4.11.0-14.20~16.04.1-generic 4.11.12
Tags: xenial ubuntu compiz-0.9
Uname: Linux 4.11.0-14-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
_MarkForUpload: True
dmi.bios.date: 05/08/2017
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 1.3.3
dmi.board.vendor: Dell Inc.
dmi.chassis.type: 10
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvr1.3.3:bd05/08/2017:svnDellInc.:pnPrecision5520:pvr:rvnDellInc.:rn:rvr:cvnDellInc.:ct10:cvr:
dmi.product.name: Precision 5520
dmi.sys.vendor: Dell Inc.
version.compiz: compiz 1:0.9.12.2+16.04.20160823-0ubuntu1
version.ia32-libs: ia32-libs N/A
version.libdrm2: libdrm2 2.4.76-1~ubuntu16.04.1
version.libgl1-mesa-dri: libgl1-mesa-dri 17.0.7-0ubuntu0.16.04.1
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 17.0.7-0ubuntu0.16.04.1
version.xserver-xorg-core: xserver-xorg-core 2:1.18.4-0ubuntu0.3
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.10.1-1ubuntu2
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:7.7.0-1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.99.917+git20160325-1ubuntu1.2
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.12-1build2

affects: launchpad → xorg-server
Timo Aaltonen (tjaalton) on 2017-08-31
affects: xorg-server → xorg-server (Ubuntu)

apport information

tags: added: apport-collected compiz-0.9 ubuntu xenial
description: updated

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

Timo Aaltonen (tjaalton) wrote :

now install xserver-xorg-hwe-16.04 and attach Xorg.0.log

does the issue go away by forcing -intel with -hwe-16.04?

Timo Aaltonen (tjaalton) wrote :

forget about #25, as you pointed out the bug is in hw/xfree86/drivers/modesetting/drmmode_display.c:

xf86CrtcSetSizeRange(pScrn, 320, 200, mode_res->max_width, mode_res->max_height);

so using INT16_MAX there for width & height should make it work.

ethan.hsieh (ethan.hsieh) wrote :

After applying the following patch, there is no pop-up window (#24).
But, all three screens turn into black screens after I click "apply" button.

hw/xfree86/drivers/modesetting/drmmode_display.c:
-xf86CrtcSetSizeRange(pScrn, 320, 200, mode_res->max_width, mode_res->max_height);
+xf86CrtcSetSizeRange(pScrn, 320, 200, INT16_MAX, INT16_MAX);

xorg-server: 1.19.3-1ubuntu1.1
ubuntu: 17.04

Created attachment 133916
Screenshot

Filed a new bug for modesetting driver.

---
Can't configure a desktop with 3x4k monitors in one row
https://bugs.freedesktop.org/show_bug.cgi?id=98297#c22

the mesa part is now fixed, but the modesetting driver in xserver needs to be fixed too:

hw/xfree86/drivers/modesetting/drmmode_display.c:
xf86CrtcSetSizeRange(pScrn, 320, 200, mode_res->max_width,
vs.
src/sna/sna_display.c:
xf86CrtcSetSizeRange(sna->scrn, 8, 8, INT16_MAX, INT16_MAX);

currently with xserver 1.19.3 it's not possible to configure 3x4k row of monitors unless the -intel ddx is used.

Created attachment 133917
kern.log (drm.debug=0xe)

Created attachment 133918
Xorg.0.log

ethan.hsieh (ethan.hsieh) wrote :

Filed one freedesktop bug for this issue.
https://bugs.freedesktop.org/show_bug.cgi?id=102508

Created attachment 133919
lsb_release

Created attachment 133920
Xorg.0.log

After applying the following patch, all three screens turn into black screens after I change the display mode from mirror mode to extended mode.
(Please refer to the attached Xorg.0.log)

hw/xfree86/drivers/modesetting/drmmode_display.c:
-xf86CrtcSetSizeRange(pScrn, 320, 200, mode_res->max_width, mode_res->max_height);
+xf86CrtcSetSizeRange(pScrn, 320, 200, INT16_MAX, INT16_MAX);

Created attachment 133921
kern.log

Created attachment 133922
Xorg.0.log

After applying the following patch, all three screens turn into black screens after I change the display mode from mirror mode to extended mode.
(Log: attached Xorg.0.log and kernel log (attachment 133921))

ubuntu-zesty/drivers/gpu/drm/i915/intel_display.c
@@ -16458,9 +16458,12 @@ int intel_modeset_init(struct drm_device *dev)
                dev->mode_config.max_width = 4096;
                dev->mode_config.max_height = 4096;
        } else {
- dev->mode_config.max_width = 8192;
- dev->mode_config.max_height = 8192;
+ dev->mode_config.max_width = 16384;
+ dev->mode_config.max_height = 16384;
        }

Changed in xorg-server:
importance: Unknown → Medium
status: Unknown → Confirmed

I don't know why the 8192 limit never has been raised. Maybe the hardware never adopted for higher resolutions. Anyway:

As soon as you try to configure your 11520x2160 desktop, you can find in the log:
    [ 84.385] failed to add fb -22
-22 is invalid argument and that error comes from the kernel. You could boot your kernel with drm.debug=0x5e and may get more hints why it fails.

Created attachment 135996
extend max buffer size for test.

just followed the error from drm.debug=0x5e and tried to force extend max buffer size returned by intel_fb_pitch_limit(), then 3 X 4K monitor works well then.

there are 2 commit b321803dfb and ac484963f9 touched this part, but not sure why it specify (8192 * cpp)? have some better way to extend the size ?

environment setting:
kernel 4.15.0-rc2 [1]
drm, mesa and xorg version: http://paste.ubuntu.com/26124071/

[1] http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15-rc2/

I would contact the authors of the commits.

refer to this patch:
https://patchwork.freedesktop.org/patch/124918/

It looks 8192 means 4K X 2, and 16384 means 4K X 4,
So, followed the rule, I submitted a patch to support max 16K.

https://patchwork.kernel.org/patch/10097883/

Alex Tu (alextu) wrote :

verified kernel 4.15-rc2 with this patch, 3 X 4K works well.
https://patchwork.kernel.org/patch/10097883/

my patch is not acceptable,
Refer to the last comment from Ville Syrjälä
 "
 Even if this would be correct (which it's not for most platforms at
 least, not quite sure about the very latest hardware), anyone doing
 this should at least do a cursory check of the relevant math in the
 driver to make seure we don't end up with integer overflows.
 "

This change is for https://bugs.freedesktop.org/show_bug.cgi?id=102508 , and the hardware configuration is

* 00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:591d] (rev 04)
* Dell Thunderbolt BME dock : http://www.dell.com/support/article/us/en/04/sln301105/dell-thunderbolt-dock--tb16--information-and-specifications?lang=en
* internal native monitor is 4K, another 2 4K monitors are plugged behind BME dock

This patch could let this setting work, but looks it not the correct way.
Not see the the relevant math in original code of commit b321803dfb and ac484963f9 .
Does someone know how the original value 8192 be calculated out?
So that the way might could be followed for this new change.

I'm not sure if this is the right place to report it, but:
I have a similar problem, I've tried to apply all the patches mentioned here - for i915 driver in the kernel, for modesetting driver in xorg-server and updated mesa to 17.3.0 which is supposed to be updated, but I'm still seeing some sort of corruption - without the patches, the screens would remain black, but with the patches I see something like this - https://bugs.freedesktop.org/attachment.cgi?id=135329

Maybe I've missed some other necessary patch?

Created attachment 136168
dmesg -w with drm.debug=0x5e before patch

this is the dmesg which opened drm.debug=0x5e, the kernel was built from latest drm_intel commit 0dfa1cee

Created attachment 136169
dmesg -w with drm.debug=0x5e of only applied the change in comment 6

this is the dmesg which opened drm.debug=0x5e, the kernel was built from latest drm_intel commit 0dfa1cee plus the change of comment 6.

and this message was a hint:
[drm:intel_framebuffer_init [i915]] tiled pitch (46080) must be at most 32768

Created attachment 136170
dmesg -w with drm.debug=0x5e after my patch in comment 10

this is the dmesg which opened drm.debug=0x5e, the kernel was built from latest drm_intel commit 0dfa1cee plus my patch in comment 10.

In this case, one internal 4K monitor plus 2 external 4k monitors which be attached after dell docking works well.

btw, all my test are in X modesetting.

Created attachment 136189
dmesg -w with drm.debug=0xe of wayland in artful after patch

this is the dmesg which opened drm.debug=0xe, the kernel was built from latest drm_intel commit 0dfa1cee plus my patch in comment 10, which is the same kernel what comment 15 used, and also works well.

This test was done on Ubuntu Artful with waylan , I just enabled debug level 0xe because 0x5e seems too heavy message that make all screen stay in dark after I plugged 2nd 4K monitor on dock.

I am working on the this feature request.

First, we need to be able to lift the limit that comment #0 proposed. To do so, we need to make sure we never exceed the maximum stride supported by the display controllers used by all the active CRTCs. If we exceed one of them, we need to enable per-CRTC framebuffers. This is a good base for tear-free anyway, and will enable this feature for all vendors.

I got a naive version of the proper patch to work as expected. I will keep on working on it to improve the performance and make it work with rotated displays and all the other options. I will then work on making the enabling of this feature dynamic, so as not to negatively affect the performance in the general case.

Once this is done, I will work with a kernel engineer to work-around the maximum-stride limit by internally creating another buffer that would be a read-only view of the big buffer, but limited to the size of the crtc. This would be done through GTT pages reshuffling (like what is done for rotation). If all goes well, the performance loss should be ~0 for the tearing implementation.

The tear-free implementation will however still require blitting, but this is not blocking this bug so we'll not talk about it here.

I'll keep you up to date.

Here is the first version of the patchset: https://cgit.freedesktop.org/~mperes/xserver/log/?h=3x4k

This has 0 performance cost unless we need to enable the feature because we exceed the driver's limits (what happens on Intel HW for 3x4k). In this case, we start using a buffer per-crtc and blit to it whenever there are damages on the screen.

This is pretty much the optimal behaviour performance-wise in a composited environment (unless the kernel lifts the limits I was talking about in the last comment). However, in non-composited environments, we can further improve this by blitting the damages no more than once per frame (hoping for some of the damages to overlap). I will get to that next week.

Also happening next week is more testing, and verifying that this also works without glamor and with the other options of modesetting.

Changed in xorg-server (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
summary: - Triple monitor display failed with Dell Dock (HiDPI) (modesetting)
+ Triple 4K monitor display failed (modesetting driver)
tags: added: multimonitor
description: updated
Timo Aaltonen (tjaalton) on 2018-06-25
Changed in linux (Ubuntu):
status: New → Triaged
Changed in mesa (Ubuntu):
status: New → Triaged
Timo Aaltonen (tjaalton) on 2018-08-08
Changed in mesa (Ubuntu):
assignee: nobody → Timo Aaltonen (tjaalton)
importance: Undecided → Medium
Changed in xorg-server (Ubuntu Bionic):
assignee: nobody → Timo Aaltonen (tjaalton)

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in linux (Ubuntu Bionic):
status: New → Confirmed
Changed in mesa (Ubuntu Bionic):
status: New → Confirmed
Changed in xorg-server (Ubuntu Bionic):
status: New → Confirmed

*** Bug 107840 has been marked as a duplicate of this bug. ***

summary: - Triple 4K monitor display failed (modesetting driver)
+ Triple 4K monitor display failed (modesetting driver limited to
+ 8192x8192)
Dan Kegel (dank) wrote :

This just changed for me... but the hardware may matter, as I'm on Hades Canyon, using the amd gpu, not HD graphics.
A few days ago I updated to the then-latest 4.19-rc2
(and wrote https://ubuntuforums.org/showthread.php?t=2400400 documenting
exactly what I did).
Using plain old X (no desktop) on my Hades Canyon, I now see a 16384 x 16384 limit:
$ xrandr
Screen 0: minimum 320 x 200, current 11520 x 2160, maximum 16384 x 16384
Three screens horizontally work.
https://<email address hidden>/msg24954.html looks related.

I have not yet tested on HD graphics with the new kernel.

Dan Kegel (dank) wrote :

I should have mentioned, my Hades has 32GB of RAM.
With 8GB or less of RAM, the problem might persist (if I understand the mailing list posts).

I posted a patch series for -modesetting that fixes this issue, and also adds TearFree support: https://gitlab.freedesktop.org/xorg/xserver/merge_requests/24

The patch series from Ville (https://patchwork.freedesktop.org/series/49663/) will however be what you are looking for, as it will not reduce the performance at all.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mesa - 18.2.1-1ubuntu1

---------------
mesa (18.2.1-1ubuntu1) cosmic; urgency=medium

  * Merge from Debian experimental. (LP: #1714178, #1792873)
  * glvnd-fix-a-segfault-in-eglgetprocaddess.diff: Dropped, upstream.

mesa (18.2.1-1) experimental; urgency=medium

  * New upstream release.
  * control: Add libd3dadapter9-mesa to -dev depends.
  * control: Fix libd3dadapter9-mesa-dev section, and drop
    shlibs:Depends.

mesa (18.2.0-3) experimental; urgency=medium

  * control, rules: Nine needs llvmpipe, and also makes sense to build it
    only on archs that have wine.

mesa (18.2.0-2) experimental; urgency=medium

  * control: Bump build-dep on libxcb-dri3-dev and libxcb-present-dev to
    1.13. (Closes: #908827)
  * control: Build-depend on x11proto-dev, modify libegl1-mesa-dev and
    libgl1-mesa-dev depends.
  * Migrate to llvm/clang-7.
  * Enable gallium D3D state tracker, thanks Antonio Russo and Andrew
    Cook! (Closes: #863972)
  * rules: Enable v3d on arm. Thanks, Fabio Pedretti!
  * rules: Drop enabling texture float, it's enabled by default now.

mesa (18.2.0-1) experimental; urgency=medium

  * New upstream release.

mesa (18.2.0~rc4-1) experimental; urgency=medium

  * New upstream release candidate.
  * control: Add libxrandr-dev and libwayland-egl-backend-dev to build-
    depends.

mesa (18.1.8-1) unstable; urgency=medium

  * New upstream release.

mesa (18.1.7-1) unstable; urgency=medium

  * New upstream release.
  * libglx-mesa0: Add Breaks: glx-diversions (<< 0.8.4~) (Closes:
    #903929).

mesa (18.1.6-1) unstable; urgency=medium

  * New upstream release.
    - Fixes white screen when running Xfwm4 with compositing
      (Closes: #901789).
  * Drop glvnd-fix-gl-dot-pc.patch, fixed upstream (0c927e8da9e)
    (Closes: #896447).

 -- Timo Aaltonen <email address hidden> Tue, 25 Sep 2018 23:26:15 +0300

Changed in mesa (Ubuntu):
status: Triaged → Fix Released
Iain Lane (laney) on 2018-11-20
Changed in mesa (Ubuntu Bionic):
assignee: nobody → Timo Aaltonen (tjaalton)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.