Bug 240722 - graphics/mesa-dri: llvm9 update breaks amdgpu
Summary: graphics/mesa-dri: llvm9 update breaks amdgpu
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Jan Beich
URL:
Keywords: regression
Depends on:
Blocks: 239682
  Show dependency treegraph
 
Reported: 2019-09-21 05:46 UTC by Ivan Rozhuk
Modified: 2019-09-26 04:16 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)


Attachments
v1 (4.34 KB, patch)
2019-09-21 12:53 UTC, Jan Beich
no flags Details | Diff
v2 (12.41 KB, patch)
2019-09-22 00:50 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2019-09-21 05:46:59 UTC
After update graphics/mesa-dri to use llvm90 - crap on screen on ryzen 2200g + amdgu, FreeBSD 12.1 (latest and latest ports).
Comment 1 Ivan Rozhuk 2019-09-21 06:10:52 UTC
Rebuilding graphics/mesa-dri with llvm80 fix image on screen.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2019-09-21 12:53:55 UTC
Created attachment 207677 [details]
v1

(In reply to rozhuk.im from comment #0)
> ... crap on screen ...

Not very detailed. ;) Can you make a screenshot or photo? Besides, run with LIBGL_DEBUG=verbose to try to get Mesa print diagnostics and check if LIBGL_ALWAYS_SOFTWARE=1 is also affected.

Since 18.3.2 more HAVE_LLVM >= 0x0900 checks are upstream:
2019-04-17 https://gitlab.freedesktop.org/mesa/mesa/commit/dded2edf8bed (in the patch)
2019-04-29 https://gitlab.freedesktop.org/mesa/mesa/commit/bd4c661ad08e
2019-05-01 https://gitlab.freedesktop.org/mesa/mesa/commit/bfd3d504875a
2019-05-13 https://gitlab.freedesktop.org/mesa/mesa/commit/81fe33735a55
2019-05-13 https://gitlab.freedesktop.org/mesa/mesa/commit/d814c21b1bea
2019-06-12 https://gitlab.freedesktop.org/mesa/mesa/commit/33be5ad8a39a
2019-06-12 https://gitlab.freedesktop.org/mesa/mesa/commit/b519ddc35cf9
2019-07-03 https://gitlab.freedesktop.org/mesa/mesa/commit/594010e366f9
2019-07-07 https://gitlab.freedesktop.org/mesa/mesa/commit/bf1e1a29c301
2019-07-19 https://gitlab.freedesktop.org/mesa/mesa/commit/39d0c68321df (in the patch)
2019-08-02 https://gitlab.freedesktop.org/mesa/mesa/commit/e1c5d8a36490

Does the attached patch help? If not check whether bug 235570 is also affected.
Comment 3 accounts 2019-09-21 22:11:18 UTC
The very same problem seems to have hit here: Upon xinit the screen is garbled.

FreeBSD 12.0-RELEASE-p10 GENERIC amd64 and latest ports

Error message (repeated in quick succession):
LLVM failed to compile shader
LLVM triggered Diagnostic Handler: <unknown>:0:0: in function main void ([0 x <4 x i32>] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, [0 x float] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, i32, i32, i32, i32, [0 x <4 x i32>] addrspace(6)*, i32, i32, i32, i32, i32): unsupported call from graphics shader of functio
n llvm.SI.load.const.v4i32

The attached patch did not fix the issue. Tried with software rendering, not affected.
Comment 5 Jan Beich freebsd_committer freebsd_triage 2019-09-22 02:21:54 UTC
If not obvious llvm.SI.load.const.v4i32 is fixed by https://gitlab.freedesktop.org/mesa/mesa/commit/e4803ab7d2b6 I've probably backported more than necessary in hope to fix unreported regressions.
Comment 6 Ivan Rozhuk 2019-09-22 04:04:50 UTC
How it should be: http://www.netlab.linkpc.net/download/Me/Private/IMG_20190922_044103.jpg

Crap: http://www.netlab.linkpc.net/download/Me/Private/IMG_20190922_044231.jpg
http://www.netlab.linkpc.net/download/Me/Private/IMG_20190922_044645.jpg
(will remove it on bug close)

LIBGL_ALWAYS_SOFTWARE=1 - yes, this helps!

LIBGL_DEBUG=verbose
=============================================================
LLVM triggered Diagnostic Handler: <unknown>:0:0: in function main <{ i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> ([0 x <4 x i32>] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, [0 x float] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, float, i32, <2 x i32>, <2 x i32>, <2 x i32>, <3 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, float, float, float, float, float, i32, i32, float, i32): unsupported call from graphics shader of function llvm.SI.load.const.v4i32

LLVM triggered Diagnostic Handler: <unknown>:0:0: in function main <{ i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> ([0 x <4 x i32>] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, [0 x float] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, float, i32, <2 x i32>, <2 x i32>, <2 x i32>, <3 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, float, float, float, float, float, i32, i32, float, i32): unsupported call from graphics shader of function llvm.SI.load.const.v4i32
...
LLVM failed to compile shader
radeonsi: can't compile a main shader part
LLVM failed to compile shader
radeonsi: can't compile a main shader part
LLVM triggered Diagnostic Handler: <unknown>:0:0: in function main <{ i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> ([0 x <4 x i32>] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, [0 x float] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, float, i32, <2 x i32>, <2 x i32>, <2 x i32>, <3 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, float, float, float, float, float, i32, i32, float, i32): unsupported call from graphics shader of function llvm.SI.load.const.v4i32
...
LLVM failed to compile shader
LLVM triggered Diagnostic Handler: <unknown>:0:0: in function main void ([0 x <4 x i32>] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, [0 x float] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, i32, i32, i32, i32, [0 x <4 x i32>] addrspace(6)*, i32, i32, i32, i32, i32, i32, i32): unsupported call from graphics shader of function llvm.SI.load.const.v4i32
...
LLVM triggered Diagnostic Handler: <unknown>:0:0: in function main void ([0 x <4 x i32>] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, [0 x float] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, i32, i32, i32, i32, [0 x <4 x i32>] addrspace(6)*, i32, i32, i32, i32, i32, i32): unsupported call from graphics shader of function llvm.SI.load.const.v4i32

LLVM triggered Diagnostic Handler: <unknown>:0:0: in function main void ([0 x <4 x i32>] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, [0 x float] addrspace(6)*, [0 x <8 x i32>] addrspace(6)*, i32, i32, i32, i32, [0 x <4 x i32>] addrspace(6)*, i32, i32, i32, i32, i32, i32, i32): unsupported call from graphics shader of function llvm.SI.load.const.v4i32
...
=============================================================


Patch - work. (I remove LIBGL_ALWAYS_SOFTWARE=1 then check)


PS: EXTRAS - if unset in lang/llvm90 then got error:
pkg-static: Unable to access file /tmp/ports/usr/ports/devel/llvm90/work/stage/usr/local/llvm90/bin/clangd:No such file or directory
Comment 7 accounts 2019-09-22 07:01:39 UTC
To confirm, patch v2 resolves the issue. Thank you!
Comment 8 commit-hook freebsd_committer freebsd_triage 2019-09-22 10:22:04 UTC
A commit references this bug:

Author: jbeich
Date: Sun Sep 22 10:21:11 UTC 2019
New revision: 512573
URL: https://svnweb.freebsd.org/changeset/ports/512573

Log:
  graphics/mesa-dri: fix rendering glitches on AMD GPUs after r512440

  PR:		240722
  Reported by:	rozhuk.im@gmail.com, freebsdbugs@urisc.net
  Tested by:	rozhuk.im@gmail.com, freebsdbugs@urisc.net
  Obtained from:	upstream
  Approved by:	portmgr blanket

Changes:
  head/graphics/mesa-dri/Makefile
  head/graphics/mesa-dri/files/patch-0a7e767
  head/graphics/mesa-dri/files/patch-39d0c68
  head/graphics/mesa-dri/files/patch-3e249b8
  head/graphics/mesa-dri/files/patch-648dc52
  head/graphics/mesa-dri/files/patch-b5012a0
  head/graphics/mesa-dri/files/patch-dded2ed
  head/graphics/mesa-dri/files/patch-e4803ab
Comment 9 Jan Beich freebsd_committer freebsd_triage 2019-09-22 10:28:46 UTC
Thanks for the quick feedback. Expect the fix in binary packages from Tuesday on. Hopefully, ~1 week is enough to stabilize before 2019Q4 branches.
Comment 10 Jan Beich freebsd_committer freebsd_triage 2019-09-22 10:36:55 UTC
(In reply to rozhuk.im from comment #6)
> PS: EXTRAS - if unset in lang/llvm90 then got error:
> pkg-static: Unable to access file /tmp/ports/usr/ports/devel/llvm90/work/stage/usr/local/llvm90/bin/clangd:No such file or directory

File a separate bug to let brooks@ investigate. Neither me nor x11@ maintain devel/llvm* ports.
Comment 11 Warner Losh freebsd_committer freebsd_triage 2019-09-22 11:10:05 UTC
I know this is closed, but it seems to me that 1 week before the branch point while there's a BSD conference going on is an unwise time to try to throw the switch on the compiler version change. We're now in un-planned fired rill mode, and that's quite disrespectful of people's time and borders on abuse, imho. Jan, please consider how your actions affect others more in the future because this sort of behavior is the kind of friction that the core team is trying to reduce.
Comment 12 Ivan Rozhuk 2019-09-25 23:41:31 UTC
(In reply to Jan Beich from comment #9)

Thanks!