Commit ab04a6b1 authored by David Eger's avatar David Eger Committed by Linus Torvalds

[PATCH] radeonfb accel capabilities

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 :-/

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarDavid Eger <eger@havoc.gtf.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent aa299b22
...@@ -33,7 +33,7 @@ void radeonfb_fillrect(struct fb_info *info, const struct fb_fillrect *region) ...@@ -33,7 +33,7 @@ void radeonfb_fillrect(struct fb_info *info, const struct fb_fillrect *region)
if (info->state != FBINFO_STATE_RUNNING) if (info->state != FBINFO_STATE_RUNNING)
return; return;
if (radeon_accel_disabled()) { if (info->flags & FBINFO_HWACCEL_DISABLED) {
cfb_fillrect(info, region); cfb_fillrect(info, region);
return; return;
} }
...@@ -99,7 +99,7 @@ void radeonfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) ...@@ -99,7 +99,7 @@ void radeonfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
if (info->state != FBINFO_STATE_RUNNING) if (info->state != FBINFO_STATE_RUNNING)
return; return;
if (radeon_accel_disabled()) { if (info->flags & FBINFO_HWACCEL_DISABLED) {
cfb_copyarea(info, area); cfb_copyarea(info, area);
return; return;
} }
......
...@@ -242,8 +242,6 @@ static int force_measure_pll = 0; ...@@ -242,8 +242,6 @@ static int force_measure_pll = 0;
static int nomtrr = 0; static int nomtrr = 0;
#endif #endif
int radeonfb_noaccel = 0;
/* /*
* prototypes * prototypes
*/ */
...@@ -810,9 +808,8 @@ static int radeonfb_check_var (struct fb_var_screeninfo *var, struct fb_info *in ...@@ -810,9 +808,8 @@ static int radeonfb_check_var (struct fb_var_screeninfo *var, struct fb_info *in
/* XXX I'm adjusting xres_virtual to the pitch, that may help XFree /* XXX I'm adjusting xres_virtual to the pitch, that may help XFree
* with some panels, though I don't quite like this solution * 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.xres_virtual = v.xres_virtual & ~7ul;
v.accel_flags = 0;
} else { } else {
pitch = ((v.xres_virtual * ((v.bits_per_pixel + 1) / 8) + 0x3f) pitch = ((v.xres_virtual * ((v.bits_per_pixel + 1) / 8) + 0x3f)
& ~(0x3f)) >> 6; & ~(0x3f)) >> 6;
...@@ -1535,7 +1532,7 @@ int radeonfb_set_par(struct fb_info *info) ...@@ -1535,7 +1532,7 @@ int radeonfb_set_par(struct fb_info *info)
newmode.crtc_v_sync_strt_wid = (((vSyncStart - 1) & 0xfff) | newmode.crtc_v_sync_strt_wid = (((vSyncStart - 1) & 0xfff) |
(vsync_wid << 16) | (v_sync_pol << 23)); (vsync_wid << 16) | (v_sync_pol << 23));
if (!radeon_accel_disabled()) { if (!(info->flags & FBINFO_HWACCEL_DISABLED)) {
/* We first calculate the engine pitch */ /* We first calculate the engine pitch */
rinfo->pitch = ((mode->xres_virtual * ((mode->bits_per_pixel + 1) / 8) + 0x3f) rinfo->pitch = ((mode->xres_virtual * ((mode->bits_per_pixel + 1) / 8) + 0x3f)
& ~(0x3f)) >> 6; & ~(0x3f)) >> 6;
...@@ -1683,12 +1680,11 @@ int radeonfb_set_par(struct fb_info *info) ...@@ -1683,12 +1680,11 @@ int radeonfb_set_par(struct fb_info *info)
if (!rinfo->asleep) { if (!rinfo->asleep) {
radeon_write_mode (rinfo, &newmode); radeon_write_mode (rinfo, &newmode);
/* (re)initialize the engine */ /* (re)initialize the engine */
if (!radeon_accel_disabled()) if (!(info->flags & FBINFO_HWACCEL_DISABLED))
radeonfb_engine_init (rinfo); radeonfb_engine_init (rinfo);
} }
/* Update fix */ /* Update fix */
if (!radeon_accel_disabled()) if (!(info->flags & FBINFO_HWACCEL_DISABLED))
info->fix.line_length = rinfo->pitch*64; info->fix.line_length = rinfo->pitch*64;
else else
info->fix.line_length = mode->xres_virtual info->fix.line_length = mode->xres_virtual
...@@ -1793,7 +1789,11 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) ...@@ -1793,7 +1789,11 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo)
info->currcon = -1; info->currcon = -1;
info->par = rinfo; info->par = rinfo;
info->pseudo_palette = rinfo->pseudo_palette; info->pseudo_palette = rinfo->pseudo_palette;
info->flags = FBINFO_FLAG_DEFAULT; info->flags = FBINFO_DEFAULT
| FBINFO_HWACCEL_COPYAREA
| FBINFO_HWACCEL_FILLRECT
| FBINFO_HWACCEL_XPAN
| FBINFO_HWACCEL_YPAN;
info->fbops = &radeonfb_ops; info->fbops = &radeonfb_ops;
info->screen_base = (char *)rinfo->fb_base; info->screen_base = (char *)rinfo->fb_base;
...@@ -1809,17 +1809,11 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) ...@@ -1809,17 +1809,11 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo)
info->fix.type_aux = 0; info->fix.type_aux = 0;
info->fix.mmio_start = rinfo->mmio_base_phys; info->fix.mmio_start = rinfo->mmio_base_phys;
info->fix.mmio_len = RADEON_REGSIZE; 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); fb_alloc_cmap(&info->cmap, 256, 0);
if (radeon_accel_disabled()) if (noaccel)
info->var.accel_flags &= ~FB_ACCELF_TEXT; info->flags |= FBINFO_HWACCEL_DISABLED;
else
info->var.accel_flags |= FB_ACCELF_TEXT;
return 0; return 0;
} }
...@@ -2451,7 +2445,6 @@ static struct pci_driver radeonfb_driver = { ...@@ -2451,7 +2445,6 @@ static struct pci_driver radeonfb_driver = {
int __init radeonfb_init (void) int __init radeonfb_init (void)
{ {
radeonfb_noaccel = noaccel;
return pci_module_init (&radeonfb_driver); return pci_module_init (&radeonfb_driver);
} }
...@@ -2473,7 +2466,7 @@ int __init radeonfb_setup (char *options) ...@@ -2473,7 +2466,7 @@ int __init radeonfb_setup (char *options)
continue; continue;
if (!strncmp(this_opt, "noaccel", 7)) { if (!strncmp(this_opt, "noaccel", 7)) {
noaccel = radeonfb_noaccel = 1; noaccel = 1;
} else if (!strncmp(this_opt, "mirror", 6)) { } else if (!strncmp(this_opt, "mirror", 6)) {
mirror = 1; mirror = 1;
} else if (!strncmp(this_opt, "force_dfp", 9)) { } else if (!strncmp(this_opt, "force_dfp", 9)) {
......
...@@ -859,7 +859,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, u32 state) ...@@ -859,7 +859,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, u32 state)
fb_set_suspend(info, 1); fb_set_suspend(info, 1);
if (!radeon_accel_disabled()) { if (!(info->flags & FBINFO_HWACCEL_DISABLED)) {
/* Make sure engine is reset */ /* Make sure engine is reset */
radeon_engine_idle(); radeon_engine_idle();
radeonfb_engine_reset(rinfo); radeonfb_engine_reset(rinfo);
......
...@@ -516,12 +516,6 @@ static inline void _radeon_engine_idle (struct radeonfb_info *rinfo) ...@@ -516,12 +516,6 @@ static inline void _radeon_engine_idle (struct radeonfb_info *rinfo)
printk(KERN_ERR "radeonfb: Idle Timeout !\n"); 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_engine_idle() _radeon_engine_idle(rinfo)
#define radeon_fifo_wait(entries) _radeon_fifo_wait(rinfo,entries) #define radeon_fifo_wait(entries) _radeon_fifo_wait(rinfo,entries)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment