Changeset f03f107 in mainline


Ignore:
Timestamp:
2013-01-20T22:40:05Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
943a1dc6
Parents:
7fa2031
Message:

amdm37x_dispc: Implement damage_handling.

Copied over from kfb.

Location:
uspace/drv/fb/amdm37x_dispc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c

    r7fa2031 rf03f107  
    244244}
    245245
    246 static int handle_damage(visualizer_t *vs,
    247     sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height,
    248     sysarg_t x_offset, sysarg_t y_offset)
    249 {
    250         ddf_log_fatal("Handling damage\n");
    251         return EOK;
    252 }
    253 
    254246static int change_mode(visualizer_t *vis, vslmode_t mode)
    255247{
     
    258250
    259251        amdm37x_dispc_t *dispc = vis->dev_ctx;
    260         const unsigned bpp = visual2bpp(mode.cell_visual.pixel_visual);
     252        const visual_t visual = mode.cell_visual.pixel_visual;
     253        const unsigned bpp = visual2bpp(visual);
    261254        const unsigned x = mode.screen_width;
    262255        const unsigned y = mode.screen_height;
     
    271264        }
    272265        amdm37x_dispc_setup_fb(dispc->regs, x, y, bpp, (uint32_t)pa);
     266        dispc->active_fb.idx = mode.index;
     267        dispc->active_fb.width = x;
     268        dispc->active_fb.height = y;
     269        dispc->active_fb.pitch = 0;
     270        dispc->active_fb.bpp = bpp;
     271        assert(mode.index < 1);
    273272
    274273        if (dispc->fb_data)
     
    276275        return EOK;
    277276}
     277
     278static int handle_damage(visualizer_t *vs,
     279    sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height,
     280    sysarg_t x_offset, sysarg_t y_offset)
     281{
     282        assert(vs);
     283        assert(vs->dev_ctx);
     284        amdm37x_dispc_t *dispc = vs->dev_ctx;
     285        pixelmap_t *map = &vs->cells;
     286
     287#define FB_POS(x, y) \
     288        (((y) * (dispc->active_fb.width + dispc->active_fb.pitch) + (x)) \
     289            * dispc->active_fb.bpp)
     290        if (x_offset == 0 && y_offset == 0) {
     291                /* Faster damage routine ignoring offsets. */
     292                for (sysarg_t y = y0; y < height + y0; ++y) {
     293                        pixel_t *pixel = pixelmap_pixel_at(map, x0, y);
     294                        for (sysarg_t x = x0; x < width + x0; ++x) {
     295                                dispc->pixel2visual(
     296                                    dispc->fb_data + FB_POS(x, y), *pixel++);
     297                        }
     298                }
     299        } else {
     300                for (sysarg_t y = y0; y < height + y0; ++y) {
     301                        for (sysarg_t x = x0; x < width + x0; ++x) {
     302                                dispc->pixel2visual(
     303                                    dispc->fb_data + FB_POS(x, y),
     304                                    *pixelmap_pixel_at(map,
     305                                        (x + x_offset) % map->width,
     306                                        (y + y_offset) % map->height));
     307                        }
     308                }
     309        }
     310
     311        ddf_log_note("Handling damage\n");
     312        return EOK;
     313}
     314
  • uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.h

    r7fa2031 rf03f107  
    4646        amdm37x_dispc_regs_t *regs;
    4747
    48         unsigned fb_width;
    49         unsigned fb_height;
    5048        unsigned offset;
    51         unsigned scanline;
    5249        visual_t visual;
    5350
     
    5552        visual2pixel_t visual2pixel;
    5653        visual_mask_t visual_mask;
    57         unsigned pixel_bytes;
     54
     55        struct {
     56                unsigned width;
     57                unsigned height;
     58                unsigned pitch;
     59                unsigned bpp;
     60                unsigned idx;
     61        } active_fb;
    5862
    5963        size_t size;
Note: See TracChangeset for help on using the changeset viewer.