diff options
author | Kristoffer <kristoffer@Buttox.(none)> | 2009-06-05 18:33:05 +0200 |
---|---|---|
committer | Kristoffer Ericson <kristoffer.ericson@gmail.com> | 2011-12-10 15:37:41 +0100 |
commit | 2a4533ee706bd0d89b9d8d6e8a1ccdf2288e0f1c (patch) | |
tree | 4819a2b5b12a0142a187f7a58cf66f075baaa617 | |
parent | 99891aef218737759e0ef53393574ea913f98c2c (diff) | |
download | linux-hpc-2a4533ee706bd0d89b9d8d6e8a1ccdf2288e0f1c.tar.gz |
drivers/video/s1d13xxxfb.c : Prepare to push mainline * major cleanup fixing formatting and debug output
-rw-r--r-- | drivers/video/s1d13xxxfb.c | 161 |
1 files changed, 91 insertions, 70 deletions
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c index a69371c39da2a6..49c96d20fc99f7 100644 --- a/drivers/video/s1d13xxxfb.c +++ b/drivers/video/s1d13xxxfb.c @@ -13,7 +13,8 @@ * * TODO: - handle dual screen display (CRT and LCD at the same time). * - check_var(), mode change, etc. - * - Probably not SMP safe :) + * - probably not SMP safe :) + * - support all bitblt operations on all cards * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for @@ -23,7 +24,6 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/delay.h> - #include <linux/types.h> #include <linux/errno.h> #include <linux/mm.h> @@ -36,30 +36,34 @@ #include <video/s1d13xxxfb.h> -#include "fb_draw.h" - - -#define PFX "s1d13xxxfb: " +#define PFX "s1d13xxxfb: " +#define BLIT "s1d13xxxfb_bitblt: " +/** + * set this to enable debugging on general functions + */ #if 0 #define dbg(fmt, args...) do { printk(KERN_INFO fmt, ## args); } while(0) #else #define dbg(fmt, args...) do { } while (0) #endif -/* to limit the output we use this for - bitblit bugtracking */ - +/** + * set this to enable debugging on 2D acceleration + */ #if 0 -#define dbg_bitblt(fmt, args...) do {printk(KERN_ERR fmt, ## args); } while(0) +#define dbg_blit(fmt, args...) do {printk(KERN_INFO BLIT fmt, ## args); } while(0) #else -#define dbg_bitblt(fmt, args...) do { } while (0) +#define dbg_blit(fmt, args...) do { } while (0) #endif +/** + * we make sure only one bitblt operation is running + */ static DEFINE_SPINLOCK(s1d13xxxfb_bitblt_lock); -/* - * List of card production ids +/** + * list of card production ids */ static const int s1d13xxxfb_prod_ids[] = { S1D13505_PROD_ID, @@ -67,7 +71,7 @@ static const int s1d13xxxfb_prod_ids[] = { S1D13806_PROD_ID, }; -/* +/** * List of card strings */ static const char *s1d13xxxfb_prod_names[] = { @@ -76,8 +80,8 @@ static const char *s1d13xxxfb_prod_names[] = { "S1D13806", }; -/* - * Here we define the default struct fb_fix_screeninfo +/** + * here we define the default struct fb_fix_screeninfo */ static struct fb_fix_screeninfo __devinitdata s1d13xxxfb_fix = { .id = S1D_FBID, @@ -153,8 +157,10 @@ crt_enable(struct s1d13xxxfb_par *par, int enable) s1d13xxxfb_writereg(par, S1DREG_COM_DISP_MODE, mode); } -/* framebuffer control routines */ +/************************************************************* + framebuffer control functions + *************************************************************/ static inline void s1d13xxxfb_setup_pseudocolour(struct fb_info *info) { @@ -250,13 +256,13 @@ s1d13xxxfb_set_par(struct fb_info *info) } /** - * s1d13xxxfb_setcolreg - sets a color register. - * @regno: Which register in the CLUT we are programming - * @red: The red value which can be up to 16 bits wide + * s1d13xxxfb_setcolreg - sets a color register. + * @regno: Which register in the CLUT we are programming + * @red: The red value which can be up to 16 bits wide * @green: The green value which can be up to 16 bits wide * @blue: The blue value which can be up to 16 bits wide. * @transp: If supported the alpha value which can be up to 16 bits wide. - * @info: frame buffer info structure + * @info: frame buffer info structure * * Returns negative errno on error, or zero on success. */ @@ -359,15 +365,15 @@ s1d13xxxfb_blank(int blank_mode, struct fb_info *info) } /** - * s1d13xxxfb_pan_display - Pans the display. - * @var: frame buffer variable screen structure - * @info: frame buffer structure that represents a single frame buffer + * s1d13xxxfb_pan_display - Pans the display. + * @var: frame buffer variable screen structure + * @info: frame buffer structure that represents a single frame buffer * * Pan (or wrap, depending on the `vmode' field) the display using the - * `yoffset' field of the `var' structure (`xoffset' not yet supported). - * If the values don't fit, return -EINVAL. + * `yoffset' field of the `var' structure (`xoffset' not yet supported). + * If the values don't fit, return -EINVAL. * - * Returns negative errno on error, or zero on success. + * Returns negative errno on error, or zero on success. */ static int s1d13xxxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) @@ -398,17 +404,24 @@ s1d13xxxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) return 0; } -/* - * - * waits until register changes INTO bit +/************************************************************ + functions to handle bitblt acceleration + ************************************************************/ + +/** + * bltbit_wait_bitset - waits for change in register value + * @info : framebuffer structure + * @bit : value expected in register + * @timeout : ... * + * waits until value changes INTO bit */ u8 bltbit_wait_bitset(struct fb_info *info, u8 bit, int timeout) { while (!(s1d13xxxfb_readreg(info->par, S1DREG_BBLT_CTL0) & bit)) { udelay(10); if (!--timeout) { - printk(KERN_ERR "s1d13xxxfb_bitblt : wait_bitset timeout\n"); + dbg_blit("wait_bitset timeout\n"); break; } } @@ -417,12 +430,12 @@ u8 bltbit_wait_bitset(struct fb_info *info, u8 bit, int timeout) } /** - * bltbit_wait_bitclear - waits for change in register value - * @info : frambuffer structure - * @bit : value currently in register - * @timeout : ... + * bltbit_wait_bitclear - waits for change in register value + * @info : frambuffer structure + * @bit : value currently in register + * @timeout : ... * - * waits until value changes FROM bit + * waits until value changes FROM bit * */ u8 bltbit_wait_bitclear(struct fb_info *info, u8 bit, int timeout) @@ -430,7 +443,7 @@ u8 bltbit_wait_bitclear(struct fb_info *info, u8 bit, int timeout) while (s1d13xxxfb_readreg(info->par, S1DREG_BBLT_CTL0) & bit) { udelay(10); if (!--timeout) { - printk(KERN_ERR "s1d13xxxfb_bitblt : wait_bitclear timeout\n"); + dbg_blit("wait_bitclear timeout\n"); break; } } @@ -439,10 +452,10 @@ u8 bltbit_wait_bitclear(struct fb_info *info, u8 bit, int timeout) } /** - * bltbit_fifo_status - checks the current status of the fifo - * @info : framebuffer structure + * bltbit_fifo_status - checks the current status of the fifo + * @info : framebuffer structure * - * returns number of free words in buffer + * returns number of free words in buffer */ u8 bltbit_fifo_status(struct fb_info *info) { @@ -458,13 +471,21 @@ u8 bltbit_fifo_status(struct fb_info *info) if (status & BBLT_FIFO_FULL) return 0; - /* its atleast half full but we can add one atleast */ + /* its atleast half full but we can add one atleast */ if (status & BBLT_FIFO_NOT_FULL) return 1; return 0; } +/* + * s1d13xxxfb_bitblt_copyarea - accelerated copyarea function + * @info : framebuffer structure + * @area : fb_copyarea structure + * + * supports (atleast) S1D13506 + * + */ void s1d13xxxfb_bitblt_copyarea(struct fb_info *info, const struct fb_copyarea *area) { u32 dst, src; @@ -511,11 +532,11 @@ void s1d13xxxfb_bitblt_copyarea(struct fb_info *info, const struct fb_copyarea * /* negative direction ROP */ if (reverse == 1) { - printk(KERN_ERR "s1d13xxxfb_bitblt_copyarea : negative ROP\n"); + dbg_blit("(copyarea) negative rop\n"); s1d13xxxfb_writereg(info->par, S1DREG_BBLT_OP, 0x03); } else /* positive direction ROP */ { s1d13xxxfb_writereg(info->par, S1DREG_BBLT_OP, 0x02); - printk(KERN_ERR "s1d13xxxfb_bitblt_copyarea : positive ROP\n"); + dbg_blit("(copyarea) positive rop\n"); } /* set for rectangel mode and not linear */ @@ -528,11 +549,12 @@ void s1d13xxxfb_bitblt_copyarea(struct fb_info *info, const struct fb_copyarea * s1d13xxxfb_writereg(info->par, S1DREG_BBLT_MEM_OFF0, (stride >> 1) & 0xff); s1d13xxxfb_writereg(info->par, S1DREG_BBLT_MEM_OFF1, (stride >> 9)); - dbg_bitblt("s1d13xxxfb_bitblt_copyarea : dx=%d, dy=%d\n", dx, dy); - dbg_bitblt("s1d13xxxfb_bitblt_copyarea : sx=%d, sy=%d\n", sx, sy); - dbg_bitblt("s1d13xxxfb_bitblt_copyarea : width=%d, height=%d\n", width - 1, height - 1); - dbg_bitblt("s1d13xxxfb_bitblt_copyarea : stride=%d\n", stride); - dbg_bitblt("s1d13xxxfb_bitblt_copyarea : bpp=%d=0x0%d, mem_offset1=%d, mem_offset2=%d\n", bpp, (bpp >> 1), (stride >> 1) & 0xff, stride >> 9); + dbg_blit("(copyarea) dx=%d, dy=%d\n", dx, dy); + dbg_blit("(copyarea) sx=%d, sy=%d\n", sx, sy); + dbg_blit("(copyarea) width=%d, height=%d\n", width - 1, height - 1); + dbg_blit("(copyarea) stride=%d\n", stride); + dbg_blit("(copyarea) bpp=%d=0x0%d, mem_offset1=%d, mem_offset2=%d\n", bpp, (bpp >> 1), + (stride >> 1) & 0xff, stride >> 9); s1d13xxxfb_writereg(info->par, S1DREG_BBLT_CC_EXP, 0x0c); @@ -546,14 +568,12 @@ void s1d13xxxfb_bitblt_copyarea(struct fb_info *info, const struct fb_copyarea * } /** - * @info pointer to fb_info structure - * @rect pointer to fb_fillrect structure * - * Supported for : 13506, 13806 (and probably more) - * Not supported : 13505, + * s1d13xxxfb_bitblt_solidfill - accelerated solidfill function + * @info : framebuffer structure + * @rect : fb_fillrect structure * - * Accelerated function for fb_fillrect through - * bitblt soldfill. + * supports (atleast 13506) * **/ void s1d13xxxfb_bitblt_solidfill(struct fb_info *info, const struct fb_fillrect *rect) @@ -561,25 +581,25 @@ void s1d13xxxfb_bitblt_solidfill(struct fb_info *info, const struct fb_fillrect u32 screen_stride, dest; u32 fg; u16 bpp = (info->var.bits_per_pixel >> 3); - + /* grab spinlock */ spin_lock(&s1d13xxxfb_bitblt_lock); - + /* bytes per x width */ screen_stride = (bpp * info->var.xres); - + /* bytes to starting point */ dest = ((rect->dy * screen_stride) + (bpp * rect->dx)); - dbg_bitblt("s1d13xxxfb_bitblt_solidfill : dx=%d, dy=%d, stride=%d, dest=%d\n" - "s1d13xxxfb_bitblt_solidfill : rect_width=%d, rect_height=%d\n", + dbg_blit("(solidfill) dx=%d, dy=%d, stride=%d, dest=%d\n" + "(solidfill) : rect_width=%d, rect_height=%d\n", rect->dx, rect->dy, screen_stride, dest, rect->width - 1, rect->height - 1); - dbg_bitblt("s1d13xxxfb_bitblt_solidfill : xres=%d, yres=%d, bpp=%d\n", + dbg_blit("(solidfill) : xres=%d, yres=%d, bpp=%d\n", info->var.xres, info->var.yres, info->var.bits_per_pixel); - dbg_bitblt("s1d13xxxfb_bitblt_solidfill : ROP=%d\n", rect->rop); + dbg_blit("(solidfill) : rop=%d\n", rect->rop); /* We split the destination into the three registers */ s1d13xxxfb_writereg(info->par, S1DREG_BBLT_DST_START0, (dest & 0x00ff)); @@ -597,17 +617,17 @@ void s1d13xxxfb_bitblt_solidfill(struct fb_info *info, const struct fb_fillrect if (info->fix.visual == FB_VISUAL_TRUECOLOR || info->fix.visual == FB_VISUAL_DIRECTCOLOR) { fg = ((u32 *)info->pseudo_palette)[rect->color]; - dbg_bitblt("s1d13xxxfb_bitblt_solidfill : TRUECOLOR/DIRECTCOLOR\n"); - dbg_bitblt("s1d13xxxfb_bitblt_solidfill : pseudo_palette[%d] = %d\n", rect->color, fg); + dbg_blit("(solidfill) truecolor/directcolor\n"); + dbg_blit("(solidfill) pseudo_palette[%d] = %d\n", rect->color, fg); } else { fg = rect->color; - dbg_bitblt("s1d13xxxfb_bitblt_solidfill : color = %d\n", rect->color); + dbg_blit("(solidfill) color = %d\n", rect->color); } /* set foreground color */ s1d13xxxfb_writereg(info->par, S1DREG_BBLT_FGC0, (fg & 0xff)); s1d13xxxfb_writereg(info->par, S1DREG_BBLT_FGC1, (fg >> 8) & 0xff); - + /* set rectangual region of memory (rectangle and not linear) */ s1d13xxxfb_writereg(info->par, S1DREG_BBLT_CTL0, 0x0); @@ -652,9 +672,9 @@ static int s1d13xxxfb_width_tab[2][4] __devinitdata = { }; /** - * s1d13xxxfb_fetch_hw_state - Configure the framebuffer according to + * s1d13xxxfb_fetch_hw_state - Configure the framebuffer according to * hardware setup. - * @info: frame buffer structure + * @info: frame buffer structure * * We setup the framebuffer structures according to the current * hardware setup. On some machines, the BIOS will have filled @@ -907,9 +927,10 @@ s1d13xxxfb_probe(struct platform_device *pdev) switch(prod_id) { case S1D13506_PROD_ID : /* activate acceleration */ - info->fbops->fb_fillrect = s1d13xxxfb_bitblt_solidfill; - info->fbops->fb_copyarea = s1d13xxxfb_bitblt_copyarea; - info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA; + s1d13xxxfb_fbops.fb_fillrect = s1d13xxxfb_bitblt_solidfill; + s1d13xxxfb_fbops.fb_copyarea = s1d13xxxfb_bitblt_copyarea; + info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | + FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA; break; default : break; |