Bug 111499 - [bisected][skl] Graphical corruption in kwin effects
Summary: [bisected][skl] Graphical corruption in kwin effects
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/Iris (show other bugs)
Version: git
Hardware: Other All
: not set not set
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-27 08:35 UTC by Mike Lothian
Modified: 2019-09-25 18:47 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
apitrace (2.76 MB, application/x-xz)
2019-09-14 15:22 UTC, Mike Lothian
Details

Description Mike Lothian 2019-08-27 08:35:12 UTC
I've traced it back to:

commit 0f5be81eddfbdcb39a0de10afac2b2ec74790e70
Author: Jordan Justen <jordan.l.justen@intel.com>
Date:   Mon Jun 24 19:24:37 2019 -0700

    iris: Expose aux buffer as 2nd plane w/modifiers
    
    Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

I'm forcing Iris as my main OpenGL driver, i965 isn't compiled and I'm using:

From 49b8c274947d4b625c2a9e0a1fdcb631a73d4903 Mon Sep 17 00:00:00 2001
From: Kenneth Graunke <kenneth@whitecape.org>
Date: Mon, 14 Jan 2019 00:32:33 -0800
Subject: [PATCH] NOT-FOR-UPSTREAM-YET: loader - prefer iris over i965

This lets me avoid having to set MESA_LOADER_DRIVER_OVERRIDE everywhere
Comment 1 Denis 2019-08-27 10:28:04 UTC
hi Mike, would be great to see more details about the issue.
What kind of corruptions do you see? Screenshots, and steps to reproduce would be appreciated with your GPU model, kernel and OS version.
Thanks
Comment 2 Mike Lothian 2019-08-27 10:42:05 UTC
It looks like TV static - I can try and take pictures later

Assuming compositing is enabled on kwin_x11, just hovering over anything that creates a tooltip and moving away so it fades out reproduces this

I'm running mesa from git, the modesetting driver, agd5f's drm-next kernel tree

00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 530 [8086:191b] (rev 06)

Mesa compiled with:

meson --buildtype plain --libdir lib64 --localstatedir /var/lib --prefix /usr --sysconfdir /etc --wrap-mode nodownload -Dplatforms=surfaceless,x11,wayland,drm -Dllvm=true -Dlmsensors=true -Dlibunwind=false -Dgallium-nine=true -Dgallium-va=true -Dva-libs-path=/usr/lib64/va/drivers -Dgallium-vdpau=true -Dgallium-xa=false -Dgallium-xvmc=false -Dgallium-opencl=disabled -Dosmesa=none -Dbuild-tests=false -Dglx=dri -Dshared-glapi=true -Ddri3=true -Degl=true -Dgbm=true -Dgles1=false -Dgles2=true -Dglvnd=false -Dselinux=false -Dvalgrind=false -Ddri-drivers= -Dgallium-drivers=iris,radeonsi,swrast -Dvulkan-drivers=amd,intel -Dvulkan-overlay-layer=true --buildtype plain -Db_ndebug=true /var/tmp/portage/media-libs/mesa-9999/work/mesa-9999 /var/tmp/portage/media-libs/mesa-9999/work/mesa-9999-abi_x86_64.amd64
Comment 3 Denis 2019-08-27 12:28:49 UTC
I tried to reproduce on ubuntu, using current mesa-master. Can't do this yet.
Ubuntu, kernel 5.0.11m SKL also.


Here is my ~/.config/kwinrc 

[Compositing]
AnimationSpeed=3
Backend=OpenGL
Enabled=true
GLCore=true
GLPreferBufferSwap=a
GLTextureFilter=2
HiddenPreviews=5
OpenGLIsUnsafe=false
WindowsBlockCompositing=true
XRenderSmoothScale=false

[Desktops]
Number=1

Provide please your config (if it differs from mine)
Also possibly, would be helpful to make an apitrace (I used to do it for crashes in kwin, so you also could try)
Simply
>apitrace trace kwin_x11 --replace
To stop tracing - ctrl+Z
Comment 4 Jordan Justen 2019-08-30 17:23:33 UTC
Denis,

You might need to force enable dmabuf_capable in X. This isn't
with a build of X from master since it is now enabled by default,
but no released version of X has that change yet.

Mike,

Have you overridden dmabuf_capable, or are you running a master
branch build of X?

-Jordan

$ cat /etc/X11/xorg.conf.d/modeset.conf
Section "ServerFlags"
    Option "Debug" "dmabuf_capable"
EndSection

Section "Device"
    Identifier  "Intel Graphics"
    Driver      "modesetting"
    Option      "AccelMethod"    "glamor"
    Option      "DRI"            "3"
EndSection
Comment 5 Mike Lothian 2019-08-30 17:36:30 UTC
I'm running Xserver from master
Comment 6 Denis 2019-09-02 09:48:11 UTC
Hi Jordan
>You might need to force enable dmabuf_capable in X. This isn't
>with a build of X from master since it is now enabled by default,
>but no released version of X has that change yet.

I have ubuntu 18.04 default xorg (1.20.4). I tried to add this:

>Section "ServerFlags"
>    Option "Debug" "dmabuf_capable"
>EndSection

to my "/usr/share/X11/xorg.conf.d/20-intel.conf" but still - couldn't reproduce an issue.

Mesa libs were exchanged in ".profile" file, all windows are using iris (checked with /proc/$PID/maps)
Comment 7 Jordan Justen 2019-09-03 01:11:58 UTC
(In reply to Mike Lothian from comment #5)
> I'm running Xserver from master

Like Denis, I also can't reproduce with 1.20.4.

Looking at the code that checks dmabuf_capable, I think this
setting might disable modifier support on xserver master. Does
it make any difference for you on xserver master?

Section "ServerFlags"
    Option "Debug" ""
EndSection

Also, any chance you might be able to try  1.20.4 with:

Section "ServerFlags"
    Option "Debug" "dmabuf_capable"
EndSection
Comment 8 Mike Lothian 2019-09-11 15:15:14 UTC
I started seeing full screen corruption with Iris, I unfortunately couldn't bisect back to a good state

I've switched back to i965 for the moment until I have time to figure out what's going on, I'm not sure if the issue lies in Qt which has been upgraded to 5.13.1

Hopefully I'll have time at the weekend to figure out what's going on
Comment 9 Denis 2019-09-11 15:35:11 UTC
Mike, try to get an apitrace. It might be useful as I said before. And possibly - match easier then re-setup or explaining your current configurations.
Comment 10 Mark Janes 2019-09-11 16:31:53 UTC
FWIW, I have been bitten more than once by Qt's transparent shader cache.  You might want to verify that ~/.cache/qtshadercache is not part of the problem.
Comment 11 Mike Lothian 2019-09-11 20:52:21 UTC
I've been bitten by that issue a few times too, I was deleting both the Qt and Mesa shader caches between builds
Comment 12 Mike Lothian 2019-09-14 15:22:34 UTC
Created attachment 145361 [details]
apitrace
Comment 13 Mike Lothian 2019-09-15 15:56:19 UTC
Tried a debug build with the symbols all attached

Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from apitrace...
(No debugging symbols found in apitrace)
(gdb) start
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) 
Starting program: /usr/bin/apitrace trace kwin_x11 --replace
apitrace: loaded into /usr/bin/apitrace
apitrace: unloaded from /usr/bin/apitrace
[Detaching after fork from child process 17905]
apitrace: loaded into /usr/bin/kwin_x11
apitrace: tracing to /home/fireburn/kwin_x11.4.trace
apitrace: ignoring dlopen("libGL.so.1", 0x102) from /usr/lib64/libGL.so.1
apitrace: warning: unknown function "glBlendBarrier"
apitrace: warning: unknown function "glPrimitiveBoundingBox"
apitrace: warning: unknown function "glDiscardFramebuffer"
apitrace: redirecting dlopen("libGL.so.1", 0x1) from /usr/lib64/libepoxy.so.0
OpenGL vendor string:                   Intel
OpenGL renderer string:                 Mesa Intel(R) HD Graphics 530 (Skylake GT2)
OpenGL version string:                  4.6 (Compatibility Profile) Mesa 19.3.0-devel (git-0616b7ac90)
OpenGL shading language version string: 4.60
Driver:                                 Intel
GPU class:                              Unknown
OpenGL version:                         4.6
GLSL version:                           4.60
Mesa version:                           19.3
X server version:                       1.20.99
Linux kernel version:                   5.3
Requires strict binding:                yes
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kwin_x11: ../mesa-9999/src/gallium/drivers/iris/iris_blit.c:241: iris_blorp_surf_for_resource: Assertion `!iris_resource_unfinished_aux_import(res)' failed.
Application::crashHandler() called with signal 6; recent crashes: 1
apitrace: loaded into /bin/bash
apitrace: unloaded from /bin/bash
KCrash: Application 'kwin_x11' crashing...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
apitrace: loaded into /usr/bin/kwin_x11
apitrace: tracing to /home/fireburn/kwin_x11.5.trace
apitrace: ignoring dlopen("libGL.so.1", 0x102) from /usr/lib64/libGL.so.1
apitrace: warning: unknown function "glBlendBarrier"
apitrace: warning: unknown function "glPrimitiveBoundingBox"
apitrace: warning: unknown function "glDiscardFramebuffer"
apitrace: redirecting dlopen("libGL.so.1", 0x1) from /usr/lib64/libepoxy.so.0
OpenGL vendor string:                   Intel
OpenGL renderer string:                 Mesa Intel(R) HD Graphics 530 (Skylake GT2)
OpenGL version string:                  4.6 (Compatibility Profile) Mesa 19.3.0-devel (git-0616b7ac90)
OpenGL shading language version string: 4.60
Driver:                                 Intel
GPU class:                              Unknown
OpenGL version:                         4.6
GLSL version:                           4.60
Mesa version:                           19.3
X server version:                       1.20.99
Linux kernel version:                   5.3
Requires strict binding:                yes
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kwin_x11: ../mesa-9999/src/gallium/drivers/iris/iris_blit.c:241: iris_blorp_surf_for_resource: Assertion `!iris_resource_unfinished_aux_import(res)' failed.
Application::crashHandler() called with signal 6; recent crashes: 2
apitrace: loaded into /bin/bash
apitrace: unloaded from /bin/bash
KCrash: Application 'kwin_x11' crashing...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
apitrace: loaded into /usr/bin/kwin_x11
QSocketNotifier: Invalid socket 12 with type Read, disabling...
QSocketNotifier: Invalid socket 15 with type Read, disabling...

apitrace: tracing to /home/fireburn/kwin_x11.7.trace
apitrace: ignoring dlopen("libGL.so.1", 0x102) from /usr/lib64/libGL.so.1
apitrace: warning: unknown function "glBlendBarrier"
apitrace: warning: unknown function "glPrimitiveBoundingBox"
apitrace: warning: unknown function "glDiscardFramebuffer"
apitrace: redirecting dlopen("libGL.so.1", 0x1) from /usr/lib64/libepoxy.so.0
OpenGL vendor string:                   Intel
OpenGL renderer string:                 Mesa Intel(R) HD Graphics 530 (Skylake GT2)
OpenGL version string:                  4.6 (Compatibility Profile) Mesa 19.3.0-devel (git-0616b7ac90)
OpenGL shading language version string: 4.60
Driver:                                 Intel
GPU class:                              Unknown
OpenGL version:                         4.6
GLSL version:                           4.60
Mesa version:                           19.3
X server version:                       1.20.99
Linux kernel version:                   5.3
Requires strict binding:                yes
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kwin_x11: ../mesa-9999/src/gallium/drivers/iris/iris_blit.c:241: iris_blorp_surf_for_resource: Assertion `!iris_resource_unfinished_aux_import(res)' failed.
Application::crashHandler() called with signal 6; recent crashes: 3
apitrace: loaded into /bin/bash
apitrace: unloaded from /bin/bash
KCrash: Application 'kwin_x11' crashing...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
apitrace: loaded into /usr/bin/kwin_x11

QSocketNotifier: Invalid socket 10 with type Read, disabling...
QSocketNotifier: Invalid socket 13 with type Read, disabling...
Freeze in OpenGL initialization detected
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
QSocketNotifier: Invalid socket 16 with type Read, disabling...
QSocketNotifier: Invalid socket 14 with type Read, disabling...
Freeze in OpenGL initialization detected
[Inferior 1 (process 17901) exited with code 0206]
(gdb) 
(gdb) 
(gdb) Freeze in OpenGL initialization detected
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
apitrace: unloaded from /usr/bin/kwin_x11
(gdb)
Comment 14 Mike Lothian 2019-09-15 16:55:23 UTC
I reverted 246eebba4a8da9c9f4b2b7b98b83c116832dc410 "iris: Export and import surfaces with modifiers that have aux data" and the new asert happens in the revert commit

7d4ea1a162a (Jason Ekstrand    2018-10-25 17:02:56 -0500  905)    if (templ->target == PIPE_BUFFER) {
47d4ea1a162a (Jason Ekstrand    2018-10-25 17:02:56 -0500  906)       res->surf.tiling = ISL_TILING_LINEAR;
47d4ea1a162a (Jason Ekstrand    2018-10-25 17:02:56 -0500  907)    } else {
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  908)       UNUSED const bool isl_surf_created_successfully =
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  909)          isl_surf_init(&screen->isl_dev, &res->surf,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  910)                        .dim = target_to_isl_surf_dim(templ->target),
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  911)                        .format = fmt.fmt,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  912)                        .width = templ->width0,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  913)                        .height = templ->height0,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  914)                        .depth = templ->depth0,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  915)                        .levels = templ->last_level + 1,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  916)                        .array_len = templ->array_size,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  917)                        .samples = MAX2(templ->nr_samples, 1),
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  918)                        .min_alignment_B = 0,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  919)                        .row_pitch_B = whandle->stride,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  920)                        .usage = isl_usage,
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  921)                        .tiling_flags = 1 << res->mod_info->tiling);
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  922)       assert(isl_surf_created_successfully);
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  923)       assert(res->bo->tiling_mode ==
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  924)              isl_tiling_to_i915_tiling(res->surf.tiling));
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  925) 
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  926)       // XXX: create_ccs_buf_for_image?
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  927)       if (!iris_resource_alloc_separate_aux(screen, res))
d13be86f07ae (Mike Lothian      2019-09-15 17:02:35 +0100  928)          goto fail;
47d4ea1a162a (Jason Ekstrand    2018-10-25 17:02:56 -0500  929)    }
Comment 16 Mike Lothian 2019-09-17 20:09:27 UTC
I've been using the modesetting driver up to this point, switching to the intel DDX fixes the issues I've been seeing

I was seeing issues on both Xorg 1.20.5 and the latest git
Comment 17 Jordan Justen 2019-09-17 21:02:56 UTC
(In reply to Mike Lothian from comment #16)
> I've been using the modesetting driver up to this point, switching to the
> intel DDX fixes the issues I've been seeing
> 
> I was seeing issues on both Xorg 1.20.5 and the latest git

This would mean glamor is no longer being used by X. It also
likely means that compressed buffers are no longer being used
for scanout. (I don't really know if the intel driver was
updated for this, but I expect not.)

Did this setting do anything for you?

Section "ServerFlags"
    Option "Debug" ""
EndSection

(See comment 7)
Comment 18 Mike Lothian 2019-09-21 09:37:42 UTC
So this is very strange

I change my xorg snippet from:

Section "Device"
        Identifier  "Radeon" 
        Driver      "modesetting" 
        Option      "DRI"   "3" 
EndSection

to:

Section "ServerFlags"
    Option "Debug" "dmabuf_capable"
EndSection

Section "Device"
    Identifier  "Intel Graphics"
    Driver      "modesetting"
    Option      "AccelMethod"    "glamor"
    Option      "DRI"            "3"
EndSection

Now at least kwin_x11 starts properly with the modesetting driver but I'm back to seeing the strange graphical corruptions on the special effects

I see this in my xorg.0.log too:

[     4.106] (EE) AIGLX error: dlopen of /usr/lib64/dri/i965_dri.so failed (/usr/lib64/dri/i965_dri.so: cannot open shared object file: No such file or directory)
[     4.106] (EE) AIGLX error: unable to load driver i965
[     4.109] (II) IGLX: Loaded and initialized swrast
[     4.109] (II) GLX: Initialized DRISWRAST GL provider for screen 0

Will try with debug ""
Comment 19 Mike Lothian 2019-09-21 10:01:56 UTC
So putting debug "" gives me the graphical mess on startup

So to recap:

modesetting "Debug" "dmabuf_capable" - small glitches on kwin special effects (start of the bug report I guess)
modesetting "Debug" "" - high graphical errors on kwin startup
indel ddx - looks good, though graphical corruption on the borders on steam windows
Comment 20 Mike Lothian 2019-09-21 13:08:04 UTC
I've also fixed that xserver error with the following patch

diff --git a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h
index da7ea1c1e..b2c158bcf 100644
--- a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h
+++ b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h
@@ -70,7 +70,7 @@ static const struct {
    int num_chips_ids;
 } driver_map[] = {
    { 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) },
-   { 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) },
+   { 0x8086, "iris", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) },
 #ifndef DRIVER_MAP_GALLIUM_ONLY
    { 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) },
    { 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) },
Comment 21 GitLab Migration User 2019-09-25 18:47:40 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1360.


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.