From mboxrd@z Thu Jan 1 00:00:00 1970
From: bugzilla-daemon@freedesktop.org
Subject: [Bug 108824] Invalid handling when GL buffer is bound on one context
and invalidated on another
Date: Wed, 21 Nov 2018 20:35:15 +0000
Message-ID:
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="===============0295276131=="
Return-path:
Received: from culpepper.freedesktop.org (culpepper.freedesktop.org
[131.252.210.165])
by gabe.freedesktop.org (Postfix) with ESMTP id 96A9B6E3D7
for ; Wed, 21 Nov 2018 20:35:15 +0000 (UTC)
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: dri-devel-bounces@lists.freedesktop.org
Sender: "dri-devel"
To: dri-devel@lists.freedesktop.org
List-Id: dri-devel@lists.freedesktop.org
--===============0295276131==
Content-Type: multipart/alternative; boundary="15428325150.ad5F5c3.1253"
Content-Transfer-Encoding: 7bit
--15428325150.ad5F5c3.1253
Date: Wed, 21 Nov 2018 20:35:15 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.freedesktop.org/
Auto-Submitted: auto-generated
https://bugs.freedesktop.org/show_bug.cgi?id=3D108824
Bug ID: 108824
Summary: Invalid handling when GL buffer is bound on one
context and invalidated on another
Product: Mesa
Version: git
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
Severity: normal
Priority: medium
Component: Drivers/Gallium/radeonsi
Assignee: dri-devel@lists.freedesktop.org
Reporter: baldurk@baldurk.org
QA Contact: dri-devel@lists.freedesktop.org
Created attachment 142556
--> https://bugs.freedesktop.org/attachment.cgi?id=3D142556&action=3Dedit
piglit test showing broken behaviour
I found some odd behaviour that I think I've tracked down to some incorrect
handling of buffer invalidation in radeonsi.
The rough order of events is:
1. Create a buffer that's shared between two contexts. Ensure it's bound as=
a
UBO on both.
2. Invalidate the buffer with e.g.
glMapBufferRange(GL_MAP_INVALIDATE_BUFFER_BIT) on context A.
3. Context B's buffer bind is now in a bad state. Rendering will have
unpredictable results, and invalidating the buffer again on context B may f=
ail.
That's a bit vague but that's the general repro that I know for sure. This =
will
then result in unpredictable reads/garbage data, and quite likely you'll
eventually hit the assert on src/gallium/drivers/radeonsi/si_descriptors.c:=
1489
- assert(old_buf_va <=3D old_desc_va);
My understanding is that the radeonsi code will look through all bound buff=
ers
whenever an invalidate happens, fixup the descriptors by subtracting the
descriptor's VA from the outgoing VA for the old buffer to get the offset, =
then
add it onto the incoming VA and update the descriptor.
The problem seems to be that when this happens for a buffer invalidate it o=
nly
checks the current context's bound buffers - so other contexts don't have t=
heir
descriptors updated. That means the old VA is still being pointed at, and i=
f an
invalidate happens again on the second thread the descriptor is referring t=
o an
even older VA than the outgoing VA so there's no longer any sense in the
subtract call.
I've attached a piglit test which hopefully should drop right in, it runs
through the steps above and does a pixel readback to ensure the rendering w=
ent
correctly. If you remove the readback you can see flickering output. It runs
fine with both the readback and the rendering if I switch to swrast.
I'm on an RX 480 and tested the bug with both git-61b535437e and 18.2.4 from
padoka's PPA.
--=20
You are receiving this mail because:
You are the assignee for the bug.=
--15428325150.ad5F5c3.1253
Date: Wed, 21 Nov 2018 20:35:15 +0000
MIME-Version: 1.0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.freedesktop.org/
Auto-Submitted: auto-generated
Bug ID |
108824
|
Summary |
Invalid handling when GL buffer is bound on one context and i=
nvalidated on another
|
Product |
Mesa
|
Version |
git
|
Hardware |
x86-64 (AMD64)
|
OS |
Linux (All)
|
Status |
NEW
|
Severity |
normal
|
Priority |
medium
|
Component |
Drivers/Gallium/radeonsi
|
Assignee |
dri-devel@lists.freedesktop.org
|
Reporter |
baldurk@baldurk.org
|
QA Contact |
dri-devel@lists.freedesktop.org
|
Created att=
achment 142556 [details]
piglit test showing broken behaviour
I found some odd behaviour that I think I've tracked down to some incorrect
handling of buffer invalidation in radeonsi.
The rough order of events is:
1. Create a buffer that's shared between two contexts. Ensure it's bound as=
a
UBO on both.
2. Invalidate the buffer with e.g.
glMapBufferRange(GL_MAP_INVALIDATE_BUFFER_BIT) on context A.
3. Context B's buffer bind is now in a bad state. Rendering will have
unpredictable results, and invalidating the buffer again on context B may f=
ail.
That's a bit vague but that's the general repro that I know for sure. This =
will
then result in unpredictable reads/garbage data, and quite likely you'll
eventually hit the assert on src/gallium/drivers/radeonsi/si_descriptors.c:=
1489
- assert(old_buf_va <=3D old_desc_va);
My understanding is that the radeonsi code will look through all bound buff=
ers
whenever an invalidate happens, fixup the descriptors by subtracting the
descriptor's VA from the outgoing VA for the old buffer to get the offset, =
then
add it onto the incoming VA and update the descriptor.
The problem seems to be that when this happens for a buffer invalidate it o=
nly
checks the current context's bound buffers - so other contexts don't have t=
heir
descriptors updated. That means the old VA is still being pointed at, and i=
f an
invalidate happens again on the second thread the descriptor is referring t=
o an
even older VA than the outgoing VA so there's no longer any sense in the
subtract call.
I've attached a piglit test which hopefully should drop right in, it runs
through the steps above and does a pixel readback to ensure the rendering w=
ent
correctly. If you remove the readback you can see flickering output. It runs
fine with both the readback and the rendering if I switch to swrast.
I'm on an RX 480 and tested the bug with both git-61b535437e and 18.2.4 from
padoka's PPA.
You are receiving this mail because:
- You are the assignee for the bug.
=
--15428325150.ad5F5c3.1253--
--===============0295276131==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs
IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz
dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg==
--===============0295276131==--