Bug 55256

Summary: r600g R600_LLVM=1 bad rendering (light blue instead of grey)
Product: Mesa Reporter: Török Edwin <edwin+bugs>
Component: Drivers/Gallium/r600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: tstellar, vmerlet
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: apitrace
another.trace
bad.png
good.png
bug.shader_test

Description Török Edwin 2012-09-23 20:59:45 UTC
Created attachment 67592 [details]
apitrace

Attached is an apitrace, and screenshots.

Bad behaviour with --enable-r600-llvm-compiler:
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD RV730
OpenGL version string: 3.0 Mesa 9.1-devel (git-fb40f88)
OpenGL shading language version string: 1.30

If you look at the 'bad.png' screenshot you'll see that the 4th column is light blue. It should be grey.
With R600_LLVM=0 the good behaviour is seen: good.png.

See the apitrace for the full shader, here is the relevant bit:
    else if (gl_FragCoord.x < 640)
        color = vec4(1.0f, 1.0f, 1.0f, 1.0f);//white
    [...]
        vec4 color0, color1, color2, color3;
        if (gl_FragCoord.y < 200) {
            color0 = color1 = color2 = color;//75%
   [...]
        } else if (xmod < 55 || xmod >= 105 ||
                   ymod < 75 || ymod >= 125) {
            // real color
            // TODO: buggy on r600g with LLVM?
            gl_FragColor = (color0 + color1 + color2 + color3) / 4.0f;

P.S.: the shader is not optimal, most of the branches could be moved out of it, I haven't tried to minimize the testcase though.
Comment 1 Török Edwin 2012-09-23 21:03:43 UTC
Created attachment 67593 [details]
another.trace

Another apitrace that doesn't use 3.0 features and can thus be replayed with LIBGL_ALWAYS_SOFTWARE too.
The software rendered shows the same (good) behaviour as the R600_LLVM=0.
Note: the color values have a different gamma in this trace.
Comment 2 Török Edwin 2012-09-23 21:03:57 UTC
Created attachment 67594 [details]
bad.png
Comment 3 Török Edwin 2012-09-23 21:04:12 UTC
Created attachment 67595 [details]
good.png
Comment 4 Török Edwin 2012-09-23 21:07:00 UTC
Graphics card type:
01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI RV730 PRO [Radeon HD 4650]

xorg.conf:
Section "Device"
        Identifier  "Radeon"
        Driver      "radeon"
        Option      "ColorTiling2D" "True"
        BusID       "PCI:1:0:0"
EndSection

kernel: Linux debian 3.6.0-rc6 x86_64

Mesa build flags:
./configure --prefix=/opt/xorg --with-driver=dri --with-state-trackers="egl dri" --with-dri-drivers=i965 --with-gallium-drivers="r600 swrast" LLVM_CONFIG=/usr/bin/llvm-config-3.1 --enable-r600-llvm-compiler --enable-openvg --enable-vdpau --enable-glx-tls --enable-shared-glapi --enable-texture-float --enable-egl --enable-gallium-egl --enable-gbm --enable-gallium-gbm --with-egl-platforms=x11,drm,fbdev --enable-gles2

/opt/xorg has xserver, drm, libkms, etc. from git.
Comment 5 Török Edwin 2012-09-23 21:12:14 UTC
Sorry, chose wrong component: bug is about r600g.
Comment 6 Török Edwin 2012-09-24 10:22:10 UTC
Created attachment 67624 [details]
bug.shader_test

A small piglit .shader_test that reproduces the bug:
$ bin/shader_runner -auto bug.shader_test
Probe at (0,0)
  Expected: 0.500000 0.500000 0.500000 1.000000
  Observed: 0.501961 1.000000 1.000000 1.000000
PIGLIT: {'result': 'fail' }

$ R600_LLVM=0 bin/shader_runner -auto bug.shader_test
PIGLIT: {'result': 'pass' }
$ LIBGL_ALWAYS_SOFTWARE=1 bin/shader_runner -auto bug.shader_test
PIGLIT: {'result': 'pass' }
Comment 7 Alex Deucher 2012-09-24 13:06:15 UTC
There are some asic specific shader instruction behaviors for r6xx/r7xx chips that need to be ported to the LLVM backend.  A couple that come to mind:
- Trig functions (see tgsi_setup_trig() in r600_shader.c)
- AR register handling (see load_ar() in r600_asm.c)
Comment 8 GitLab Migration User 2019-09-18 19:00:56 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/419.

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.