Re: [Mesa-dev] [RFC] radeonsi: guard against indexbuf not being set

2018-03-19 Thread Marek Olšák
Can you test this?

diff --git a/src/mesa/state_tracker/st_draw.c
b/src/mesa/state_tracker/st_draw.c
index b95a2522b2e..73f936bb4a9 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -173,6 +173,13 @@ st_draw_vbo(struct gl_context *ctx,
  /* indices are in a real VBO */
  info.has_user_indices = false;
  info.index.resource = st_buffer_object(bufobj)->buffer;
+
+ /* Return if the bound element array buffer doesn't have any
backing
+  * storage. (nothing to do)
+  */
+ if (!info.index.resource)
+return;
+
  start = pointer_to_offset(ib->ptr) / info.index_size;
   } else {
  /* indices are in user space memory */


Marek

On Mon, Mar 19, 2018 at 4:22 PM, Clemens Eisserer 
wrote:

> Hi Marek and Roman,
>
> > Set this environment variable to disable multithreading:
> > GALLIUM_THREAD=0
>
> Thanks, so at least I get now a proper stacktrace (at the bottom).
>
> I am no OpenGL expert, the only thing I find suspicious is that the
> last function before entering mesa code actually has a parameter
> indexbuf set to 0x58b32b18, while in si_draw_vbo indexbuf=0.
> However, those two might be completly unrelated indexbuf variables of
> course.
>
> Best regards, Clemens
>
>
> Thread 1 "kwin" received signal SIGSEGV, Segmentation fault.
> si_draw_vbo (ctx=0x590ed3e0, info=0x7fffd020) at
> si_state_draw.c:1372
> 1372} else if (sctx->b.chip_class <= CIK &&
> #0  0x7fffc37fa890 in si_draw_vbo (ctx=0x590ed3e0,
> info=0x7fffd020) at si_state_draw.c:1372
> sctx = 0x590ed3e0
> rs = 
> indexbuf = 0x0
> dirty_tex_counter = 
> rast_prim = 
> index_size = 2
> index_offset = 0
> #1  0x7fffc352180c in u_vbuf_draw_vbo (mgr=0x584c57a0,
> info=) at util/u_vbuf.c:1142
> pipe = 0x590ed3e0
> start_vertex = 
> min_index = 
> num_vertices = 
> unroll_indices = 0 '\000'
> used_vb_mask = 
> user_vb_mask = 
> incompatible_vb_mask = 0
> new_info =
>   {index_size = 10 '\n', mode = PIPE_PRIM_POINTS,
> primitive_restart = 0, has_user_indices = 0, vertices_per_patch = 0
> '\000', start = 0, count = 16, start_instance = 0, instance_count =
> 16, drawid = 0, index_bias = 1486497808, min_index = 21845, max_index
> = 1494143968, restart_index = 21845, index = {resource =
> 0x7fffc37cf21c , user = 0x7fffc37cf21c
> }, indirect = 0x10001,
> count_from_stream_output = 0x10}
> #2  0x7fffc32aeb9f in st_draw_vbo (ctx=,
> prims=0x7fffd100, nr_prims=, ib=0x7fffd0e0,
> index_bounds_valid=, min_index=,
> max_index=, tfb_vertcount=0x0, stream=0, indirect=0x0)
> at state_tracker/st_draw.c:227
> st = 0x58be7170
> info =
>   {index_size = 2 '\002', mode = PIPE_PRIM_TRIANGLE_STRIP,
> primitive_restart = 0, has_user_indices = 0, vertices_per_patch = 3
> '\003', start = 1, count = 4, start_instance = 0, instance_count = 1,
> drawid = 0, index_bias = 0, min_index = 0, max_index = 4294967295,
> restart_index = 21845, index = {resource = 0x0, user = 0x0}, indirect
> = 0x0, count_from_stream_output = 0x0}
> i = 
> start = 1
> #3  0x7fffc3271d58 in vbo_validated_drawrangeelements
> (ctx=ctx@entry=0x589e1280, mode=mode@entry=5,
> index_bounds_valid=index_bounds_valid@entry=0 '\000',
> start=start@entry=0, end=end@entry=4294967295, count=count@entry=4,
> type=5123, indices=0x2, basevertex=0, numInstances=1, baseInstance=0)
> at vbo/vbo_exec_array.c:925
> vbo = 
> ib = {count = 4, index_size = 2, obj = 0x58fab6e0, ptr = 0x2}
> prim = {mode = 5, indexed = 1, begin = 1, end = 1, weak = 0,
> no_current_update = 0, is_indirect = 0, pad = 0, start = 0, count = 4,
> basevertex = 0, num_instances = 1, base_instance = 0, draw_id = 0,
> indirect_offset = 1}
> #4  0x7fffc32724cf in vbo_exec_DrawElements (mode=5, count=4,
> type=5123, indices=0x2) at vbo/vbo_exec_array.c:1075
> ctx = 0x589e1280
> #5  0x75ec9d5f in QOpenGLFunctions::glDrawElements(unsigned
> int, int, unsigned int, void const*) (indices=,
> type=5123, count=, mode=,
> this=0x591f09b8)
> at /usr/include/qt5/QtGui/qopenglfunctions.h:752
> offset = 
> i = 0
> gn = 
> sms = 0x5932aed0
> attrNames = 0x76382e10
> 
> e = 
> dirty = 
> indexBase = 0x0
> indexBuf = 0x58b32b18
> material = 
> program = 
> batch = 0x58b32ae0
> this = 0x591f08e0
> #6  0x75ec9d5f in
> QSGBatchRenderer::Renderer::renderMergedBatch(QSGBatchRenderer::Batch
> const*) (this=0x591f08e0, batch=0x58b32ae0) at
> 

Re: [Mesa-dev] [RFC] radeonsi: guard against indexbuf not being set

2018-03-19 Thread Clemens Eisserer
Hi Marek and Roman,

> Set this environment variable to disable multithreading:
> GALLIUM_THREAD=0

Thanks, so at least I get now a proper stacktrace (at the bottom).

I am no OpenGL expert, the only thing I find suspicious is that the
last function before entering mesa code actually has a parameter
indexbuf set to 0x58b32b18, while in si_draw_vbo indexbuf=0.
However, those two might be completly unrelated indexbuf variables of course.

Best regards, Clemens


Thread 1 "kwin" received signal SIGSEGV, Segmentation fault.
si_draw_vbo (ctx=0x590ed3e0, info=0x7fffd020) at si_state_draw.c:1372
1372} else if (sctx->b.chip_class <= CIK &&
#0  0x7fffc37fa890 in si_draw_vbo (ctx=0x590ed3e0,
info=0x7fffd020) at si_state_draw.c:1372
sctx = 0x590ed3e0
rs = 
indexbuf = 0x0
dirty_tex_counter = 
rast_prim = 
index_size = 2
index_offset = 0
#1  0x7fffc352180c in u_vbuf_draw_vbo (mgr=0x584c57a0,
info=) at util/u_vbuf.c:1142
pipe = 0x590ed3e0
start_vertex = 
min_index = 
num_vertices = 
unroll_indices = 0 '\000'
used_vb_mask = 
user_vb_mask = 
incompatible_vb_mask = 0
new_info =
  {index_size = 10 '\n', mode = PIPE_PRIM_POINTS,
primitive_restart = 0, has_user_indices = 0, vertices_per_patch = 0
'\000', start = 0, count = 16, start_instance = 0, instance_count =
16, drawid = 0, index_bias = 1486497808, min_index = 21845, max_index
= 1494143968, restart_index = 21845, index = {resource =
0x7fffc37cf21c , user = 0x7fffc37cf21c
}, indirect = 0x10001,
count_from_stream_output = 0x10}
#2  0x7fffc32aeb9f in st_draw_vbo (ctx=,
prims=0x7fffd100, nr_prims=, ib=0x7fffd0e0,
index_bounds_valid=, min_index=,
max_index=, tfb_vertcount=0x0, stream=0, indirect=0x0)
at state_tracker/st_draw.c:227
st = 0x58be7170
info =
  {index_size = 2 '\002', mode = PIPE_PRIM_TRIANGLE_STRIP,
primitive_restart = 0, has_user_indices = 0, vertices_per_patch = 3
'\003', start = 1, count = 4, start_instance = 0, instance_count = 1,
drawid = 0, index_bias = 0, min_index = 0, max_index = 4294967295,
restart_index = 21845, index = {resource = 0x0, user = 0x0}, indirect
= 0x0, count_from_stream_output = 0x0}
i = 
start = 1
#3  0x7fffc3271d58 in vbo_validated_drawrangeelements
(ctx=ctx@entry=0x589e1280, mode=mode@entry=5,
index_bounds_valid=index_bounds_valid@entry=0 '\000',
start=start@entry=0, end=end@entry=4294967295, count=count@entry=4,
type=5123, indices=0x2, basevertex=0, numInstances=1, baseInstance=0)
at vbo/vbo_exec_array.c:925
vbo = 
ib = {count = 4, index_size = 2, obj = 0x58fab6e0, ptr = 0x2}
prim = {mode = 5, indexed = 1, begin = 1, end = 1, weak = 0,
no_current_update = 0, is_indirect = 0, pad = 0, start = 0, count = 4,
basevertex = 0, num_instances = 1, base_instance = 0, draw_id = 0,
indirect_offset = 1}
#4  0x7fffc32724cf in vbo_exec_DrawElements (mode=5, count=4,
type=5123, indices=0x2) at vbo/vbo_exec_array.c:1075
ctx = 0x589e1280
#5  0x75ec9d5f in QOpenGLFunctions::glDrawElements(unsigned
int, int, unsigned int, void const*) (indices=,
type=5123, count=, mode=,
this=0x591f09b8)
at /usr/include/qt5/QtGui/qopenglfunctions.h:752
offset = 
i = 0
gn = 
sms = 0x5932aed0
attrNames = 0x76382e10

e = 
dirty = 
indexBase = 0x0
indexBuf = 0x58b32b18
material = 
program = 
batch = 0x58b32ae0
this = 0x591f08e0
#6  0x75ec9d5f in
QSGBatchRenderer::Renderer::renderMergedBatch(QSGBatchRenderer::Batch
const*) (this=0x591f08e0, batch=0x58b32ae0) at
scenegraph/coreapi/qsgbatchrenderer.cpp:2360
offset = 
i = 0
gn = 
sms = 0x5932aed0
attrNames = 0x76382e10

e = 
dirty = 
indexBase = 0x0
indexBuf = 0x58b32b18
material = 
program = 
batch = 0x58b32ae0
this = 0x591f08e0
#7  0x75ecafa5 in QSGBatchRenderer::Renderer::renderBatches()
(this=this@entry=0x591f08e0) at
scenegraph/coreapi/qsgbatchrenderer.cpp:2569
b = 
i = 2
r = {x1 = , y1 = , x2 =
, y2 = 2159}
renderOpaque = 
renderAlpha = 255
#8  0x75ed06f4 in QSGBatchRenderer::Renderer::render()
(this=) at scenegraph/coreapi/qsgbatchrenderer.cpp:2763
timer = {t1 = -9223372036854775808, t2 = -9223372036854775808}
timeRenderLists = 0
timePrepareOpaque = 0
timePrepareAlpha = 0
timeSorting = 0
timeUploadOpaque = 0
timeUploadAlpha = 0
largestVBO = 

Re: [Mesa-dev] [RFC] radeonsi: guard against indexbuf not being set

2018-03-19 Thread Marek Olšák
Set this environment variable to disable multithreading:

GALLIUM_THREAD=0

Marek

On Mon, Mar 19, 2018 at 1:05 PM, Clemens Eisserer 
wrote:

> Hi,
>
> >> This is a RFC because I don't really know what I'm doing here. But we
> >> have this problem with AMD and KWin already for quite a long time and
> >> I hope it can be fixed now.
> > If index_size > 0, indexbuf should always be non-NULL. This is a bug
> > somewhere else.
>
> I've also been bitten by this bug - is there any way to disable the
> multi-threading, so I get at least a reasonable stacktrace?
>
> Thanks, Clemens
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC] radeonsi: guard against indexbuf not being set

2018-03-19 Thread Clemens Eisserer
Hi,

>> This is a RFC because I don't really know what I'm doing here. But we
>> have this problem with AMD and KWin already for quite a long time and
>> I hope it can be fixed now.
> If index_size > 0, indexbuf should always be non-NULL. This is a bug
> somewhere else.

I've also been bitten by this bug - is there any way to disable the
multi-threading, so I get at least a reasonable stacktrace?

Thanks, Clemens
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC] radeonsi: guard against indexbuf not being set

2018-03-06 Thread Marek Olšák
If index_size > 0, indexbuf should always be non-NULL. This is a bug
somewhere else.

Marek

On Mon, Mar 5, 2018 at 4:42 PM, Roman Gilg  wrote:
> This is a RFC because I don't really know what I'm doing here. But we
> have this problem with AMD and KWin already for quite a long time and
> I hope it can be fixed now.
>
> I followed the debug output and tried this guard. On my system this
> fixed the issue with Alt+Tab crashing KWin. Still this might be not
> the right solution to the problem.
>
> According to git-blame 330d0607 was the last time this condition was touched.
>
> On Mon, Mar 5, 2018 at 10:31 PM, Roman Gilg  wrote:
>> Fixes crashes of clients when index_size != 0, but there was no indexbuf
>> set in si_draw_vbo.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103234
>>
>> Signed-off-by: Roman Gilg 
>> ---
>>  src/gallium/drivers/radeonsi/si_state_draw.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
>> b/src/gallium/drivers/radeonsi/si_state_draw.c
>> index ad470fd..e53da38 100644
>> --- a/src/gallium/drivers/radeonsi/si_state_draw.c
>> +++ b/src/gallium/drivers/radeonsi/si_state_draw.c
>> @@ -680,7 +680,7 @@ static void si_emit_draw_packets(struct si_context *sctx,
>> }
>>
>> /* draw packet */
>> -   if (index_size) {
>> +   if (index_size && indexbuf) {
>> if (index_size != sctx->last_index_size) {
>> unsigned index_type;
>>
>> --
>> 2.7.4
>>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC] radeonsi: guard against indexbuf not being set

2018-03-05 Thread Roman Gilg
This is a RFC because I don't really know what I'm doing here. But we
have this problem with AMD and KWin already for quite a long time and
I hope it can be fixed now.

I followed the debug output and tried this guard. On my system this
fixed the issue with Alt+Tab crashing KWin. Still this might be not
the right solution to the problem.

According to git-blame 330d0607 was the last time this condition was touched.

On Mon, Mar 5, 2018 at 10:31 PM, Roman Gilg  wrote:
> Fixes crashes of clients when index_size != 0, but there was no indexbuf
> set in si_draw_vbo.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103234
>
> Signed-off-by: Roman Gilg 
> ---
>  src/gallium/drivers/radeonsi/si_state_draw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
> b/src/gallium/drivers/radeonsi/si_state_draw.c
> index ad470fd..e53da38 100644
> --- a/src/gallium/drivers/radeonsi/si_state_draw.c
> +++ b/src/gallium/drivers/radeonsi/si_state_draw.c
> @@ -680,7 +680,7 @@ static void si_emit_draw_packets(struct si_context *sctx,
> }
>
> /* draw packet */
> -   if (index_size) {
> +   if (index_size && indexbuf) {
> if (index_size != sctx->last_index_size) {
> unsigned index_type;
>
> --
> 2.7.4
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [RFC] radeonsi: guard against indexbuf not being set

2018-03-05 Thread Roman Gilg
Fixes crashes of clients when index_size != 0, but there was no indexbuf
set in si_draw_vbo.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103234

Signed-off-by: Roman Gilg 
---
 src/gallium/drivers/radeonsi/si_state_draw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index ad470fd..e53da38 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -680,7 +680,7 @@ static void si_emit_draw_packets(struct si_context *sctx,
}
 
/* draw packet */
-   if (index_size) {
+   if (index_size && indexbuf) {
if (index_size != sctx->last_index_size) {
unsigned index_type;
 
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev