Changeset 943a1dc6 in mainline


Ignore:
Timestamp:
2013-01-20T22:59:36Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ab189f
Parents:
f03f107
Message:

amdm37x_dispc: Set workhorse function on mode switch.

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

Legend:

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

    rf03f107 r943a1dc6  
    5555
    5656
    57 static unsigned visual2bpp(visual_t visual)
    58 {
    59         switch(visual) {
    60         case VISUAL_INDIRECT_8:
    61                 return 1;
    62         case VISUAL_RGB_5_5_5_LE:
    63         case VISUAL_RGB_5_5_5_BE:
    64         case VISUAL_RGB_5_6_5_LE:
    65         case VISUAL_RGB_5_6_5_BE:
    66                 return 2;
    67         case VISUAL_BGR_8_8_8:
    68         case VISUAL_RGB_8_8_8:
    69                 return 3;
    70         case VISUAL_BGR_0_8_8_8:
    71         case VISUAL_BGR_8_8_8_0:
    72         case VISUAL_ABGR_8_8_8_8:
    73         case VISUAL_BGRA_8_8_8_8:
    74         case VISUAL_RGB_0_8_8_8:
    75         case VISUAL_RGB_8_8_8_0:
    76         case VISUAL_ARGB_8_8_8_8:
    77         case VISUAL_RGBA_8_8_8_8:
    78                 return 4;
    79         case VISUAL_UNKNOWN:
    80                 return 0;
    81         }
    82         return 0;
    83 }
     57static const struct {
     58        unsigned bpp;
     59        pixel2visual_t func;
     60} pixel2visual_table[] = {
     61        [VISUAL_INDIRECT_8] = { .bpp = 1, .func = pixel2bgr_323 },
     62        [VISUAL_RGB_5_5_5_LE] = { .bpp = 2, .func = pixel2rgb_555_le },
     63        [VISUAL_RGB_5_5_5_BE] = { .bpp = 2, .func = pixel2rgb_555_be },
     64        [VISUAL_RGB_5_6_5_LE] = { .bpp = 2, .func = pixel2rgb_565_le },
     65        [VISUAL_RGB_5_6_5_BE] = { .bpp = 2, .func = pixel2rgb_565_be },
     66        [VISUAL_BGR_8_8_8] = { .bpp = 3, .func = pixel2bgr_888 },
     67        [VISUAL_RGB_8_8_8] = { .bpp = 3, .func = pixel2rgb_888 },
     68        [VISUAL_BGR_0_8_8_8] = { .bpp = 4, .func = pixel2rgb_0888 },
     69        [VISUAL_BGR_8_8_8_0] = { .bpp = 4, .func = pixel2bgr_8880 },
     70        [VISUAL_ABGR_8_8_8_8] = { .bpp = 4, .func = pixel2abgr_8888 },
     71        [VISUAL_BGRA_8_8_8_8] = { .bpp = 4, .func = pixel2bgra_8888 },
     72        [VISUAL_RGB_0_8_8_8] = { .bpp = 4, .func = pixel2rgb_0888 },
     73        [VISUAL_RGB_8_8_8_0] = { .bpp = 4, .func = pixel2rgb_8880 },
     74        [VISUAL_ARGB_8_8_8_8] = { .bpp = 4, .func = pixel2argb_8888 },
     75        [VISUAL_RGBA_8_8_8_8] = { .bpp = 4, .func = pixel2rgba_8888 },
     76};
     77
     78
    8479
    8580static void mode_init(vslmode_list_element_t *mode,
     
    251246        amdm37x_dispc_t *dispc = vis->dev_ctx;
    252247        const visual_t visual = mode.cell_visual.pixel_visual;
    253         const unsigned bpp = visual2bpp(visual);
     248        assert(visual < sizeof(pixel2visual_table) / sizeof(pixel2visual_table[0]));
     249        const unsigned bpp = pixel2visual_table[visual].bpp;
     250        pixel2visual_t p2v = pixel2visual_table[visual].func;
    254251        const unsigned x = mode.screen_width;
    255252        const unsigned y = mode.screen_height;
     
    269266        dispc->active_fb.pitch = 0;
    270267        dispc->active_fb.bpp = bpp;
     268        dispc->active_fb.pixel2visual = p2v;
    271269        assert(mode.index < 1);
    272270
     
    293291                        pixel_t *pixel = pixelmap_pixel_at(map, x0, y);
    294292                        for (sysarg_t x = x0; x < width + x0; ++x) {
    295                                 dispc->pixel2visual(
     293                                dispc->active_fb.pixel2visual(
    296294                                    dispc->fb_data + FB_POS(x, y), *pixel++);
    297295                        }
     
    300298                for (sysarg_t y = y0; y < height + y0; ++y) {
    301299                        for (sysarg_t x = x0; x < width + x0; ++x) {
    302                                 dispc->pixel2visual(
     300                                dispc->active_fb.pixel2visual(
    303301                                    dispc->fb_data + FB_POS(x, y),
    304302                                    *pixelmap_pixel_at(map,
  • uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.h

    rf03f107 r943a1dc6  
    4646        amdm37x_dispc_regs_t *regs;
    4747
    48         unsigned offset;
    49         visual_t visual;
    50 
    51         pixel2visual_t pixel2visual;
    52         visual2pixel_t visual2pixel;
    53         visual_mask_t visual_mask;
    54 
    5548        struct {
     49                pixel2visual_t pixel2visual;
    5650                unsigned width;
    5751                unsigned height;
Note: See TracChangeset for help on using the changeset viewer.