From: David Eger Here's the accel capabilities patch for radeonfb. It updates radeonfb to advertise its acceleration capabilities via fbinfo.flags. I've tested this on my box, and it gives me a nice fast console. defect: "$ fbset -accel 0" doesn't work for radeonfb -- disabling accel will only work from the kernel command line :-/ Signed-off-by: David Eger Signed-off-by: Andrew Morton --- 25-akpm/drivers/video/aty/radeon_accel.c | 4 +-- 25-akpm/drivers/video/aty/radeon_base.c | 35 ++++++++++++------------------- 25-akpm/drivers/video/aty/radeon_pm.c | 2 - 25-akpm/drivers/video/aty/radeonfb.h | 6 ----- 4 files changed, 17 insertions(+), 30 deletions(-) diff -puN drivers/video/aty/radeon_accel.c~radeonfb-accel-capabilities-resend drivers/video/aty/radeon_accel.c --- 25/drivers/video/aty/radeon_accel.c~radeonfb-accel-capabilities-resend 2004-06-25 02:46:50.157433624 -0700 +++ 25-akpm/drivers/video/aty/radeon_accel.c 2004-06-25 02:46:50.167432104 -0700 @@ -33,7 +33,7 @@ void radeonfb_fillrect(struct fb_info *i if (info->state != FBINFO_STATE_RUNNING) return; - if (radeon_accel_disabled()) { + if (info->flags & FBINFO_HWACCEL_DISABLED) { cfb_fillrect(info, region); return; } @@ -99,7 +99,7 @@ void radeonfb_copyarea(struct fb_info *i if (info->state != FBINFO_STATE_RUNNING) return; - if (radeon_accel_disabled()) { + if (info->flags & FBINFO_HWACCEL_DISABLED) { cfb_copyarea(info, area); return; } diff -puN drivers/video/aty/radeon_base.c~radeonfb-accel-capabilities-resend drivers/video/aty/radeon_base.c --- 25/drivers/video/aty/radeon_base.c~radeonfb-accel-capabilities-resend 2004-06-25 02:46:50.159433320 -0700 +++ 25-akpm/drivers/video/aty/radeon_base.c 2004-06-25 02:46:50.170431648 -0700 @@ -242,8 +242,6 @@ static int force_measure_pll = 0; static int nomtrr = 0; #endif -int radeonfb_noaccel = 0; - /* * prototypes */ @@ -810,9 +808,8 @@ static int radeonfb_check_var (struct fb /* XXX I'm adjusting xres_virtual to the pitch, that may help XFree * with some panels, though I don't quite like this solution */ - if (radeon_accel_disabled()) { + if (rinfo->info->flags & FBINFO_HWACCEL_DISABLED) { v.xres_virtual = v.xres_virtual & ~7ul; - v.accel_flags = 0; } else { pitch = ((v.xres_virtual * ((v.bits_per_pixel + 1) / 8) + 0x3f) & ~(0x3f)) >> 6; @@ -1535,7 +1532,7 @@ int radeonfb_set_par(struct fb_info *inf newmode.crtc_v_sync_strt_wid = (((vSyncStart - 1) & 0xfff) | (vsync_wid << 16) | (v_sync_pol << 23)); - if (!radeon_accel_disabled()) { + if (!(info->flags & FBINFO_HWACCEL_DISABLED)) { /* We first calculate the engine pitch */ rinfo->pitch = ((mode->xres_virtual * ((mode->bits_per_pixel + 1) / 8) + 0x3f) & ~(0x3f)) >> 6; @@ -1683,12 +1680,11 @@ int radeonfb_set_par(struct fb_info *inf if (!rinfo->asleep) { radeon_write_mode (rinfo, &newmode); /* (re)initialize the engine */ - if (!radeon_accel_disabled()) + if (!(info->flags & FBINFO_HWACCEL_DISABLED)) radeonfb_engine_init (rinfo); - } /* Update fix */ - if (!radeon_accel_disabled()) + if (!(info->flags & FBINFO_HWACCEL_DISABLED)) info->fix.line_length = rinfo->pitch*64; else info->fix.line_length = mode->xres_virtual @@ -1793,9 +1789,13 @@ static int __devinit radeon_set_fbinfo ( info->currcon = -1; info->par = rinfo; info->pseudo_palette = rinfo->pseudo_palette; - info->flags = FBINFO_FLAG_DEFAULT; - info->fbops = &radeonfb_ops; - info->screen_base = (char *)rinfo->fb_base; + info->flags = FBINFO_DEFAULT + | FBINFO_HWACCEL_COPYAREA + | FBINFO_HWACCEL_FILLRECT + | FBINFO_HWACCEL_XPAN + | FBINFO_HWACCEL_YPAN; + info->fbops = &radeonfb_ops; + info->screen_base = (char *)rinfo->fb_base; /* Fill fix common fields */ strlcpy(info->fix.id, rinfo->name, sizeof(info->fix.id)); @@ -1809,17 +1809,11 @@ static int __devinit radeon_set_fbinfo ( info->fix.type_aux = 0; info->fix.mmio_start = rinfo->mmio_base_phys; info->fix.mmio_len = RADEON_REGSIZE; - if (radeon_accel_disabled()) - info->fix.accel = FB_ACCEL_NONE; - else - info->fix.accel = FB_ACCEL_ATI_RADEON; fb_alloc_cmap(&info->cmap, 256, 0); - if (radeon_accel_disabled()) - info->var.accel_flags &= ~FB_ACCELF_TEXT; - else - info->var.accel_flags |= FB_ACCELF_TEXT; + if (noaccel) + info->flags |= FBINFO_HWACCEL_DISABLED; return 0; } @@ -2451,7 +2445,6 @@ static struct pci_driver radeonfb_driver int __init radeonfb_init (void) { - radeonfb_noaccel = noaccel; return pci_module_init (&radeonfb_driver); } @@ -2473,7 +2466,7 @@ int __init radeonfb_setup (char *options continue; if (!strncmp(this_opt, "noaccel", 7)) { - noaccel = radeonfb_noaccel = 1; + noaccel = 1; } else if (!strncmp(this_opt, "mirror", 6)) { mirror = 1; } else if (!strncmp(this_opt, "force_dfp", 9)) { diff -puN drivers/video/aty/radeonfb.h~radeonfb-accel-capabilities-resend drivers/video/aty/radeonfb.h --- 25/drivers/video/aty/radeonfb.h~radeonfb-accel-capabilities-resend 2004-06-25 02:46:50.161433016 -0700 +++ 25-akpm/drivers/video/aty/radeonfb.h 2004-06-25 02:46:50.172431344 -0700 @@ -516,12 +516,6 @@ static inline void _radeon_engine_idle ( printk(KERN_ERR "radeonfb: Idle Timeout !\n"); } -static inline int radeon_accel_disabled(void) -{ - extern int radeonfb_noaccel; - return radeonfb_noaccel; -} - #define radeon_engine_idle() _radeon_engine_idle(rinfo) #define radeon_fifo_wait(entries) _radeon_fifo_wait(rinfo,entries) diff -puN drivers/video/aty/radeon_pm.c~radeonfb-accel-capabilities-resend drivers/video/aty/radeon_pm.c --- 25/drivers/video/aty/radeon_pm.c~radeonfb-accel-capabilities-resend 2004-06-25 02:46:50.163432712 -0700 +++ 25-akpm/drivers/video/aty/radeon_pm.c 2004-06-25 02:46:50.171431496 -0700 @@ -859,7 +859,7 @@ int radeonfb_pci_suspend(struct pci_dev fb_set_suspend(info, 1); - if (!radeon_accel_disabled()) { + if (!(info->flags & FBINFO_HWACCEL_DISABLED)) { /* Make sure engine is reset */ radeon_engine_idle(); radeonfb_engine_reset(rinfo); _