LCD stretching partially working!
I'm working on getting hardware stretching for the Rage LT chipset (wallst. & lombard at least), and have got this far:
In console mode:
1. Stretching in the vertical direction works
2. stretching in the horiz direction works
3. doing both at the same time appears to work...except for a little screen flicker. (what could cause this?)
In X, strange things happen, to say the least.
Perhaps someone with a little more knowledge with both X and the ATI video driver would like to take a look at my code...try it out, etc?
Attached are the following files:
aty.h.diff /usr/src/linux/drivers/video/aty.h patch
atyfb.c.diff /usr/src/linux/drivers/video/atyfb.c patchlcdtest.c user space program for manipulating the registers
The driver files must be patched (they add a couple ioctls for accessing the LCD_INDEX and LCD_DATA registers), the kernel recompiled...just restart after putting the new kernel in.
BTW, the .diff files are against paul's latest stable tree (2.2.13) as of 2 days ago. They'll probably work on an older one too.
Change line 80 and 81 in lcdtest.c to either 0 or 1 to enable/disable stretching in either the H or V direction. lcdtest.c will print out the relevant registers (3 of them), enable stretching, wait for 3 seconds, and switch back to the previous values. This is good when your whole screen gets messed up.
To really try this out, first do:
# fbset 640x480-60
to switch modes, then run the lcdtest program.
right now it's hard-coded for both a 1024x756 LCD panel, and a 640x480 target res.
If you have any ideas, etc, feel free to email me or the list (I'm on it)
Josh
aty.h renamed from aty.h.old +25 -0
@@ -962,4 +962,29 @@#define PWR_MGT_STATUS_MASK 0xC0000000#define PWR_MGT_STATUS_SUSPEND 0x80000000 +/* LCD Panel configuration registers */ +/* added by Josh Huber <[email protected]> */ + +#define LCD_INDEX 0x00A4/* Dword offset 0_29 */ + +#define LCD_DATA 0x00A8/* Dword offset 0_2A */ + +#define IDX_CONFIG_PANEL 0 +#define IDX_LCD_GEN_CTRL 1 +#define IDX_DSTN_CONTROL 2 +#define IDX_HFB_PITCH_ADDR 3 +#define IDX_HORZ_STRETCHING 4 +#define IDX_VERT_STRETCHING 5 +#define IDX_EXT_VERT_STRETCH 6 +#define IDX_LT_GIO 7 +#define IDX_POWER_MANAGEMENT 8 +#define IDX_ZVGPIO 9 + +/* LCD Panel Testing IOCTLs */ +#define ATY_IOC_MAGIC 'A' +#define IDX_REG_SET _IOW(ATY_IOC_MAGIC, 1, __u32) +#define IDX_REG_GET _IOR(ATY_IOC_MAGIC, 2, __u32) +#define LCD_REG_SET _IOW(ATY_IOC_MAGIC, 3, __u32) +#define LCD_REG_GET _IOR(ATY_IOC_MAGIC, 4, __u32) +#endif /* REGMACH64_H */
atyfb.c renamed from atyfb.c.old +33 -2
@@ -72,8 +72,8 @@#ifdef __sparc__#include <asm/pbm.h> #include <asm/fbio.h> -#include <asm/uaccess.h> #endif +#include <asm/uaccess.h> #include <video/fbcon.h> #include <video/fbcon-cfb8.h>
@@ -2235,7 +2235,34 @@ }return 0 ;#else -return -EINVAL ; +u32 reg; +struct fb_info_aty *fb = (struct fb_info_aty *)info; + +switch (cmd) { +case IDX_REG_GET : + reg =aty_ld_le32 (LCD_INDEX , fb); +copy_to_user_ret ((u32 *)arg, ®,sizeof (u32), -EFAULT ); +break ; + +case IDX_REG_SET : +copy_from_user_ret (®, (u32 *)arg,sizeof (u32), -EFAULT ); +aty_st_le32 (LCD_INDEX , reg, fb); +break ; + +case LCD_REG_GET : + reg =aty_ld_le32 (LCD_DATA , fb); +copy_to_user_ret ((u32 *)arg, ®,sizeof (u32), -EFAULT ); +break ; + +case LCD_REG_SET : +copy_from_user_ret (®, (u32 *)arg,sizeof (u32), -EFAULT ); +aty_st_le32 (LCD_DATA , reg, fb); +break ; + +default : +return -EINVAL ; + } +return 0 ;#endif }
@@ -2465,6 +2492,7 @@return 0 ; }else printk ("atyfb: %s [0x%04x rev 0x%02x] " , chipname, Gx, Rev); +if ((Gx ==GX_CHIP_ID ) || (Gx ==CX_CHIP_ID )) { info->bus_type = (aty_ld_le32 (CONFIG_STAT0 , info) >>0 ) &0x07 ; info->ram_type = (aty_ld_le32 (CONFIG_STAT0 , info) >>3 ) &0x07 ;
@@ -2671,6 +2699,7 @@for (i =0 ; i <16 ; i++)printk (" %02x" ,aty_ld_pll (i, info)); printk("\n"); + }#endif
@@ -3017,6 +3046,8 @@ info->ati_regbase_phys +=0xc00 ; info->ati_regbase +=0xc00 ; + +/* * Enable memory-space accesses using config-space
Quoted 7 lines · Josh Huber
I'm working on getting hardware stretching for the Rage LT chipset (wallst. & lombard at least), and have got this far:
In console mode:
1. Stretching in the vertical direction works
2. stretching in the horiz direction works
Great!
Quoted 2 lines
3. doing both at the same time appears to work...except for a little screen flicker. (what could cause this?)
Two possible solutions:
- Does it help if you lower the mclk?
- Perhaps the display FIFO parameters have to take into account the stretching? At least for the horizontal stretching this sounds logical to me, i.e. try to use
xclks_per_row = (pll->mclk_fb_div*pll->vclk_post_div_real*64*hstretch<<11)/
(pll->vclk_fb_div*pll->mclk_post_div_real*bpp);
Gr{oetje,eeting}s,
--
Geert Uytterhoeven -- Linux/{m68k~Amiga,PPC~CHRP} -- [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
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/