Subject: Re: Problems with new radeonfb and XFree86
To: Michael Lorenz <macallan@netbsd.org>
From: Johan =?iso-8859-1?Q?Wall=E9n?= <johan.wallen+lists@tkk.fi>
List: port-macppc
Date: 11/19/2006 01:22:24
Hello,
Michael Lorenz <macallan@netbsd.org> writes:
> Argh, I knew I forgot something.
> The original radeonfb didn't allow mmap()ing any PCI resources, so I
> added support for that but made it optional to avoid breaking the
> behaviour the author intended.
> So what's missing in GENERIC is
> options RADEONFB_MMAP_BARS
> then X should Just Work and radeonfb should restore the video mode when
> X exits so the console should be usable again.
With that option, X outputs a little bit more information before it
fails:
(II) Setting vga for screen 0.
(II) RADEON(0): MMIO registers at 0xb0000000
(WW) xf86EnableIO 3
(II) xf86EnableIO: ffffffff
(WW) Can't map IO space!
Fatal server error:
xf86MapVidMem: could not mmap screen [s=10000,a=b0000000] (Invalid argument)
(The last two lines before the `Fatal server error:' did not appear
witout options RADEONFB_MMAP_BARS.)
In case it matters, the patch for radeon_driver.c I use is:
Index: radeon_driver.c
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v
retrieving revision 1.10
diff -u -r1.10 radeon_driver.c
--- radeon_driver.c 18 Mar 2005 14:55:14 -0000 1.10
+++ radeon_driver.c 18 Nov 2006 23:00:39 -0000
@@ -1824,7 +1824,7 @@
break;
default:
pll->reference_freq = 2700;
- pll->reference_div = 67;
+ pll->reference_div = 12;
pll->xclk = 16615;
break;
}
@@ -4854,9 +4854,9 @@
OUTREGP(RADEON_CRTC_EXT_CNTL,
restore->crtc_ext_cntl,
- RADEON_CRTC_VSYNC_DIS |
- RADEON_CRTC_HSYNC_DIS |
- RADEON_CRTC_DISPLAY_DIS);
+ ~(RADEON_CRTC_VSYNC_DIS |
+ RADEON_CRTC_HSYNC_DIS |
+ RADEON_CRTC_DISPLAY_DIS));
OUTREGP(RADEON_DAC_CNTL,
restore->dac_cntl,
@@ -4926,6 +4926,7 @@
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
unsigned long tmp;
+ int i;
OUTREG(RADEON_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp);
OUTREG(RADEON_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp);
@@ -4937,6 +4938,12 @@
OUTREG(RADEON_FP_VERT_STRETCH, restore->fp_vert_stretch);
OUTREG(RADEON_FP_GEN_CNTL, restore->fp_gen_cntl);
+ for (i = 0; i < 8; i++) {
+ OUTREG(RADEON_SURFACE0_LOWER_BOUND + 0x10*i, 0);
+ OUTREG(RADEON_SURFACE0_UPPER_BOUND + 0x10*i, 0x1f);
+ OUTREG(RADEON_SURFACE0_INFO + 0x10*i, 0);
+ }
+
/* old AIW Radeon has some BIOS initialization problem
* with display buffer underflow, only occurs to DFP
*/
@@ -5971,9 +5978,7 @@
/* Define CRTC registers for requested video mode */
static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save,
DisplayModePtr mode, RADEONInfoPtr info)
-{
- unsigned char *RADEONMMIO = info->MMIO;
-
+{
int format;
int hsync_start;
int hsync_wid;
@@ -6084,7 +6089,7 @@
: 0));
save->crtc_offset = 0;
- save->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL);
+ save->crtc_offset_cntl = 0;
save->crtc_pitch = (((pScrn->displayWidth * pScrn->bitsPerPixel) +
((pScrn->bitsPerPixel * 8) -1)) /
===================================================================
I have no clue what it actually does -- I copied it from a bug report
for XFree86 (or was it Xorg?), and it just seems to get X working on
Radeon Mobility 9700.
When radeonfb attaches, it messes up the console completely for a
moment (strange colours, and it seems like many small copies of the
console are displayed). After that, everything looks normal.
(The console *is* usable after X fails, which was not the case last
year.)
Anyway, thanks for your effort.
-- Johan