Bug 106180 - [bisected] radv vulkan smoke test black screen (Add support for DRI3 v1.2)
Summary: [bisected] radv vulkan smoke test black screen (Add support for DRI3 v1.2)
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/Common (show other bugs)
Version: git
Hardware: Other All
: high normal
Assignee: mesa-dev
QA Contact:
Depends on:
Blocks: 106157
  Show dependency treegraph
Reported: 2018-04-22 18:45 UTC by mercuriete
Modified: 2018-05-08 16:52 UTC (History)
6 users (show)

See Also:
i915 platform:
i915 features:

ugly patch (2.23 KB, patch)
2018-05-01 10:43 UTC, mercuriete
Details | Splinter Review
good patch (619 bytes, patch)
2018-05-01 19:48 UTC, mercuriete
Details | Splinter Review
Xorg log (32.98 KB, text/x-log)
2018-05-05 10:39 UTC, mercuriete

Description mercuriete 2018-04-22 18:45:45 UTC
When doing smoketest with radv driver, the window is black.


git bisect bad
c80c08e226033e9e33abdca43e02e7f8c845ae0a is the first bad commit
commit c80c08e226033e9e33abdca43e02e7f8c845ae0a
Author: Daniel Stone <daniels@collabora.com>
Date:   Thu Jun 8 17:24:30 2017 +0100

    vulkan/wsi/x11: Add support for DRI3 v1.2
    Adds support for multiple planes and buffer modifiers.
    v4: Rename "has_dri3_v1_1" to "has_dri3_modifiers"
    v12: Multi-planar/modifier support is now DRI3 v1.2; also update release

:100644 100644 40e7855994a6e76d744f192694d5060d39327d56 f84903dffebf39694f458d267793e39a03a0cf8d M      configure.ac
:100644 100644 7658f6e63dae57920fd74a9e445efb07018fd227 34090de45257ea468474af8697760900feb1f341 M      meson.build
:040000 040000 14486094f3e8b9102b67a608d31ea5bf43ee5627 4a42c1f98bcdb9b0c95020cc759565f412d77bf7 M      src

distro: gentoo
PRIME configuration with intel haswell and amd radeon m265x

uname -a
Linux localhost.localdomain 4.14.35-gentoo #1 SMP PREEMPT Sun Apr 22 12:00:39 CEST 2018 x86_64 Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz GenuineIntel GNU/Linux

important lines of lspci:
00:02.0 VGA compatible controller [0300]: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller [8086:0416] (rev 06)
01:00.0 Display controller [0380]: Advanced Micro Devices, Inc. [AMD/ATI] Venus PRO [Radeon HD 8850M / R9 M265X] [1002:6823]

dependencies installed:
   `--  dev-libs/expat-2.2.5
   `--  sys-libs/zlib-1.2.11-r1
   `--  x11-libs/libX11-1.6.5
   `--  x11-libs/libxshmfence-1.2
   `--  x11-libs/libXdamage-1.1.4-r1
   `--  x11-libs/libXext-1.3.3
   `--  x11-libs/libXxf86vm-1.1.4
   `--  x11-libs/libxcb-1.13
   `--  x11-libs/libXfixes-5.0.3
   `--  sys-libs/libunwind-1.2.1
   `--  virtual/libelf-3
   `--  dev-libs/libclc-0.2.0_pre20170929
   `--  media-libs/libomxil-bellagio-0.9.3
   `--  x11-misc/xdg-utils-1.1.1-r1
   `--  x11-libs/libva-1.7.3
   `--  x11-libs/libvdpau-1.1.1
   `--  dev-libs/wayland-1.13.0
   `--  dev-libs/wayland-protocols-1.11
   `--  x11-libs/libXvMC-1.0.10
   `--  x11-libs/libdrm-2.4.91
   `--  sys-devel/llvm-6.0.0
   `--  dev-lang/python-2.7.14-r1
   `--  sys-devel/gcc-6.4.0-r1
   `--  sys-devel/gettext-
   `--  virtual/pkgconfig-0-r1
   `--  dev-util/valgrind-3.13.0
   `--  x11-proto/dri2proto-2.8-r2
   `--  x11-proto/dri3proto-1.0-r1
   `--  x11-proto/presentproto-1.1-r1
   `--  x11-proto/glproto-1.4.17-r2
   `--  x11-proto/xextproto-7.3.0-r1
   `--  x11-proto/xf86driproto-2.1.1-r2
   `--  x11-proto/xf86vidmodeproto-2.3.1-r2
   `--  dev-python/mako-1.0.6
   `--  app-portage/elt-patches-20170815
   `--  sys-devel/automake-1.15.1-r2
   `--  sys-devel/autoconf-2.69-r4
   `--  sys-devel/libtool-2.4.6-r3
Comment 1 mercuriete 2018-04-22 19:05:59 UTC
not sure if i forget to put this:


I think I am using xorg modesetting.
Comment 2 mercuriete 2018-04-23 18:51:46 UTC
I'll rise the severity because this issue block me from update from mesa 18.0.1 to mesa 18.1.0-rc1

dota2 is affected as well.

Probably is a Southern Islands with PRIME problem only.
Comment 3 mercuriete 2018-04-28 09:05:59 UTC
Still happen in mesa 18.1.0-rc2

Sorry I need help to add useful logs.

I tried to revert that patch but there are conflicts when reverting.

Thanks in advance.
Comment 4 Darek 2018-04-28 22:32:52 UTC
Please try this https://patchwork.freedesktop.org/patch/219239/
mesa 18.1.0-rc2 + dri3-Only-update-number-of-back-buffers-in-loader_dri3_get_buffers.patch

It seems to me that there is some problem with dri3 in mesa 18.0.1/18.1.0rc2
Comment 5 mercuriete 2018-04-29 13:44:26 UTC
I tried that patch on top of mesa-18.1.0_rc2

it fixes some issues with resizing windows and with alt+tab in csgo+opengl

But it does not fix this problem.

* vulkan smoketest on intel haswell is OK (now doesnt crash when resizing window)

* vulkan smoketest on radv is a BLACK window and crashes when maximize window.
    terminate called after throwing an instance of 'std::runtime_error'
    what():  VkResult -1000001004 returned

* dota2 on radv only shows the cursor and cpu usage is 100% on cpu0 but no crash.
* dota2 on anv haswell same behaviour (show cursor and 100% usage on cpu0)

Perf information with radv+PRIME with dota2

# To display the perf.data header info, please use --header/--header-only options.
# Total Lost Samples: 0
# Samples: 29K of event 'cycles:uppp'
# Event count (approx.): 5618911073
# Overhead  Command          Shared Object                 Symbol                                 
# ........  ...............  ............................  .......................................
    93.64%  VKRenderThread   [kernel.vmlinux]              [.] syscall_return_via_sysret
     2.00%  VKRenderThread   libtier0.so                   [.] CThreadFastMutex::Lock
     1.03%  VKRenderThread   libpthread-2.25.so            [.] pthread_yield
     0.58%  VKRenderThread   libc-2.25.so                  [.] __sched_yield
     0.47%  VKRenderThread   libtier0.so                   [.] ThreadSleep@plt
     0.26%  VKRenderThread   [kernel.vmlinux]              [.] native_irq_return_iret
     0.25%  VKRenderThread   [unknown]                     [k] 0x00007f2d7dd06495
     0.24%  VKRenderThread   libtier0.so                   [.] pthread_yield@plt
     0.23%  SDLAudioP2       libm-2.25.so                  [.] __powf_finite
     0.17%  SDLAudioP2       [kernel.vmlinux]              [.] syscall_return_via_sysret
     0.15%  AsyncScheduledF  [kernel.vmlinux]              [.] syscall_return_via_sysret
     0.10%  VKRenderThread   libpthread-2.25.so            [.] sched_yield@plt
     0.09%  dota2            [kernel.vmlinux]              [.] syscall_return_via_sysret
     0.08%  AsyncScheduledF  libm-2.25.so                  [.] __powf_finite
     0.05%  VKRenderThread   libtier0.so                   [.] ThreadSleep
     0.04%  SDLAudioP2       libm-2.25.so                  [.] powf
     0.02%  SDLAudioP2       libm-2.25.so                  [.] log10f
     0.02%  AsyncScheduledF  libm-2.25.so                  [.] powf
     0.01%  SDLAudioP2       [kernel.vmlinux]              [.] native_irq_return_iret
     0.01%  AsyncScheduledF  libtier0.so                   [.] Plat_FloatTime
     0.01%  SDLAudioP2       libsoundsystem.so             [.] 0x0000000000169aa4
     0.01%  AsyncScheduledF  libpthread-2.25.so            [.] pthread_cond_timedwait@@GLIBC_2.3.2
     0.01%  SDLAudioP2       libm-2.25.so                  [.] 0x0000000000006d91
     0.01%  AsyncScheduledF  libm-2.25.so                  [.] log10f
     0.01%  SDLAudioP2       libm-2.25.so                  [.] 0x00000000000081f9
     0.01%  SDLAudioP2       libc-2.25.so                  [.] 0x000000000013e29f
     0.01%  SDLAudioP2       libc-2.25.so                  [.] 0x000000000013e3c0
Comment 6 mercuriete 2018-05-01 10:42:40 UTC
This bug has something to do with DRI MODIFIERS

My ugly patch fix my problem.

My guess is... with PRIME there are something wrong with the swapchain
Comment 7 mercuriete 2018-05-01 10:43:17 UTC
Created attachment 139243 [details] [review]
ugly patch
Comment 8 mercuriete 2018-05-01 10:58:09 UTC
I dont know anything about mesa but my guess without any knowledge is that maybe...

the swap chain with PRIME is always SUBOPTIMAL forcing to recreate the swap chain.
because is linear.

not sure anyway... but at least I could narrow down the problem to few lines.

Thanks for your work.
Comment 9 mercuriete 2018-05-01 11:04:03 UTC
vulkan gpuinfo
intel haswell

amd cape verde:

Maybe you can check if is problem with OPTIMAL formats.

Comment 10 mercuriete 2018-05-01 19:48:18 UTC
Created attachment 139255 [details] [review]
good patch
Comment 11 mercuriete 2018-05-01 19:50:58 UTC
The previous patch fix this issue

I've never contributed before to mesa,
I want to send this patch to the mail list but i dont know how:

if you want to commit that patch i would like to be:

Abel Garcia Dorta <mercuriete@yahoo.es>
Comment 12 mercuriete 2018-05-01 20:10:56 UTC
I've tested my patch and now I can play again dota2 and i can do vulkan smoketest.
Comment 13 Bas Nieuwenhuizen 2018-05-04 20:15:29 UTC
To confirm, you are running radv while using intel for the X server?
Comment 14 mercuriete 2018-05-05 10:38:29 UTC
I think i am.

I am using a laptop with prime configuration.

So I think when using plasma kde (kwin_x11 compositor) i am using X11 over intel.

What I not sure is what DDX drivers i am using. I think i am using modesetting for both graphic cards but I not sure.

I will attach the Xorg.log

and xrandr --list providers

xrandr --listproviders 
Providers: number : 2
Provider 0: id: 0x7a cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 0 name:modesetting
Provider 1: id: 0x45 cap: 0x5, Source Output, Source Offload crtcs: 6 outputs: 0 associated providers: 0 name:modesetting
Comment 15 mercuriete 2018-05-05 10:39:46 UTC
Created attachment 139368 [details]
Xorg log
Comment 16 Eero Tamminen 2018-05-07 12:01:40 UTC
Jason's patch: https://patchwork.freedesktop.org/patch/220799/
Comment 17 mercuriete 2018-05-07 18:57:28 UTC
The patch implemented by Bas


has been

Tested-by: Abel Garcia Dorta <mercuriete@gmail.com>

on top of master
and on top of mesa-18.1.0_rc2 provided by gentoo.

Thank you for fixing it!
Comment 18 Jason Ekstrand 2018-05-08 16:52:18 UTC
This should be fixed by the following commit on master:

commit b17cfb08a3fc9a599eff64fffe48daba398a672f
Author: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Date:   Sat May 5 15:34:44 2018 +0200

    vulkan/wsi: Only use LINEAR modifier for prime if supported.
    This was setting the LINEAR modifier if neither the
    X server nor the driver supported modifiers.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106180
    Fixes: c80c08e226 "vulkan/wsi/x11: Add support for DRI3 v1.2"
    CC: 18.1 <mesa-stable@lists.freedesktop.org>
    Tested-by: Abel Garcia Dorta <mercuriete@gmail.com>
    Acked-by: Daniel Stone <daniels@collabora.com>
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.