Skip to contentSkip to conversation

URGENT: status of atyfb

DISCUSSION Benjamin Herrenschmidt 3 participants 7 messages Aug 2, 2004 – Aug 6, 2004 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

Hi !

I'm having more and more pain with atyfb at this point. I really need the changes that bring the pci_driver (and new PM callbacks) so I can properly work on these.

However, bringing just that change from the fbdev tree to the main tree is incredibly painful due to the major amount of changes that went into this driver.

So can somebody show up and tell me what is the status of this driver as it is currently in the fbdev-2.5 bk tree and if that stuff can actually be sent upstream ASAP or not ?

I don't feel like re-doing just the pci_driver changes, did it once, was painful enough, but on the other hand, this driver has been drifting away from mainstream for ages, which is simply not acceptable.

Ben.

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com

#1 lore raw

Ok, I built an upstream tree with just the new atyfb in, and it breaks on the wallstreet powerbook (LT-G) here. I'm not sure what is wrong at this point, I'd say the clock stuff is incorrectly calculated.

On PPC, you do not have access to BIOS tables. So driver starts with blowing up since the code for retreiving that from BIOS is unconditional (it should be X86 only).

I disabled that, but then, the default values (which are the same as the old driver afaik) don't seem to be enough anymore to produce a correct output.

Ben.

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com

#2 lore raw

Am Montag, 2. August 2004 07:21 schrieb Benjamin Herrenschmidt:

Quoted 8 lines

Ok, I built an upstream tree with just the new atyfb in, and it breaks on the wallstreet powerbook (LT-G) here. I'm not sure what is wrong at this point, I'd say the clock stuff is incorrectly calculated.

On PPC, you do not have access to BIOS tables. So driver starts with blowing up since the code for retreiving that from BIOS is unconditional (it should be X86 only).

Quoted 5 lines

I disabled that, but then, the default values (which are the same as the old driver afaik) don't seem to be enough anymore to produce a correct output.

Ben.

Hi, I do not have any information or hardware about PPC. Should it own something like OpenFirmware? In this case it is possible to read clock information from this.

I found, that we change a little behaviour. Please give a try for this patch...

Regards Alex

atyfb_base.c.ppc renamed from atyfb_base.c +1 -1
@@ -336,7 +336,7 @@
 
 #define ATI_CHIP_264GTB    (ATI_MODERN_SET) 
 /*#define ATI_CHIP_264GTDVD  ?*/
-#define ATI_CHIP_264LTG    (ATI_MODERN_SET)
+#define ATI_CHIP_264LTG    (M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP | M64F_EXTRA_BRIGHT)
 
 #define ATI_CHIP_264GT2C   (ATI_MODERN_SET | M64F_HW_TRIPLE)
 #define ATI_CHIP_264GTPRO  (ATI_MODERN_SET | M64F_HW_TRIPLE | M64F_FIFO_32 | M64F_RESET_3D)
#3 lore raw
Quoted 4 lines

Hi, I do not have any information or hardware about PPC. Should it own something like OpenFirmware? In this case it is possible to read clock information from this.

On some models, yes, on some no. Older machines have a firmware that won't tell you anything, the MacOS driver back then was hard coding the values.

Anyway, the clocks are ok, apparently (maybe not the engine one though, see later), the problem was that the DLL magic was reverted for the LT-G, plus some minor issues with the driver blowing up on non-BIOS machines that I can fix.

The engine tends to lockup quickly though, I'll do experiments.

Quoted 2 lines

I found, that we change a little behaviour. Please give a try for this patch...

Your patch seem to address the DLL issue, I did that too, fixes the display, I'll toy around and let you know.

Also, when just dropping the existing driver into the current linus tree, the cursor code is blowing up, I don't know why yet, I suppose some changes to the common code in the fbdev tree. I'll have a look.

I really want this new driver to be sent upstream ASAP. What I may do is once I get it working well enough, I'll send it to andrew for the -mm tree and leave it there for a while to get it properly tested.

Ben.

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com

#4 lore raw
Quoted 4 lines · Benjamin Herrenschmidt

Also, when just dropping the existing driver into the current linus tree, the cursor code is blowing up, I don't know why yet, I suppose some changes to the common code in the fbdev tree. I'll have a look.

I had (probably) the same oops when using the driver from bk on 2.6.5-mm6. Alex's latest patch fixed it for me.

On a somewhat related note...
I'd like to know if my LT LCD register access patch works correctly. It should allow the generic LCD code to work on LT. It's included in Alex's latest patch. But since parsing the BIOS is out of the question you'd have to hardcode the LCD parameters. Could you test it?

Signature · 10 lines
Ville Syrjälä
[email protected]
http://www.sci.fi/~syrjala/


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
#5 lore raw
In reply to Benjamin Herrenschmidt

Am Dienstag, 3. August 2004 23:25 schrieb Benjamin Herrenschmidt:

Quoted 25 lines
Quoted 3 lines

Hi, I do not have any information or hardware about PPC. Should it own something like OpenFirmware? In this case it is possible to read clock information from this.

On some models, yes, on some no. Older machines have a firmware that won't tell you anything, the MacOS driver back then was hard coding the values.

Anyway, the clocks are ok, apparently (maybe not the engine one though, see later), the problem was that the DLL magic was reverted for the LT-G, plus some minor issues with the driver blowing up on non-BIOS machines that I can fix.

The engine tends to lockup quickly though, I'll do experiments.

Quoted 2 lines

I found, that we change a little behaviour. Please give a try for this patch...

Your patch seem to address the DLL issue, I did that too, fixes the display, I'll toy around and let you know.

Also, when just dropping the existing driver into the current linus tree, the cursor code is blowing up, I don't know why yet, I suppose some changes to the common code in the fbdev tree. I'll have a look.

Quoted 5 lines

I really want this new driver to be sent upstream ASAP. What I may do is once I get it working well enough, I'll send it to andrew for the -mm tree and leave it there for a while to get it properly tested.

Ben.

Hi, here a snapshot from my tree over 2.6.7 + js3

Changes:

revert SDRAM_MAGIC_PLL to old behaviour
do a "from BIOS" initialisation only by __i386__

Regards
Alex

drivers/video/aty/atyfb.h +25 -3
diff -ur -X patches/exclude linux-2.6.7.js3/drivers/video/aty/atyfb.h linux-2.6.7.ak/drivers/video/aty/atyfb.h
@@ -3,6 +3,8 @@
  */
 
 #include <linux/config.h>
+#include <linux/spinlock.h>
+#include <linux/wait.h>
     /*
      *  Elements of the hardware specific atyfb_par structure
      */
@@ -30,9 +32,18 @@
 	u32 shadow_h_sync_strt_wid;
 	u32 shadow_v_tot_disp;
 	u32 shadow_v_sync_strt_wid;
+	u32 lcd_gen_cntl;
+	u32 lcd_config_panel;
+	u32 lcd_index;
 #endif
 };
 
+struct aty_interrupt {
+	wait_queue_head_t wait;
+	unsigned int count;
+	int pan_display;
+};
+
 struct pll_info {
 	int pll_max;
 	int pll_min;
@@ -116,6 +127,7 @@
 
 struct atyfb_par {
 	struct aty_cmap_regs *aty_cmap_regs;
+	struct { u8 red, green, blue; } palette[256];
 	const struct aty_dac_ops *dac_ops;
 	const struct aty_pll_ops *pll_ops;
 	unsigned long ati_regbase;
@@ -141,8 +153,8 @@
 #ifdef __sparc__
 	struct pci_mmap_map *mmap_map;
 	u8 mmaped;
-	int open;
 #endif
+	int open;
 #ifdef CONFIG_FB_ATY_GENERIC_LCD
 	unsigned long bios_base_phys;
 	unsigned long bios_base;
@@ -165,6 +177,10 @@
 #endif
 	unsigned long aux_start; /* auxiliary aperture */
 	unsigned long aux_size;
+	struct aty_interrupt vblank;
+	unsigned long irq_flags;
+	unsigned int irq;
+	spinlock_t int_lock;
 };
 
     /*
@@ -177,7 +193,7 @@
 #define M64F_MAGIC_FIFO		0x00000002
 #define M64F_GTB_DSP		0x00000004
 #define M64F_FIFO_32		0x00000008
-#define M64F_NO_EXT_PLL		0x00000010
+#define M64F_SDRAM_MAGIC_PLL	0x00000010
 #define M64F_MAGIC_POSTDIV	0x00000020
 #define M64F_INTEGRATED		0x00000040
 #define M64F_CT_BUS		0x00000080
@@ -191,7 +207,7 @@
 #define M64F_G3_PB_1_1		0x00008000
 #define M64F_G3_PB_1024x768	0x00010000
 #define M64F_EXTRA_BRIGHT	0x00020000
-#define M64F_LT_SLEEP		0x00040000
+#define M64F_LT_LCD_REGS	0x00040000
 #define M64F_XL_DLL		0x00080000
 #define M64F_MFB_FORCE_4	0x00100000
 #define M64F_HW_TRIPLE		0x00200000
@@ -251,6 +267,11 @@
 #endif
 }
 
+#if defined(CONFIG_PM) || defined(CONFIG_PMAC_BACKLIGHT) || defined (CONFIG_FB_ATY_GENERIC_LCD)
+extern void aty_st_lcd(int index, u32 val, const struct atyfb_par *par);
+extern u32 aty_ld_lcd(int index, const struct atyfb_par *par);
+#endif
+
     /*
      *  DAC operations
      */
@@ -275,6 +296,7 @@
 	int (*var_to_pll) (const struct fb_info * info, u32 vclk_per, u32 bpp, union aty_pll * pll);
 	u32 (*pll_to_var) (const struct fb_info * info, const union aty_pll * pll);
 	void (*set_pll)   (const struct fb_info * info, const union aty_pll * pll);
+	void (*get_pll)   (const struct fb_info *info, union aty_pll * pll);
 	int (*init_pll)   (const struct fb_info * info, union aty_pll * pll);
 };
 
drivers/video/aty/atyfb_base.c +702 -449

1,935 lines not on this page · raw message

drivers/video/aty/mach64_ct.c +13 -11
diff -ur -X patches/exclude linux-2.6.7.js3/drivers/video/aty/mach64_ct.c linux-2.6.7.ak/drivers/video/aty/mach64_ct.c
@@ -115,7 +115,6 @@
 
 static int aty_dsp_gt(const struct fb_info *info, u32 bpp, struct pll_ct *pll)
 {
-	struct atyfb_par *par = (struct atyfb_par *) info->par;
 	u32 dsp_off, dsp_on, dsp_xclks;
 	u32 multiplier, divider, ras_multiplier, ras_divider, tmp;
 	u8 vshift, xshift;
@@ -137,6 +136,8 @@
 
 #ifdef CONFIG_FB_ATY_GENERIC_LCD
 	if (pll->xres != 0) {
+		struct atyfb_par *par = (struct atyfb_par *) info->par;
+
 		multiplier = multiplier * par->lcd_width;
 		divider = divider * pll->xres & ~7;
 
@@ -281,8 +282,8 @@
 #ifdef CONFIG_FB_ATY_GENERIC_LCD
 	if (par->lcd_table != 0) {
 		/* turn off LCD */
-		lcd_gen_cntrl = aty_ld_le32(LCD_GEN_CNTL, par);
-		aty_st_le32(LCD_GEN_CNTL, lcd_gen_cntrl & ~LCD_ON, par);
+		lcd_gen_cntrl = aty_ld_lcd(LCD_GEN_CNTL, par);
+		aty_st_lcd(LCD_GEN_CNTL, lcd_gen_cntrl & ~LCD_ON, par);
 	}
 #endif
 	aty_st_8(CLOCK_CNTL, par->clk_wr_offset | CLOCK_STROBE, par);
@@ -351,12 +352,12 @@
 #ifdef CONFIG_FB_ATY_GENERIC_LCD
 	if (par->lcd_table != 0) {
 		/* restore LCD */
-		aty_st_le32(LCD_GEN_CNTL, lcd_gen_cntrl, par);
+		aty_st_lcd(LCD_GEN_CNTL, lcd_gen_cntrl, par);
 	}
 #endif
 }
-#if 0
-void aty_get_pll_ct(const struct fb_info *info, union aty_pll *pll)
+
+void __init aty_get_pll_ct(const struct fb_info *info, union aty_pll *pll)
 {
 	struct atyfb_par *par = (struct atyfb_par *) info->par;
 	u8 tmp, clock;
@@ -378,7 +379,7 @@
 		pll->ct.dsp_on_off = aty_ld_le32(DSP_ON_OFF, par);
 	}
 }
-#endif
+
 int __init aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll) {
 	struct atyfb_par *par = (struct atyfb_par *) info->par;
 	u8 mpost_div, xpost_div, sclk_post_div_real, sclk_fb_div, spll_cntl2;
@@ -526,10 +527,10 @@
 		__FUNCTION__, pllmclk, pllmclk / pll->ct.xclk_post_div_real);
 #endif
 
-	pll->ct.pll_gen_cntl = OSC_EN;
-	
-	if (M64_HAS(NO_EXT_PLL))
-		pll->ct.pll_gen_cntl |= (DLL_PWDN | FORCE_DCLK_TRI_STATE);
+	if (M64_HAS(SDRAM_MAGIC_PLL) && (par->ram_type >= SDRAM))
+		pll->ct.pll_gen_cntl = OSC_EN;
+	else
+		pll->ct.pll_gen_cntl = OSC_EN | DLL_PWDN /* | FORCE_DCLK_TRI_STATE */;
 
 	if (M64_HAS(MAGIC_POSTDIV))
 		pll->ct.pll_ext_cntl = 0;
@@ -608,5 +609,6 @@
 	.var_to_pll	= aty_var_to_pll_ct,
 	.pll_to_var	= aty_pll_to_var_ct,
 	.set_pll	= aty_set_pll_ct,
+	.get_pll	= aty_get_pll_ct,
 	.init_pll       = aty_init_pll_ct
 };
drivers/video/aty/mach64_cursor.c +45 -26

90 lines not on this page · raw message

drivers/video/modedb.c +42 -21

95 lines not on this page · raw message

include/video/mach64.h +97 -7

169 lines not on this page · raw message

#6 lore raw
Quoted 1 line · Alexander Kern

Hi, here a snapshot from my tree over 2.6.7 + js3

Thanks, I'll have a look next week

Ben.

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com