Bug 105511

Summary: X fails - bad refresh rate
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Anders Johansson <ajohansson>
Component: X.OrgAssignee: Stefan Dirsch <sndirsch>
Status: RESOLVED FIXED QA Contact: Stefan Dirsch <sndirsch>
Severity: Normal    
Priority: P2 - High CC: eich
Version: Beta 2   
Target Milestone: ---   
Hardware: x86   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: X config file and logs
working config and log from 9.3
X log 10 using 9.3 config
New driver with DPMS patch reverted
New r128 driver with first hunk (OUTREG) applied
New r128 patch by Egbert, which fixes this issue.
fixed r128 driver

Description Anders Johansson 2005-08-18 14:03:18 UTC
On this machine, NLD and 9.3 installed without problems. 10.0 beta 1 and beta 2
fail to configure X, giving only a monitor with the error message "cannot
display this video mode" or "refresh rate out of range".

The monitor (Dell E771d) is correctly identified with correct refresh rates, and
so is the graphics card.

The default proposed by yast/sax is 1280x1024@16, and I've tried 1024x768@16 and
even 800x600@16, but no video mode succeeds.

I'm attaching the hwinfo from --gfxcard and --monitor
Comment 1 Anders Johansson 2005-08-18 14:05:19 UTC
Created attachment 46499 [details]
X config file and logs
Comment 2 Stefan Dirsch 2005-08-18 14:46:23 UTC
Hmm ... nothing obviously wrong here.

(--) R128(0): Virtual size is 1280x1024 (pitch 1280)
(**) R128(0): *Mode "1280x1024": 105.2 MHz, 61.4 kHz, 58.0 Hz
Comment 3 Anders Johansson 2005-08-19 07:22:20 UTC
Created attachment 46637 [details]
working config and log from 9.3
Comment 4 Anders Johansson 2005-08-19 07:23:06 UTC
I installed 9.3 on this machine and X worked. I copied the xorg.conf to 10.0 and
it failed. Attached was the xorg.conf and the X log from 9.3 on this machine
Comment 5 Stefan Dirsch 2005-08-19 08:05:40 UTC
Could you also attach X log from 10.0 with xorg.conf of 9.3? 
Comment 6 Anders Johansson 2005-08-19 08:12:03 UTC
Created attachment 46647 [details]
X log 10 using 9.3 config

here you are
Comment 7 Stefan Dirsch 2005-08-19 09:04:41 UTC
I can't see any relevant differences in the logfile of 9.3 and 10.0 when using 
 xorg.conf of 9.3. The only difference in the r128 driver I can see since 9.3 is
DPMS related.

  Explicitely disable DPMS power states during close screen.
  Fix macro that takes a value and a mask of bits to modify
  to be behave evquvalently if the bits that should remain unchanged
  are set or unset in the value (Bugzilla #3369).

  --> https://bugs.freedesktop.org/show_bug.cgi?id=3369

--- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h       19 Dec 2004 
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h       23 May 2005 
        1.5
@@ -68,7 +68,7 @@
     do {                           \
        CARD32 tmp = INREG(addr);  \
        tmp &= (mask);             \
-       tmp |= (val);              \
+       tmp |= ((val) & ~(mask));  \
        OUTREG(addr, tmp);         \
     } while (0)
 
@@ -84,7 +84,7 @@
     do {                                                                  \
        CARD32 tmp = INPLL(pScrn, addr);                                  \
        tmp &= (mask);                                                    \
-       tmp |= (val);                                                     \
+       tmp |= ((val) & ~(mask));                                         \
        OUTPLL(addr, tmp);                                                \
     } while (0)
 

Could you please copy the r128 driver of 9.3 to your 10.0 installation, so we
can see whether it's a driver problem or a general Xserver problem? Thanks.
Comment 8 Anders Johansson 2005-08-19 09:13:24 UTC
I copied /usr/X11R6/lib/modules/drivers/r128_drv.o from a default 9.3
installation to the 10.0 installation, and restarted X. With this old driver, it
worked perfectly
Comment 9 Stefan Dirsch 2005-08-19 09:17:29 UTC
Oops. I'll revert this patch and attach a new driver for testing.
Comment 10 Stefan Dirsch 2005-08-19 10:26:11 UTC
Created attachment 46668 [details]
New driver with DPMS patch reverted

Please give it a try.
Comment 11 Anders Johansson 2005-08-19 11:11:22 UTC
Tested, and it works, both with the X config from 9.3, the default X config from
10.0 and running sax2. Everything I tested with the new driver appears to work fine
Comment 12 Stefan Dirsch 2005-08-19 11:20:29 UTC
Ok. We need to consider to disable this patch. We might do this for radeon as
well. The same patch ist applied for radeon.
Comment 13 Stefan Dirsch 2005-08-19 12:27:18 UTC
For now I will revert the patch only for r128.
Comment 14 Stefan Dirsch 2005-08-19 13:27:36 UTC
done (fixed for Beta3). I let this open until we decide what do with the radeon
driver.
Comment 15 Stefan Dirsch 2005-08-21 01:49:11 UTC
Egbert, could you please comment on this? I reverted the hunk you can see in 
comment #7. 
Comment 16 Egbert Eich 2005-08-22 10:14:07 UTC
The patch is valid and required for other things. It may have uncovered another
bug elsewhere.
Comment 17 Stefan Dirsch 2005-08-22 10:32:37 UTC
Ok. I have a R128 board for testing available. Not sure I'll be able to
reproduce this problem though. Should we investigate this issue?
Comment 18 Egbert Eich 2005-08-22 13:05:57 UTC
I've got some r128 boards, too, however I may not be able to reproduce this either. 
I've reviewed the code and cannot immediately find a problem. There are some
more likely candidates however I'd need to be able to verify which one is to blame.
Since the display does not sync I assume the OUTPLLP() macro is the one that's
causing trouble. For starters you may want to apply the patch only to the other
macro.
I will try to reproduce this problem later on.
Comment 19 Stefan Dirsch 2005-08-22 13:35:07 UTC
Ok.Thanks.
Comment 20 Stefan Dirsch 2005-08-23 13:13:06 UTC
Created attachment 47193 [details]
New r128 driver with first hunk (OUTREG) applied

Please test again, so we can if it's related to the OUTPLL hunk.
Comment 21 Anders Johansson 2005-08-23 14:39:08 UTC
Tested, and it seems to work well  
Comment 22 Stefan Dirsch 2005-08-23 14:41:45 UTC
Thanks.
Comment 23 Egbert Eich 2005-08-23 17:06:06 UTC
Is it really the OUTREG part that's applied?
Comment 24 Stefan Dirsch 2005-08-23 20:51:06 UTC
Yes. Here it is: 
 
--- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h       19 Dec 2004 
19:4 
9:33 -0000      1.4 
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h       23 May 2005 
09:5 
0:20 -0000      1.5 
@@ -68,7 +68,7 @@ 
     do {                           \ 
        CARD32 tmp = INREG(addr);  \ 
        tmp &= (mask);             \ 
-       tmp |= (val);              \ 
+       tmp |= ((val) & ~(mask));  \ 
        OUTREG(addr, tmp);         \ 
     } while (0) 
  
 
Comment 25 Stefan Dirsch 2005-08-24 12:54:16 UTC
Wow! I can reproduce this problem on my Rage 128 RF (1002:5246) and it went away
when only applying the OUTREG hunk and not the OUTPLL hunk. I took the
reporter's config file for testing this.

(non working) monitor told me: 38 kHz, 36 Hz
(working) monitor tells me: 61 kHz, 60 Hz
Comment 26 Stefan Dirsch 2005-08-24 13:04:28 UTC
BTW, there has been another change before related to this:

--- r128_reg.h	16 Jun 2004 09:43:58 -0000	1.3
+++ r128_reg.h	10 Nov 2004 08:05:38 -0000
@@ -76,7 +76,7 @@
 
 #define OUTPLL(addr, val)                                                 \
     do {                                                                  \
-	OUTREG8(R128_CLOCK_CNTL_INDEX, ((addr) & 0x1f) | R128_PLL_WR_EN); \
+	OUTREG8(R128_CLOCK_CNTL_INDEX, ((addr) & 0x3f) | R128_PLL_WR_EN); \
 	OUTREG(R128_CLOCK_CNTL_DATA, val);                                \
     } while (0)
Comment 27 Stefan Dirsch 2005-08-24 13:40:13 UTC
Unfortunately adding this new hunk above didn't help. :-(
Comment 28 Stefan Dirsch 2005-08-25 10:04:55 UTC
Created attachment 47509 [details]
New r128 patch by Egbert, which fixes this issue.

I'll provide a driver for testing ASAP.
Comment 29 Stefan Dirsch 2005-08-25 13:21:48 UTC
Created attachment 47546 [details]
fixed r128 driver
Comment 30 Stefan Dirsch 2005-08-25 13:22:08 UTC
fixed for Beta4.