• Antonino Daplas's avatar
    [PATCH] fbdev: Add Tile Blitting support · c76d035d
    Antonino Daplas authored
    Hopefully, this patch fixes one last major regression for one particular
    driver, namely matroxfb.  This drier has 2 versions, one for the kernel and
    another as a '2.4 backport' patch.
    
    This patch adds a tileblitting extension to fbcon.  This extension, in
    summary, is basically a forward-port of the 2.4 fbdev/fbcon framework to 2.6
    but without the fbcon dependency.  Tile blitting is similar to bitblit, except
    that the basic unit is a tile (a bitmap of x-by-y dimensions).  The display,
    instead of being described in terms of pixels and scanlines, are described as
    a region further subdivided into rectangular sections.  In fbcon parlance, a
    tile is a character.
    
    Besides a possible fix for matroxfb, tileblitting can be advantageous for
    hardware that supports some kind of fontcaching mechanism.  Also, in the
    unlikely chance that the console begins supporting multicolored fonts,
    tileblitting is probably more optimal than bitblitting because bitblitting
    will need to push more data through the bus.
    
    To enable support for this extension, a driver needs to:
    
    - enable CONFIG_FB_TILEBLITTING
    - set FBINFO_MISC_TILEBLITTING in info->flags
    - set the required function pointers in struct fb_tileops.  The required
      operations are:
    
      - void (*fb_settile)(struct fb_info *info, struct fb_tilemap *map);
    
        tells driver about the tile characteristics (dimensions, bitdepth) and
        about the tilemap which is an array of bitmaps: display->fontdata
    
      - void (*fb_tilecopy)(struct fb_info *info, struct fb_tilearea *area);
    
        move a rectangular section of tiles (bmove)
    
      - void (*fb_tilefill)(struct fb_info *info, struct fb_tilerect *rect);
    
        fill a rectangular section with a tile (clear)
    
      - void (*fb_tileblit)(struct fb_info *info, struct fb_tileblit *blit);
    
        copy an array of tiles to a rectangular section (putcs)
    
      - void (*fb_tilecursor)(struct fb_info *info, struct fb_tilecursor *cursor);
    
        cursor function
    
    Changes:
    
    Addition of this extension necessitates cleanup of fbcon.c.  The basic drawing
    functions in fbcon are bmove, clear, putcs and cursor (the fbcon_* set).  The
    fbcon_* set are just wrappers to accel_* set.  However, usage is not
    consistent, some functions call the fbcon_* set, others call the accel_* set.
    
    With this patch, a new fbcon-specific structure (struct fbcon_ops) is created.
     Depending on the setting of the hardware, this struct contains pointers to
    either the tileblitting set or the bitblitting set (formerly the accel_* set).
     The tileblitting set is new in this patch.
    
    The vast majority of functions in fbcon will need to only call the fbcon_*
    set.  In turn, it calls functions in struct fbcon_ops.  Knowledge of the
    blitting type is not required.
    
    The accel_* set is renamed to bit_* and is moved into a separate file,
    bitblit.c.  The tile blitting set is in tileblit.c.
    
    In my case at least, the cleanup did produce an unexpected but beneficial
    side effect, a little more speedup.  Not much, < 5%.
    
    Petr, if you have comments, suggestions, or you think this is a bad idea,
    let me know.
    Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    c76d035d
tileblit.c 3.48 KB