Skip to contentSkip to conversation

atyfb expert needed

DISCUSSION Benjamin Herrenschmidt 5 participants 10 messages Feb 11, 2004 – Feb 17, 2004 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

Hi ! I'm calling again for an atyfb expert ;)

The current driver in James tree (with generic lcd support) breaks the display on the LT-G chip of the powerbook wallstreet. I don't have time at the moment to dig into every change (there's a lot).

The "effect" is that the screen appears to be cut in vertical bands, each of them displaying a slightly offseted version of what should be there with some noise near the right edge.

If that symptom rings any bell about what registers can be wrong, that would help me a lot figuring out what's up.

Ben.

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

#1 lore raw
Quoted 6 lines · Benjamin Herrenschmidt

Hi ! I'm calling again for an atyfb expert ;)

The current driver in James tree (with generic lcd support) breaks the display on the LT-G chip of the powerbook wallstreet. I don't have time at the moment to dig into every change (there's a lot).

Quoted 8 lines

The "effect" is that the screen appears to be cut in vertical bands, each of them displaying a slightly offseted version of what should be there with some noise near the right edge.

If that symptom rings any bell about what registers can be wrong, that would help me a lot figuring out what's up.

Ben.

The main guy is Alex kern. There is a DEBUG flag in atyfb_base.c. Set it to #define an send the results to Alex. I CC him.

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

#2 lore raw
In reply to Benjamin Herrenschmidt
Quoted 10 lines · Benjamin Herrenschmidt

The current driver in James tree (with generic lcd support) breaks the display on the LT-G chip of the powerbook wallstreet. I don't have time at the moment to dig into every change (there's a lot).

The "effect" is that the screen appears to be cut in vertical bands, each of them displaying a slightly offseted version of what should be there with some noise near the right edge.

If that symptom rings any bell about what registers can be wrong, that would help me a lot figuring out what's up.

Sounds like a problem with DSP_CONFIG and DSP_ON_OFF.

Check aty_dsp_gt(), either the value of fifo_size or the dsp_* values.

BTW, according to Daniël Mantione the DSP calculations in atyfb have always been wrong (but apparently worked on most machines due to sheer luck ;-), so you may want to compare with aty_dsp_gt() in current 2.4.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click

#3 lore raw
Quoted 9 lines · Geert Uytterhoeven
Quoted 8 lines · Benjamin Herrenschmidt

The current driver in James tree (with generic lcd support) breaks the display on the LT-G chip of the powerbook wallstreet. I don't have time at the moment to dig into every change (there's a lot).

The "effect" is that the screen appears to be cut in vertical bands, each of them displaying a slightly offseted version of what should be there with some noise near the right edge.

Quoted 6 lines
Quoted 2 lines

If that symptom rings any bell about what registers can be wrong, that would help me a lot figuring out what's up.

Sounds like a problem with DSP_CONFIG and DSP_ON_OFF.

Check aty_dsp_gt(), either the value of fifo_size or the dsp_* values.

Please take a look at the fifo size in the table of chips in atyfb_base.c. That value was set incorrectly in 2.4 too.

Quoted 3 lines

BTW, according to Daniël Mantione the DSP calculations in atyfb have always been wrong (but apparently worked on most machines due to sheer luck ;-), so you may want to compare with aty_dsp_gt() in current 2.4.

Well, wrong in the sense that the calculations they make are very different from both Ati's example code and XFree86 code. The original author (unknown to me at this time) might have had reasons to code it like this, but it looks realistic that he simply tried to modify it till it worked for him.

The code in 2.4 is a slightly size optimized version of the XFree86 code from Marc Aurele la France.

Daniël

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click

#4 lore raw
Quoted 10 lines · On Thu, 12 Feb 2004, [ISO-8859-1] Daniël Mantione wrote:
Quoted 3 lines · Geert Uytterhoeven

BTW, according to Daniël Mantione the DSP calculations in atyfb have always been wrong (but apparently worked on most machines due to sheer luck ;-), so you may want to compare with aty_dsp_gt() in current 2.4.

Well, wrong in the sense that the calculations they make are very different from both Ati's example code and XFree86 code. The original author (unknown to me at this time) might have had reasons to code it like this, but it looks realistic that he simply tried to modify it till it worked for him.

I remember starting from ATI sample code, but that didn't work well, and modifying that based on info from the XFree86 code, until it worked.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click

#5 lore raw
In reply to Geert Uytterhoeven

Am Donnerstag, 12. Februar 2004 10:29 schrieb Geert Uytterhoeven:

Quoted 16 lines · Benjamin Herrenschmidt
Quoted 10 lines

The current driver in James tree (with generic lcd support) breaks the display on the LT-G chip of the powerbook wallstreet. I don't have time at the moment to dig into every change (there's a lot).

The "effect" is that the screen appears to be cut in vertical bands, each of them displaying a slightly offseted version of what should be there with some noise near the right edge.

If that symptom rings any bell about what registers can be wrong, that would help me a lot figuring out what's up.

Sounds like a problem with DSP_CONFIG and DSP_ON_OFF.

Check aty_dsp_gt(), either the value of fifo_size or the dsp_* values.

Quoted 8 lines

BTW, according to Daniël Mantione the DSP calculations in atyfb have always been wrong (but apparently worked on most machines due to sheer luck ;-), so you may want to compare with aty_dsp_gt() in current 2.4.

Gr{oetje,eeting}s,

Geert

Hi,
mach64_ct.c(where aty_dsp_gt is) from James tree should be identical with Daniel'S 2.4 tree. If not, please send me the diff.

Regards Alex

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click

#6 lore raw
Quoted 4 lines

Hi,
mach64_ct.c(where aty_dsp_gt is) from James tree should be identical with Daniel'S 2.4 tree. If not, please send me the diff.

Is Daniel's latest version in current 2.4 or is there another source for his patches ?

Ben.

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

#7 lore raw

Am Samstag, 14. Februar 2004 00:20 schrieb Benjamin Herrenschmidt:

Quoted 12 lines
Quoted 3 lines

Hi,
mach64_ct.c(where aty_dsp_gt is) from James tree should be identical with Daniel'S 2.4 tree. If not, please send me the diff.

Is Daniel's latest version in current 2.4 or is there another source for his patches ?

Ben.

Quoted 9 lines

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Linux-fbdev-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

I sync mach64_ct.c with Daniel sometime. It can be, that I'm yet out of sync, sorry.

Regards Alex

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

#8 lore raw
Quoted 7 lines · Alexander Kern

Am Samstag, 14. Februar 2004 00:20 schrieb Benjamin Herrenschmidt:

Quoted 6 lines
Quoted 3 lines

Hi,
mach64_ct.c(where aty_dsp_gt is) from James tree should be identical with Daniel'S 2.4 tree. If not, please send me the diff.

Is Daniel's latest version in current 2.4 or is there another source for his patches ?

Ok. Comparing 2.4.24 & 2.6.3/fbdev to XFree driver, it seems that 2.6.3/fbdev matches XFree more closely.... Except that we are missing the FIFO_24 attribute for the LT-G chip.

Fixing that leads to slightly less crapy display, but still unreadable... until I figured out that acceleration (imageblit more precisely) has broken endianness...

This kludge fixes it for me (maybe incorrect, just a quick fix) :

@@ -419,9 +425,9 @@

                }
        } else {
                u32 *pbitmap;

- for(pbitmap = (u32*)(image->data); dwords; dwords--, pbitmap++) {
- wait_for_fifo(1, par);
- aty_st_le32(HOST_DATA0, *pbitmap, par);
+ for (pbitmap = (u32*)(image->data); dwords; dwords--, pbitmap++) {
+ wait_for_fifo(2, par);

+                       aty_st_le32(HOST_DATA0, le32_to_cpup(pbitmap), par);
                }

_BUT_ then, I get a lockup when reaching the end of the screen... Apparently, it locks up when drawin the last line, not sure if it did a scroll yet or not. I'm playing with the accel fifo a bit, but that's definitely a regression.

Ben.

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

#9 lore raw

Ok, that patch makes it back working for me based on the version in James fbdev tree.

I don't know _WHY_, but I couldn't get it to not lockup without adding the to wait_for_idle after the fillrect & copyarea.

James, please apply.

Ben.

===== drivers/video/aty/mach64_accel.c 1.12 vs edited =====

drivers/video/aty/mach64_accel.c +9 -3
@@ -186,7 +186,7 @@
 	wait_for_fifo(2, par);
 	aty_st_le32(DST_Y_X, (x << 16) | y, par);
 	aty_st_le32(DST_HEIGHT_WIDTH, (width << 16) | height, par);
-	par->blitter_may_be_busy = 1;
+       	par->blitter_may_be_busy = 1;
 }
 
 void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
@@ -236,6 +236,8 @@
 	aty_st_le32(SRC_HEIGHT1_WIDTH1, (width << 16) | area->height, par);
 	aty_st_le32(DST_CNTL, direction | rotation, par);
 	draw_rect(dx, dy, width, area->height, par);
+
+	wait_for_idle(par);
 }
 
 void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
@@ -274,6 +276,8 @@
 		    DST_LAST_PEL | DST_Y_TOP_TO_BOTTOM |
 		    DST_X_LEFT_TO_RIGHT | rotation, par);
 	draw_rect(dx, rect->dy, width, rect->height, par);
+
+	wait_for_idle(par);
 }
 
 void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
@@ -419,9 +423,9 @@
 		}
 	} else {
 		u32 *pbitmap;
-		for(pbitmap = (u32*)(image->data); dwords; dwords--, pbitmap++) {
+		for (pbitmap = (u32*)(image->data); dwords; dwords--, pbitmap++) {
 			wait_for_fifo(1, par);
-			aty_st_le32(HOST_DATA0, *pbitmap, par);
+			aty_st_le32(HOST_DATA0, le32_to_cpup(pbitmap), par);
 		}
 	}
 
@@ -430,4 +434,6 @@
 	/* restore pix_width */
 	wait_for_fifo(1, par);
 	aty_st_le32(DP_PIX_WIDTH, pix_width_save, par);
+
+	wait_for_idle(par);
 }

===== drivers/video/aty/atyfb_base.c 1.39 vs edited =====

drivers/video/aty/atyfb_base.c +1 -1
@@ -343,7 +343,7 @@
 
 	/* Mach64 LT */
 	{ 0x4c54, 0x4c54, 0x00, 0x00, m64n_lt, 135, 63, 63, M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP },
-	{ 0x4c47, 0x4c47, 0x00, 0x00, m64n_ltg, 230, 63, 63, M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_EXTRA_BRIGHT | M64F_LT_SLEEP | M64F_G3_PB_1024x768 },
+	{ 0x4c47, 0x4c47, 0x00, 0x00, m64n_ltg, 230, 63, 63, M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_FIFO_24 | M64F_EXTRA_BRIGHT | M64F_LT_SLEEP | M64F_G3_PB_1024x768 },
 
 	/* Mach64 GTC (3D RAGE PRO) */
 	{ 0x4742, 0x4742, 0x00, 0x00, m64n_gtc_ba, 230, 100, 100, M64F_GT | M64F_INTEGRATED | M64F_RESET_3D | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_EXTRA_BRIGHT },

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click