Bug 74717

Summary: r600g: 'invalid read' linking geometry shader
Product: Mesa Reporter: Török Edwin <edwin+bugs>
Component: glsl-compilerAssignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: airlied, andreas.boll.dev, b.bellec, Dieter, mesa-dev
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: gl-320-primitive-shading.trace
gl-320-primitive-sprite.png

Description Török Edwin 2014-02-08 17:49:07 UTC
Created attachment 93669 [details]
gl-320-primitive-shading.trace

I am happy that r600g gained OpenGL 3.3 support in Mesa, so I tested a few geometry shader samples.

gl-320-primitive-shading either segfaults or prints error messages when run.
According to valgrind there is an invalid read when linking the shader. I have reproduced the invalid read with glretrace too (see attachment).

Kernel is 3.14.0-rc1 + merge of 7c4c62a04a2a80e3feb5d6c97aca1e413b11c790 from drm-fixes:
$ uname -a
Linux debian 3.14.0-rc1-00015-g7c4c62a #48 SMP PREEMPT Sat Feb 8 17:33:48 EET 2014 x86_64 GNU/Linux

Mesa is from the 10.1 branch:
$ glxinfo |grep OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD RV730
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.1.0-rc1 (git-1e6bba5)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.1.0-rc1 (git-1e6bba5)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:

Hardware is a Radeon HD 4650:
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV730 PRO [Radeon HD 4650] (prog-if 00 [VGA controller])

To reproduce using the source code:
$ git clone https://github.com/g-truc/ogl-samples
$ cmake .
$ make 
$ build/build/release/gl-320-primitive-shading

The relevant source files:
https://github.com/g-truc/ogl-samples/blob/master/samples/gl-320-primitive-shading.cpp
https://github.com/g-truc/ogl-samples/blob/master/data/gl-320/primitive-shading.frag
https://github.com/g-truc/ogl-samples/blob/master/data/gl-320/primitive-shading.geom
https://github.com/g-truc/ogl-samples/blob/master/data/gl-320/primitive-shading.vert

Running 'valgrind glretrace gl-320-primitive-shading.trace' shows:
==10728== Memcheck, a memory error detector
==10728== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==10728== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==10728== Command: glretrace gl-320-primitive-shading.trace
==10728== 
==10728== Invalid read of size 8
==10728==    at 0x58131A0: glsl_to_tgsi_visitor::copy_propagate() (st_glsl_to_tgsi.cpp:3447)
==10728==    by 0x581AE1F: st_link_shader (st_glsl_to_tgsi.cpp:5126)
==10728==    by 0x582EDD9: _mesa_glsl_link_shader (ir_to_mesa.cpp:3091)
==10728==    by 0x577E729: link_program (shaderapi.c:872)
==10728==    by 0x47D8B3: _glLinkProgram(unsigned int) (in /usr/local/bin/glretrace)
==10728==    by 0x4E7411: retrace_glLinkProgram(trace::Call&) (in /usr/local/bin/glretrace)
==10728==    by 0x429EDC: retrace::Retracer::retrace(trace::Call&) (in /usr/local/bin/glretrace)
==10728==    by 0x41F7F8: retrace::retraceCall(trace::Call*) (in /usr/local/bin/glretrace)
==10728==    by 0x421681: retrace::RelayRunner::runLeg(trace::Call*) (in /usr/local/bin/glretrace)
==10728==    by 0x421573: retrace::RelayRunner::runRace() (in /usr/local/bin/glretrace)
==10728==    by 0x41FB49: retrace::RelayRace::run() (in /usr/local/bin/glretrace)
==10728==    by 0x41FD18: retrace::mainLoop() (in /usr/local/bin/glretrace)
==10728==  Address 0x8517a88 is not stack'd, malloc'd or (recently) free'd
==10728== 
==10728== Invalid read of size 8
==10728==    at 0x58131B6: glsl_to_tgsi_visitor::copy_propagate() (st_glsl_to_tgsi.cpp:3459)
==10728==    by 0x581AE1F: st_link_shader (st_glsl_to_tgsi.cpp:5126)
==10728==    by 0x582EDD9: _mesa_glsl_link_shader (ir_to_mesa.cpp:3091)
==10728==    by 0x577E729: link_program (shaderapi.c:872)
==10728==    by 0x47D8B3: _glLinkProgram(unsigned int) (in /usr/local/bin/glretrace)
==10728==    by 0x4E7411: retrace_glLinkProgram(trace::Call&) (in /usr/local/bin/glretrace)
==10728==    by 0x429EDC: retrace::Retracer::retrace(trace::Call&) (in /usr/local/bin/glretrace)
==10728==    by 0x41F7F8: retrace::retraceCall(trace::Call*) (in /usr/local/bin/glretrace)
==10728==    by 0x421681: retrace::RelayRunner::runLeg(trace::Call*) (in /usr/local/bin/glretrace)
==10728==    by 0x421573: retrace::RelayRunner::runRace() (in /usr/local/bin/glretrace)
==10728==    by 0x41FB49: retrace::RelayRace::run() (in /usr/local/bin/glretrace)
==10728==    by 0x41FD18: retrace::mainLoop() (in /usr/local/bin/glretrace)
==10728==  Address 0x188 is not stack'd, malloc'd or (recently) free'd
==10728== 
apitrace: warning: caught signal 11
5394: error: caught an unhandled exception

Running it without valgrind shows this:
$ glretrace gl-320-primitive-shading.trace
EE r600_shader.c:345 tgsi_is_supported - unsupported src 0 (dimension 1)
EE r600_shader.c:157 r600_pipe_shader_create - translation from TGSI failed !
EE r600_state_common.c:745 r600_shader_select - Failed to build shader variant (type=2) -22
EE r600_shader.c:345 tgsi_is_supported - unsupported src 0 (dimension 1)
EE r600_shader.c:157 r600_pipe_shader_create - translation from TGSI failed !
EE r600_state_common.c:745 r600_shader_select - Failed to build shader variant (type=2) -22
Comment 1 Andreas Boll 2014-02-08 19:32:23 UTC
I have replayed your trace and I get the following failing assertion. (mesa is compiled with --enable-debug)

glretrace: ../../src/glsl/ir.cpp:170: ir_assignment::ir_assignment(ir_dereference*, ir_rvalue*, ir_rvalue*, unsigned int): Assertion `lhs_components == this->rhs->type->vector_elements' failed.



OpenGL renderer string: Gallium 0.4 on AMD BARTS
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.2.0-devel (git-6e8d04a)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.2.0-devel (git-6e8d04a)
OpenGL shading language version string: 1.30
Comment 2 Török Edwin 2014-02-08 22:03:50 UTC
(In reply to comment #1)
> I have replayed your trace and I get the following failing assertion. (mesa
> is compiled with --enable-debug)
> 
> glretrace: ../../src/glsl/ir.cpp:170:
> ir_assignment::ir_assignment(ir_dereference*, ir_rvalue*, ir_rvalue*,
> unsigned int): Assertion `lhs_components ==
> this->rhs->type->vector_elements' failed.

I can confirm that I get the same assertion when running the original program, see backtrace below:

OpenGL Version Needed 3.2 ( 3.3 Found )
Compiling shader
gl-320/primitive-shading.vert...

Compiling shader
gl-320/primitive-shading.geom...

Compiling shader
gl-320/primitive-shading.frag...

gl-320-primitive-shading: ../../src/glsl/ir.cpp:170: ir_assignment::ir_assignment(ir_dereference*, ir_rvalue*, ir_rvalue*, unsigned int): Assertion `lhs_components == this->rhs->type->vector_elements' failed.

Program received signal SIGABRT, Aborted.
0x000000382c4351d5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x000000382c4351d5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x000000382c438388 in __GI_abort () at abort.c:90
#2  0x000000382c42e252 in __assert_fail_base (fmt=0x382c56c080 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x7ffff70d6cb8 "lhs_components == this->rhs->type->vector_elements", 
    file=file@entry=0x7ffff70d6c57 "../../src/glsl/ir.cpp", line=line@entry=170, 
    function=function@entry=0x7ffff70d7960 <ir_assignment::ir_assignment(ir_dereference*, ir_rvalue*, ir_rvalue*, unsigned int)::__PRETTY_FUNCTION__> "ir_assignment::ir_assignment(ir_dereference*, ir_rvalue*, ir_rvalue*, unsigned int)") at assert.c:92
#3  0x000000382c42e302 in __GI___assert_fail (assertion=0x7ffff70d6cb8 "lhs_components == this->rhs->type->vector_elements", 
    file=0x7ffff70d6c57 "../../src/glsl/ir.cpp", line=170, 
    function=0x7ffff70d7960 <ir_assignment::ir_assignment(ir_dereference*, ir_rvalue*, ir_rvalue*, unsigned int)::__PRETTY_FUNCTION__> "ir_assignment::ir_assignment(ir_dereference*, ir_rvalue*, ir_rvalue*, unsigned int)") at assert.c:101
#4  0x00007ffff65950c1 in ir_assignment::ir_assignment (this=0xa4f8f0, lhs=0xa4f250, rhs=0xa4f3a0, condition=0x0, write_mask=15)
    at ../../src/glsl/ir.cpp:170
#5  0x00007ffff659b9b7 in ir_assignment::clone (this=0xa42880, mem_ctx=0x79f4e0, ht=0xa4ef50) at ../../src/glsl/ir_clone.cpp:271
#6  0x00007ffff659bfcf in clone_ir_list (mem_ctx=0x79f4e0, out=0x7fffffffd8e0, in=0xa41f60) at ../../src/glsl/ir_clone.cpp:432
#7  0x00007ffff65bffe5 in (anonymous namespace)::loop_unroll_visitor::simple_unroll (this=0x7fffffffdba0, ir=0xa41f40, 
    iterations=3) at ../../src/glsl/loop_unroll.cpp:112
#8  0x00007ffff65c03ae in (anonymous namespace)::loop_unroll_visitor::visit_leave (this=0x7fffffffdba0, ir=0xa41f40)
    at ../../src/glsl/loop_unroll.cpp:270
#9  0x00007ffff65a5633 in ir_loop::accept (this=0xa41f40, v=0x7fffffffdba0) at ../../src/glsl/ir_hv_accept.cpp:94
#10 0x00007ffff65a5505 in visit_list_elements (v=0x7fffffffdba0, l=0xa41b38, statement_list=true)
    at ../../src/glsl/ir_hv_accept.cpp:56
#11 0x00007ffff65a56f5 in ir_function_signature::accept (this=0xa41af0, v=0x7fffffffdba0) at ../../src/glsl/ir_hv_accept.cpp:116
#12 0x00007ffff65a5505 in visit_list_elements (v=0x7fffffffdba0, l=0xa41a58, statement_list=false)
    at ../../src/glsl/ir_hv_accept.cpp:56
#13 0x00007ffff65a5789 in ir_function::accept (this=0xa41a30, v=0x7fffffffdba0) at ../../src/glsl/ir_hv_accept.cpp:128
#14 0x00007ffff65a5505 in visit_list_elements (v=0x7fffffffdba0, l=0xa3d400, statement_list=true)
    at ../../src/glsl/ir_hv_accept.cpp:56
#15 0x00007ffff65a5426 in ir_hierarchical_visitor::run (this=0x7fffffffdba0, instructions=0xa3d400)
    at ../../src/glsl/ir_hierarchical_visitor.cpp:309
#16 0x00007ffff65c065d in unroll_loops (instructions=0xa3d400, ls=0xa4f3f0, max_iterations=255)
    at ../../src/glsl/loop_unroll.cpp:345
#17 0x00007ffff6591377 in do_common_optimization (ir=0xa3d400, linked=true, uniform_locations_assigned=false, 
    max_unroll_iterations=255, options=0x7ffff53a6eec) at ../../src/glsl/glsl_parser_extras.cpp:1507
#18 0x00007ffff65bd46b in link_shaders (ctx=0x7ffff5385010, prog=0xa30aa0) at ../../src/glsl/linker.cpp:2172
#19 0x00007ffff64f37b7 in _mesa_glsl_link_shader (ctx=0x7ffff5385010, prog=0xa30aa0) at program/ir_to_mesa.cpp:3087
#20 0x00007ffff63f97c0 in link_program (ctx=0x7ffff5385010, program=4) at main/shaderapi.c:873
#21 0x00007ffff63fa592 in _mesa_LinkProgram (programObj=4) at main/shaderapi.c:1333
#22 0x0000000000436ea4 in initProgram() ()
#23 0x00000000004372f1 in begin() ()
#24 0x0000000000438ecb in glf::run(int, char**, glm::detail::tvec2<int, (glm::precision)0> const&, int, int, int) ()
Comment 3 kwahoo2 2014-02-09 13:33:07 UTC
G-truck samples don't work for me too (similar error for ether samples):

./gl-320-primitive-shading 
OpenGL Version Needed 3.2 ( 3.3 Found )
Shader Compiler: error(high) 2: 0:1(1): error: syntax error, unexpected $end
Shader Compiler: error(high) 3: 0:1(1): error: syntax error, unexpected $end
Shader Compiler: error(high) 4: 0:1(1): error: syntax error, unexpected $end
Compiling shader
gl-320/primitive-shading.vert...
0:1(1): error: syntax error, unexpected $end

Running Test
Test Ended


glxinfo | grep OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD TURKS
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.2.0-devel (git-020c43f saucy-oibaf-ppa)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.2.0-devel (git-020c43f saucy-oibaf-ppa)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)


01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Turks XT [Radeon HD 6670/7670]
Comment 4 Török Edwin 2014-02-09 14:05:07 UTC
(In reply to comment #3)
> G-truck samples don't work for me too (similar error for ether samples):
> 
> ./gl-320-primitive-shading 
> OpenGL Version Needed 3.2 ( 3.3 Found )
> Shader Compiler: error(high) 2: 0:1(1): error: syntax error, unexpected $end
> Shader Compiler: error(high) 3: 0:1(1): error: syntax error, unexpected $end
> Shader Compiler: error(high) 4: 0:1(1): error: syntax error, unexpected $end

You need to run it from the source root, like this: 
$ build/build/release/gl-320-primitive-shading

Otherwise it can't find/load the shader, and thats a shortcoming in the samples, not Mesa.
Comment 5 Török Edwin 2014-02-09 14:08:24 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > G-truck samples don't work for me too (similar error for ether samples):
> > 
> > ./gl-320-primitive-shading 
> > OpenGL Version Needed 3.2 ( 3.3 Found )
> > Shader Compiler: error(high) 2: 0:1(1): error: syntax error, unexpected $end
> > Shader Compiler: error(high) 3: 0:1(1): error: syntax error, unexpected $end
> > Shader Compiler: error(high) 4: 0:1(1): error: syntax error, unexpected $end
> 
> You need to run it from the source root, like this: 
> $ build/build/release/gl-320-primitive-shading

build/release/gl-320-primitive-shading
Comment 6 kwahoo2 2014-02-09 14:55:48 UTC
(In reply to comment #5)
> > You need to run it from the source root, like this: 
> > $ build/build/release/gl-320-primitive-shading
> 
> build/release/gl-320-primitive-shading

Right, now the examples works. Except gl-320-primitive-shading 

./build/release/gl-320-primitive-shading 
OpenGL Version Needed 3.2 ( 3.3 Found )
Compiling shader
gl-320/primitive-shading.vert...

Compiling shader
gl-320/primitive-shading.geom...

Compiling shader
gl-320/primitive-shading.frag...

Segmentation fault
Comment 7 Michel Dänzer 2014-02-10 08:12:30 UTC
Looks like a GLSL compiler issue.
Comment 8 Dieter Nützel 2014-02-10 13:12:56 UTC
3.13.2 + geom + UVD IRQ patch
Mesa 10.2.0-devel (git-a487ef8)
LLVM 3.4 stable
RV730 AGP

With R600_DEBUG=nollvm it sometimes runs without crash but empty (black) window and somtimes like this:

/opt/ogl-samples> ./build/release/gl-320-primitive-shading
OpenGL Version Needed 3.2 ( 3.3 Found )
Compiling shader
gl-320/primitive-shading.vert...

Compiling shader
gl-320/primitive-shading.geom...

Compiling shader
gl-320/primitive-shading.frag...

Linking program

Running Test
EE r600_shader.c:345 tgsi_is_supported - unsupported src 0 (dimension 1)
EE r600_shader.c:157 r600_pipe_shader_create - translation from TGSI failed !
EE r600_state_common.c:745 r600_shader_select - Failed to build shader variant (type=2) -22
EE r600_shader.c:345 tgsi_is_supported - unsupported src 0 (dimension 1)
EE r600_shader.c:157 r600_pipe_shader_create - translation from TGSI failed !
EE r600_state_common.c:745 r600_shader_select - Failed to build shader variant (type=2) -22
EE r600_shader.c:345 tgsi_is_supported - unsupported src 0 (dimension 1)
EE r600_shader.c:157 r600_pipe_shader_create - translation from TGSI failed !
EE r600_state_common.c:745 r600_shader_select - Failed to build shader variant (type=2) -22
[-]
Test Ended
Test Began Correctly.
Comment 9 Andreas Boll 2014-02-14 18:49:12 UTC
(In reply to comment #7)
> Looks like a GLSL compiler issue.

Reassigning to glsl-compiler
Comment 10 Dieter Nützel 2014-02-26 14:38:26 UTC
Addendum:

3.14.0-rc4 + drm-radeon-fix-missing-bo-reservation.patch
Mesa 10.2.0-devel (git-54df6a0)
LLVM 3.4 stable
RV730 AGP

With R600_DEBUG=nosb I get this (from time to time):

/opt/ogl-samples> ./build/release/gl-320-primitive-shading
OpenGL Version Needed 3.2 ( 3.3 Found )
Compiling shader
gl-320/primitive-shading.vert...

Compiling shader
gl-320/primitive-shading.geom...

Compiling shader
gl-320/primitive-shading.frag...

Linking program

Running Test
warning: failed to translate tgsi opcode EMIT to LLVM     <<<=== !!!
Speicherschutzverletzung (core dumped)

Core was generated by `./build/release/gl-320-primitive-shading'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xb5a0f1e3 in getElementType (Val=<optimized out>, this=<optimized out>)
    at /usr/src/debug/llvm/include/llvm/IR/DerivedTypes.h:319
319       Type *getElementType() const { return ContainedTys[0]; }

(gdb) bt
#0  0xb5a0f1e3 in getElementType (Val=<optimized out>, this=<optimized out>)
    at /usr/src/debug/llvm/include/llvm/IR/DerivedTypes.h:319
#1  llvm::ExtractElementInst::ExtractElementInst (this=0x891d2e0, Val=<optimized out>, 
    Index=<optimized out>, Name=..., InsertBef=0x0)
    at /usr/src/debug/llvm/lib/IR/Instructions.cpp:1443
#2  0xb5993fad in Twine (this=<optimized out>, Vec=<optimized out>, this=<optimized out>, 
    I=0x891d2e0, Idx=0x8918850, NameStr=..., this=<optimized out>, Str=<optimized out>)
    at /usr/src/debug/llvm/include/llvm/IR/Instructions.h:1554
#3  llvm::IRBuilder<true, llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >::CreateExtractElement (this=0x8927580, Vec=0x8927580, Idx=0x8918850, Name=...)
    at /usr/src/debug/llvm/include/llvm/IR/IRBuilder.h:1354
#4  0xb5990913 in LLVMBuildExtractElement (B=0x0, VecVal=0x0, Index=0x891d2c8, 
    Name=<optimized out>) at /usr/src/debug/llvm/lib/IR/Core.cpp:2416
#5  0xb6d3be8c in ?? () from /usr/lib/dri/updates/r600_dri.so
#6  0xb6d4aeb2 in ?? () from /usr/lib/dri/updates/r600_dri.so
#7  0xb6cb8bbf in ?? () from /usr/lib/dri/updates/r600_dri.so
#8  0xb6d3dff2 in ?? () from /usr/lib/dri/updates/r600_dri.so
#9  0xb6ce4659 in ?? () from /usr/lib/dri/updates/r600_dri.so
#10 0xb6ce6ae6 in ?? () from /usr/lib/dri/updates/r600_dri.so
#11 0xb6cfeca8 in ?? () from /usr/lib/dri/updates/r600_dri.so
#12 0xb6d01cec in ?? () from /usr/lib/dri/updates/r600_dri.so
#13 0xb6c1368a in ?? () from /usr/lib/dri/updates/r600_dri.so
#14 0xb6b88d4a in ?? () from /usr/lib/dri/updates/r600_dri.so
#15 0xb6aa81be in ?? () from /usr/lib/dri/updates/r600_dri.so
#16 0xb6a7509d in ?? () from /usr/lib/dri/updates/r600_dri.so
#17 0xb6a76a3c in ?? () from /usr/lib/dri/updates/r600_dri.so
#18 0xb6a76cc4 in ?? () from /usr/lib/dri/updates/r600_dri.so
#19 0x0807aae4 in display() ()
#20 0x080775a5 in main ()

(gdb) list
314         ContainedTys = &ContainedType;
315         NumContainedTys = 1;
316       }
317
318     public:
319       Type *getElementType() const { return ContainedTys[0]; }
320
321       /// Methods for support type inquiry through isa, cast, and dyn_cast.
322       static inline bool classof(const Type *T) {
323         return T->getTypeID() == ArrayTyID ||

(gdb) info registers 
eax            0x0      0
ecx            0x0      0
edx            0x891d2c8        143774408
ebx            0xb5a73000       -1247334400
esp            0xbf81d3c0       0xbf81d3c0
ebp            0xb5a714f8       0xb5a714f8 <vtable for llvm::ExtractElementInst+8>
esi            0x891d2c8        143774408
edi            0x891d2e0        143774432
eip            0xb5a0f1e3       0xb5a0f1e3 <llvm::ExtractElementInst::ExtractElementInst(llvm::Value*, llvm::Value*, llvm::Twine const&, llvm::Instruction*)+51>
eflags         0x210282 [ SF IF RF ID ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51
Comment 11 Michel Dänzer 2014-02-26 15:07:07 UTC
(In reply to comment #10)
> warning: failed to translate tgsi opcode EMIT to LLVM     <<<=== !!!

The r600g LLVM shader compiler doesn't support geometry shaders yet.

I generally advise against compiling Mesa with --enable-r600-llvm-compiler at this point.

That's not directly related to this bug report though.
Comment 12 Benjamin Bellec 2014-03-18 19:41:45 UTC
I'm not able to reproduce it (tested with RV770 and CYPRESS) with current master Mesa 10.2.0-devel (git-f74cf5f).

gl-320-primitive-sprite and gl-320-primitive-shading just run and close immediately without errors. I don't see any new window, I don't know if it's normal.

Could you retry with these flags:
./autogen.sh --with-gallium-drivers=r600 --with-dri-drivers= --enable-texture-float --disable-dri3 --disable-r600-llvm-compiler --disable-gallium-llvm
Comment 13 Dieter Nützel 2014-03-19 02:24:38 UTC
(In reply to comment #12)
> I'm not able to reproduce it (tested with RV770 and CYPRESS) with current
> master Mesa 10.2.0-devel (git-f74cf5f).

Both do NOT run with current master Mesa 10.2.0-devel (git-651b8ba), here.
See: Re: [Mesa-dev] Mesa git (r600g): OpenGL Error(GL_INVALID_OPERATION): initTexture2D (bisected)

/opt/ogl-samples> ./build/release/gl-320-primitive-sprite
libGL: screen 0 does not appear to be DRI3 capable
libGL: pci id for fd 4: 1002:9495, driver r600
libGL: OpenDriver: trying /usr/lib/dri/updates/tls/r600_dri.so
libGL: OpenDriver: trying /usr/lib/dri/updates/r600_dri.so
libGL: driver does not expose __driDriverGetExtensions_r600(): /usr/lib/dri/updates/r600_dri.so: undefined symbol: __driDriverGetExtensions_r600
libGL: Can't open configuration file /home/dieter/.drirc: No such file or directory.
libGL: Can't open configuration file /home/dieter/.drirc: No such file or directory.
OpenGL Version Needed 3.2 ( 3.3 Found )
OpenGL Error(GL_INVALID_OPERATION): initTexture2D
Running Test
Test Ended

> gl-320-primitive-sprite and gl-320-primitive-shading just run and close
> immediately without errors. I don't see any new window, I don't know if it's
> normal.

It's NOT normal.

With Mesa 10.1.0-final (see above)

gl-320-primitive-sprite
show an orange window with four sprites. With the left mouse button you can zoom in and out and with the right mouse button you can spin all four sprites around. See attachment (gl-320-primitive-sprite.png).

gl-320-primitive-shading
show an empty black window, here.
Maybe someone with a Intel/Mesa or AMD/Nvidia proprietary driver system can try it and send a picture. 

> Could you retry with these flags:
> ./autogen.sh --with-gallium-drivers=r600 --with-dri-drivers=
> --enable-texture-float --disable-dri3 --disable-r600-llvm-compiler
> --disable-gallium-llvm

Tried that. Do NOT help (see above).
Comment 14 Dieter Nützel 2014-03-19 02:25:04 UTC
Created attachment 96024 [details]
gl-320-primitive-sprite.png
Comment 15 Dieter Nützel 2014-03-19 16:29:28 UTC
FWIW, I'm on a pure 32 bit system.

Dieter
Comment 16 Benjamin Bellec 2014-03-20 19:57:35 UTC
(In reply to comment #12)
> I'm not able to reproduce it (tested with RV770 and CYPRESS) with current
> master Mesa 10.2.0-devel (git-f74cf5f).

Forget my comment about RV770, I realized I'm stuck to GL3.0 with it (due to lack of kernel support on my system).

That said, with my CYPRESS, glxinfo say:
OpenGL renderer string: Gallium 0.4 on AMD CYPRESS
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.2.0-devel (git-7125473)
OpenGL core profile shading language version string: 3.30

But when I launch this two gl-320 tests, I got nothing (no error, no window)...

However, if I override GL version envvar, I got this:

$ MESA_GL_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=150 ./build/Release/gl-320-primitive-sprite
OpenGL Version Needed 3.2 ( 3.2 Found )

=> seems to work, I can play with the four pictures, zoom, etc.

$ MESA_GL_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=150 ./build/Release/gl-320-primitive-shading 
OpenGL Version Needed 3.2 ( 3.2 Found )
0:22(34): error: length called on unsized array
0:24(23): error: unsized array index must be constant
0:25(18): error: unsized array index must be constant

Erreur de segmentation (core dumped)

=> I got a black screen during 1 or 2 seconds and then close with a segfault.


Note that I can launch Unigine Valley (which requires GL3.2 or GL3.3 I don't remember) without problem and without overriding the GL version envvar.
Comment 17 Dieter Nützel 2014-04-17 00:51:24 UTC
(In reply to comment #13)
> (In reply to comment #12)
> > I'm not able to reproduce it (tested with RV770 and CYPRESS) with current
> > master Mesa 10.2.0-devel (git-f74cf5f).
> 
> Both do NOT run with current master Mesa 10.2.0-devel (git-651b8ba), here.
> See: Re: [Mesa-dev] Mesa git (r600g): OpenGL Error(GL_INVALID_OPERATION):
> initTexture2D (bisected)
> 
> /opt/ogl-samples> ./build/release/gl-320-primitive-sprite
> libGL: screen 0 does not appear to be DRI3 capable
> libGL: pci id for fd 4: 1002:9495, driver r600
> libGL: OpenDriver: trying /usr/lib/dri/updates/tls/r600_dri.so
> libGL: OpenDriver: trying /usr/lib/dri/updates/r600_dri.so
> libGL: driver does not expose __driDriverGetExtensions_r600():
> /usr/lib/dri/updates/r600_dri.so: undefined symbol:
> __driDriverGetExtensions_r600
> libGL: Can't open configuration file /home/dieter/.drirc: No such file or
> directory.
> libGL: Can't open configuration file /home/dieter/.drirc: No such file or
> directory.
> OpenGL Version Needed 3.2 ( 3.3 Found )
> OpenGL Error(GL_INVALID_OPERATION): initTexture2D
> Running Test
> Test Ended

This one IS SOLVED.
Look, here:
http://lists.freedesktop.org/archives/mesa-dev/2014-April/057699.html
Comment 18 Dieter Nützel 2014-04-17 01:04:34 UTC
(In reply to comment #16)

> $ MESA_GL_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=150
> ./build/Release/gl-320-primitive-shading 
> OpenGL Version Needed 3.2 ( 3.2 Found )
> 0:22(34): error: length called on unsized array
> 0:24(23): error: unsized array index must be constant
> 0:25(18): error: unsized array index must be constant
> 
> Erreur de segmentation (core dumped)
> 
> => I got a black screen during 1 or 2 seconds and then close with a segfault.
> 
> 
> Note that I can launch Unigine Valley (which requires GL3.2 or GL3.3 I don't
> remember) without problem and without overriding the GL version envvar.

Please try current Mesa git and look here:

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

Greetings,
  Dieter
Comment 19 Török Edwin 2014-04-17 07:30:25 UTC
(In reply to comment #18)
> Please try current Mesa git and look here:
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=76394
> 

Thanks, the invalid read is fixed, valgrind shows no errors.
I get a similar output like you in bug #76394, so closing this one.
Comment 20 Benjamin Bellec 2014-04-17 12:55:02 UTC
(In reply to comment #18)
> (In reply to comment #16)
> 
> > $ MESA_GL_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=150
> > ./build/Release/gl-320-primitive-shading 
> > OpenGL Version Needed 3.2 ( 3.2 Found )
> > 0:22(34): error: length called on unsized array
> > 0:24(23): error: unsized array index must be constant
> > 0:25(18): error: unsized array index must be constant
> > 
> > Erreur de segmentation (core dumped)
> > 
> > => I got a black screen during 1 or 2 seconds and then close with a segfault.
> > 
> > 
> > Note that I can launch Unigine Valley (which requires GL3.2 or GL3.3 I don't
> > remember) without problem and without overriding the GL version envvar.
> 
> Please try current Mesa git and look here:
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=76394
> 
> Greetings,
>   Dieter

I will follow bug 76394 since I was in fact not hit by this one (74717).

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.