Bug 3304

Summary: [PATCH] - trident cyberblade FIFO status check
Product: xorg Reporter: Laurence Darby <ldarby>
Component: Driver/TridentAssignee: Alan Hourihane <alanh>
Status: RESOLVED WONTFIX QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high CC: erik.andren, seg
Version: 6.8.2Keywords: patch
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Attachtment of patch none

Description Laurence Darby 2005-05-16 11:44:11 UTC
Hi,

I was getting the audio problems described here:
www.alsa-project.org/misc/vgakills.txt

It's caused by writing to a FIFO without checking if it's full or not, and
if it is full, the PCI bus locks up for long enough to damage the audio
stream to the sound card.  I've fixed it for the trident cyberblade chip.

I basically made guesses where the checks should go, as if they go before
every single BLADE_OUT(), then X wont start. It works for me, but consider
it a draft.  I called the new function BladeSync_unsafe(), because it's
based on BladeSync() but doesn't check for timeouts or other stuff.

btw, There were recent posts on the xorg mailing list about the CyberBladeXP4 
not being accelerated, is it possible the problems are related?

Laurence


--- old/xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c    2004-07-
30 21:30:55.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c        2005-05-
14 23:47:27.000000000 +0100
@@ -41,6 +41,10 @@
 #include "xaalocal.h"

 static void BladeSync(ScrnInfoPtr pScrn);
+static void BladeSync_unsafe(ScrnInfoPtr pScrn);
+
+static int busy;
+
 #if 0
 static void BladeSetupForSolidLine(ScrnInfoPtr pScrn, int color,
                                int rop, unsigned int planemask);
@@ -270,6 +274,16 @@
     }
 }

+
+static void
+BladeSync_unsafe(ScrnInfoPtr pScrn)
+{
+       TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
+       BLADEBUSY(busy);
+       while (busy != 0) { BLADEBUSY(busy); };
+}
+
+
 static void
 BladeSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
                                int xdir, int ydir, int rop,
@@ -292,6 +306,7 @@
        pTrident->BltScanDirection |= 1<<5;
     }
 #endif
+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2148, XAAGetCopyROP(rop));
 }

@@ -304,6 +319,7 @@

     if (pTrident->Clipping) clip = 1;

+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2144, 0xE0000000 | 1<<19 | 1<<4 | 1<<2 | pTrident-
>BltScanDirection | clip);

     if (pTrident->BltScanDirection) {
@@ -470,6 +486,7 @@
     TRIDENTPtr pTrident = TRIDENTPTR(pScrn);

     REPLICATE(color);
+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2160, color);
     BLADE_OUT(0x2148, XAAGetCopyROP(rop));
     pTrident->BltScanDirection = 0;
@@ -487,6 +504,7 @@
 {
     TRIDENTPtr pTrident = TRIDENTPTR(pScrn);

+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2144, 0x20000000 | pTrident->BltScanDirection | 1<<19 | 1<<4 | 
2<<2 | (pTrident->Clipping ? 1:0));
     BLADE_OUT(0x2108, y<<16 | x);
     BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff));
@@ -538,6 +556,7 @@
     TRIDENTPtr pTrident = TRIDENTPTR(pScrn);

     pTrident->BltScanDirection = 0;
+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2148, XAAGetCopyROP(rop));
     if (bg == -1) {
        pTrident->BltScanDirection |= 2<<19;
@@ -567,6 +586,7 @@
     TRIDENTPtr pTrident = TRIDENTPTR(pScrn);

     if (skipleft) BladeSetClippingRectangle(pScrn,x+skipleft,y,(x+w-1),(y+h-1)
);
+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2144, 0xE0000000 | pTrident->BltScanDirection | 1<<4 | 
(skipleft ? 1 : 0));
     BLADE_OUT(0x2108, (y&0xfff)<<16 | (x&0xfff));
     BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff));
@@ -580,13 +600,14 @@
 {
     TRIDENTPtr pTrident = TRIDENTPTR(pScrn);

-    BladeSync(pScrn);
+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2148, XAAGetPatternROP(rop));

     if (bg == -1) {
     REPLICATE(fg);
     BLADE_OUT(0x216C, 0x80000000 | 1<<30);
     BLADE_OUT(0x216C, 0x80000000 | 1<<28 | 1<<30);
+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2170, patternx);
     BLADE_OUT(0x2170, patterny);
     BLADE_OUT(0x2174, fg);
@@ -598,6 +619,7 @@
     REPLICATE(bg);
     BLADE_OUT(0x216C, 0x80000000);
     BLADE_OUT(0x216C, 0x80000000 | 1<<28);
+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2170, patternx);
     BLADE_OUT(0x2170, patterny);
     BLADE_OUT(0x2174, fg);
@@ -623,6 +645,7 @@
     int clip = 0;

     if (pTrident->Clipping) clip = 1;
+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2144, 0x20000000 | pTrident->BltScanDirection | 7<<12 | 1<<4 | 
1<<19 | 2<<2 | clip);
     BLADE_OUT(0x2108, y<<16 | x);
     BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff));
@@ -677,6 +700,7 @@
 ){
     TRIDENTPtr pTrident = TRIDENTPTR(pScrn);

+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2148, XAAGetCopyROP(rop));
     pTrident->BltScanDirection = 0;
 #if 0
@@ -696,6 +720,7 @@
     TRIDENTPtr pTrident = TRIDENTPTR(pScrn);

     if (skipleft) BladeSetClippingRectangle(pScrn,x+skipleft,y,(x+w-1),(y+h-1)
);
+    BladeSync_unsafe(pScrn);
     BLADE_OUT(0x2144, 0xE0000000 | 1<<19 | 1<<4 | pTrident->BltScanDirection | 
(skipleft ? 1 : 0));
     BLADE_OUT(0x2108, y<<16 | (x&0xfff));
     BLADE_OUT(0x210C, ((y+h-1)&0xfff)<<16 | ((x+w-1)&0xfff));
Comment 1 Laurence Darby 2005-05-28 09:42:53 UTC
Created attachment 2788 [details] [review]
Attachtment of patch

This is the same as the patch in the comments, but hopefully isn't mangled by
line wrapping.
Comment 2 Erik Andren 2006-04-18 05:07:48 UTC
Adding patch keyword
Comment 3 Daniel Stone 2007-02-27 01:26:41 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 4 Matt Turner 2010-12-03 13:48:37 UTC
I sent this patch to xorg-devel@lists.x.org for review. In the future, send patches directly to the mailing list, so they don't get lost in bugzilla.

I'm going to close this bug as it's not doing us any good.
Comment 5 Laurence Darby 2010-12-03 17:26:01 UTC
WTF? 

I added it to bugzilla so it wouldn't get lost in the mailing list, which it is now. My hardware is still chugging along but as a headless server, no longer running X, otherwise I would reopen this.
Comment 6 Julien Cristau 2010-12-04 04:36:34 UTC
reopening.
Comment 7 Matt Turner 2010-12-04 07:51:50 UTC
(In reply to comment #5)
> WTF? 
> 
> I added it to bugzilla so it wouldn't get lost in the mailing list, which it is
> now. My hardware is still chugging along but as a headless server, no longer
> running X, otherwise I would reopen this.

The point is, people don't care about trident hardware. You've got to ping people to get the patch applied. If you want your 2007 patch applied then you needed to send it to the mailing list, and if you didn't, then what's the point of having the bug report open?
Comment 8 Laurence Darby 2010-12-04 08:52:25 UTC
You're completely right, I should have done something about this, and I agree there's no point having this bug open if it's not going anywhere. Just that if I were in your position,  I would have pinged this bug, and if I didn't respond then close it as WONTFIX, as it's not actually INVALID, like bug 11223 :)

Julien, you reopened it, do you want this fixed?  It'll be up to you to do so, otherwise just close it again.
Comment 9 Laurence Darby 2010-12-04 08:58:51 UTC
Didn't mean to change status then at all, changing to WONTFIX now...

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.