Bug 75709 - Consider re-enabling glamor on at least R500
Summary: Consider re-enabling glamor on at least R500
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/Radeon (show other bugs)
Version: git
Hardware: All All
: medium normal
Assignee: xf86-video-ati maintainers
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-03 12:19 UTC by Fabio Pedretti
Modified: 2014-03-11 03:29 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Xorg.0.log with glamor on my RV530 (57.42 KB, text/plain)
2014-03-04 13:52 UTC, Fabio Pedretti
no flags Details
glxinfo -l on my RV530 (50.14 KB, text/plain)
2014-03-06 08:06 UTC, Fabio Pedretti
no flags Details

Description Fabio Pedretti 2014-03-03 12:19:11 UTC
This commit disabled glamor on pre-R600:
http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?id=fa83d3d1636c315bc43dd622d407eb058e3ef976

I reverted it and tried glamor on my RV530. It's working fine, only having some corruption with Xv on some video (same as bug #72821 or bug #74811 reported for other chipsets), also gtkperf is slower on Lines and Circles (I'll try again when the 36 patches posted on glamor ML get merged), while other gtkperf tests are the same.

Also according to glamor source it just needs OpenGL 1.3:
http://cgit.freedesktop.org/xorg/driver/glamor/tree/src/glamor.c#n311

So it's working at least fine as >= R600 here, then please consider re-enabling it for R500 at least (the default should still be EXA anyway), it can be useful for testing or when EXA has problems.
Comment 1 Michel Dänzer 2014-03-04 03:45:48 UTC
(In reply to comment #1)
> I reverted it and tried glamor on my RV530. It's working fine, only having
> some corruption with Xv on some video (same as bug #72821 or bug #74811
> reported for other chipsets),

Which glamor version/tree/branch did you try? X -retro fails to start with current glamor Git on my RV350:

 Failed to link: error: shader uses too many varying components (44 > 40)

 (EE) Fatal server error:
 (EE) GLSL link failure

AFAICT this limit is the same for all GPUs supported by r300g.


> also gtkperf is slower on Lines and Circles
> (I'll try again when the 36 patches posted on glamor ML get merged),

They don't affect gtkperf according to my tests with radeonsi. But FWIW they should make core text rendering (e.g. used by xterm and some other terminal emulators by default) faster than with EXA.


> Also according to glamor source it just needs OpenGL 1.3:
> http://cgit.freedesktop.org/xorg/driver/glamor/tree/src/glamor.c#n311

Even if that's still true, r300g advertises OpenGL 2.1 support, and with that glamor uses GLSL shaders which are too complex for the hardware supported by r300g. It might be possible to fix that, but someone would have to put in the effort.
Comment 2 Fabio Pedretti 2014-03-04 13:52:18 UTC
Created attachment 95093 [details]
Xorg.0.log with glamor on my RV530

I am using master git glamor from:
http://cgit.freedesktop.org/xorg/driver/glamor/
currently at: 8ad57c288d5ba6478ac9653e43c10545a6bafae1

No idea what is X -retro, I am using X.Org X Server 1.14.5 (from Ubuntu 13.10), current git mesa (git-15b4ff3) and git ati.

Xorg.0.log is attached.
Comment 3 Michel Dänzer 2014-03-06 06:32:45 UTC
I tracked the problem down to the glamor trapezoid shader. The only way I could avoid it was by building glamor with GLAMOR_TRAPEZOID_SHADER undefined in src/glamor_priv.h. Not sure why you're not running into this... What does

 glxinfo -l|grep VARYING

say for you?
Comment 4 Fabio Pedretti 2014-03-06 08:06:26 UTC
Created attachment 95211 [details]
glxinfo -l on my RV530

It's 40 here:
GL_MAX_VARYING_FLOATS_ARB = 40

Also attaching full output of glxinfo -l.
Comment 5 Michel Dänzer 2014-03-06 08:44:09 UTC
(In reply to comment #4)
> It's 40 here:
> GL_MAX_VARYING_FLOATS_ARB = 40

Same as here (unsurprisingly, as r300g advertises the same value for all GPUs). So if you don't build glamor with GLAMOR_TRAPEZOID_SHADER undefined, I really don't understand why you're not getting the GLSL link failure. :(
Comment 6 Fabio Pedretti 2014-03-06 08:50:30 UTC
Maybe I have a different Xorg version or applications (I am using the default Unity on Ubuntu 13.10) that don't trigger that path?
Comment 7 Michel Dänzer 2014-03-06 09:12:33 UTC
(In reply to comment #6)
> Maybe I have a different Xorg version or applications (I am using the
> default Unity on Ubuntu 13.10) that don't trigger that path?

It happens on X server startup, before any client can connect. I don't see how the Xorg version could matter either. Though one possibility is that the better shader capabilities of R(V)5xx somehow allow the GLSL compiler to stay below the varying limit...
Comment 8 Fabio Pedretti 2014-03-06 09:28:36 UTC
BTW, my glamor has not GLAMOR_TRAPEZOID_SHADER undefined (or anything other special), and here is glamor compile log:
https://launchpadlibrarian.net/168488153/buildlog_ubuntu-saucy-i386.glamor-egl_0.6.0%2Bgit1403060630.cccfea~gd~s_UPLOADING.txt.gz
Comment 9 Marek Olšák 2014-03-06 10:56:02 UTC
R300-R400 supports 2 colors and 8 generic varyings.

R500 supports the same, and if the back-face colors are unused and flat shading is disabled, it reuses unused color outputs as generic varyings, so that it can do 10 generic varyings.

In addition to that, the GLSL compiler implements varying packing, but it's only enabled if the number of supported texture indirections is greater than 8. Therefore, R500 gets the varying packing, but R300 and R400 don't, which can do only 4 texture indirections.

However, this can be easily fixed in the trapezoid shader by combining the float varyings into vec4s. Each float occupies the entire generic slot as if it was vec4.
Comment 10 Marek Olšák 2014-03-06 11:01:37 UTC
For example, change this:

varying float trap_left_x;
varying float trap_left_y;
varying float trap_left_slope;
varying float trap_left_vertical_f;

to this:

varying vec4 trap_left;
#define trap_left_x trap_left.x
#define trap_left_y trap_left.y
#define trap_left_slope trap_left.z
#define trap_left_vertical_f trap_left.w

Etc.
Comment 11 Michel Dänzer 2014-03-11 03:29:54 UTC
commit 515bcf14d514f9dcaaf30fd0bf1ef6dd6ba9a0cd
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Mar 4 12:34:26 2014 +0900

    Allow enabling glamor on R500 (and R300) class 3D engines as well.


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.