Bug 28606

Summary: [r300g]: Compiz focus blur effect does not work. (causes black windows instead)
Product: DRI Reporter: Scott Moreau <oreaus>
Component: DRM/RadeonAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: MostAwesomedude
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
The output with RADEON_DEBUG=fp
none
Proposed fix
none
compiz crash backtrace
none
Possible Fix.
none
compiz crash
none
Final patch none

Description Scott Moreau 2010-06-18 14:48:30 UTC
Expected: Focus Blur effect

Actual: Windows that should be blurred are black and the following is output:

r300 FP: Compiler Error:
r300_fragprog_emit.c::begin_tex(): Too many texture indirections
Using a dummy shader instead.
If there's an 'unknown opcode' message, please file a bug report and attach this log.
Comment 1 Scott Moreau 2010-06-18 14:56:05 UTC
Created attachment 36364 [details]
The output with RADEON_DEBUG=fp
Comment 2 Scott Moreau 2010-06-18 14:58:11 UTC
The is with a Radeon 9600 rv350, and fglrx used to do this effect fine on the same card.
Comment 3 Corbin Simpson 2010-07-03 13:57:12 UTC
Looks like the problematic shader should fit just fine. Deserves a closer look.
Comment 4 Marek Olšák 2010-07-03 16:34:57 UTC
The real problem with the r300 compiler is scheduling of TEX blocks, which is done against the r300 hardware (r500 is ok here). I've had a closer look at a shader from etqw which creates about 10 TEX blocks on r300 even though there are NO texture indirections. The instructions just have wrong ordering and that is the only reason the shader doesn't fit in hardware.
Comment 5 Tom Stellard 2010-07-04 16:54:34 UTC
(In reply to comment #4)
> The real problem with the r300 compiler is scheduling of TEX blocks, which is
> done against the r300 hardware (r500 is ok here). I've had a closer look at a
> shader from etqw which creates about 10 TEX blocks on r300 even though there
> are NO texture indirections. The instructions just have wrong ordering and that
> is the only reason the shader doesn't fit in hardware.

I think this bug is slightly different from the problem you are seeing with etqw.  The problem here is that the compiler is handed several TEX blocks and can't combine them into a single block.  It sounds like the problem with etqw is the same as https://bugs.freedesktop.org/show_bug.cgi?id=25109 where the compiler receives a large TEX block and can't keep all the instructions together.

A possible fix for this bug is to do some kind of register renaming before the scheduling.  Even though the TEX instructions are independent of each other, the scheduler can't schedule them together because they all write to the same register.  If each destination register for these TEX instructions were renamed to something unique, I think the scheduler would schedule them correctly.
Comment 6 Marek Olšák 2010-07-05 09:30:15 UTC
(In reply to comment #5)
> I think this bug is slightly different from the problem you are seeing with
> etqw.  The problem here is that the compiler is handed several TEX blocks and
> can't combine them into a single block.  It sounds like the problem with etqw
> is the same as https://bugs.freedesktop.org/show_bug.cgi?id=25109 where the
> compiler receives a large TEX block and can't keep all the instructions
> together.
> 
> A possible fix for this bug is to do some kind of register renaming before the
> scheduling.  Even though the TEX instructions are independent of each other,
> the scheduler can't schedule them together because they all write to the same
> register.  If each destination register for these TEX instructions were renamed
> to something unique, I think the scheduler would schedule them correctly.

You're right that the bug I was talking about is different from this one, but it's also different from 25109. My respond continues here:
https://bugs.freedesktop.org/show_bug.cgi?id=28624#c2
Comment 7 Tom Stellard 2010-07-05 16:28:11 UTC
Created attachment 36773 [details] [review]
Proposed fix

Can you try this patch and post your RADEON_DEBUG=fp output again.
Comment 8 Scott Moreau 2010-07-05 18:06:14 UTC
Created attachment 36774 [details]
compiz crash backtrace

It crashes in the driver. Here is the bt.
Comment 9 Tom Stellard 2010-07-07 11:34:27 UTC
Created attachment 36839 [details] [review]
Possible Fix.

Can you try again with this patch.
Comment 10 Scott Moreau 2010-07-07 13:15:31 UTC
Created attachment 36845 [details]
compiz crash

(In reply to comment #9)
> Created an attachment (id=36839) [details]
> Possible Fix.
> 
> Can you try again with this patch.

This patch works, but it only worked the first time I tried it. Since restarting compiz, it crashes after falling back to software routines for whatever reason. It doesn't matter if the effect is enabled at (compiz) runtime or if it's disabled at runtime then enabled after compiz has fully started. I have attached the bt.
Comment 11 Scott Moreau 2010-07-07 13:30:54 UTC
(In reply to comment #9)
> Created an attachment (id=36839) [details]
> Possible Fix.
> 
> Can you try again with this patch.

(In reply to comment #10)
> Created an attachment (id=36845) [details]
> compiz crash
> 
> (In reply to comment #9)
> > Created an attachment (id=36839) [details] [details]
> > Possible Fix.
> > 
> > Can you try again with this patch.
> 
> This patch works, but it only worked the first time I tried it.

Because I failed to use the gallium driver. This bt is from classic mesa and can be ignored.
Comment 12 Tom Stellard 2010-07-08 14:49:19 UTC
Created attachment 36891 [details] [review]
Final patch

I cleaned up the old patch a little bit, can you confirm that this one still works.
Comment 13 Tom Stellard 2010-07-08 21:39:09 UTC
Fix in mesa git master commit: 8a8e311d8c3c60982d101826a4aa013672730e6c

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.