Subversion Repositories HelenOS

Rev

Rev 1787 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1787 Rev 1869
Line 451... Line 451...
451
 * @param addr Address of theframebuffer
451
 * @param addr Address of theframebuffer
452
 * @param xres Screen width in pixels
452
 * @param xres Screen width in pixels
453
 * @param yres Screen height in pixels
453
 * @param yres Screen height in pixels
454
 * @param bpp  Bits per pixel (8, 16, 24, 32)
454
 * @param bpp  Bits per pixel (8, 16, 24, 32)
455
 * @param scan Bytes per one scanline
455
 * @param scan Bytes per one scanline
-
 
456
 * @param align Alignment for 24bpp mode.
456
 *
457
 *
457
 */
458
 */
-
 
459
static void
458
static void screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan)
460
screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan, int align)
459
{
461
{
460
    switch (bpp) {
462
    switch (bpp) {
461
        case 8:
463
        case 8:
462
            screen.rgb2scr = rgb_1byte;
464
            screen.rgb2scr = rgb_1byte;
463
            screen.scr2rgb = byte1_rgb;
465
            screen.scr2rgb = byte1_rgb;
Line 469... Line 471...
469
            screen.pixelbytes = 2;
471
            screen.pixelbytes = 2;
470
            break;
472
            break;
471
        case 24:
473
        case 24:
472
            screen.rgb2scr = rgb_3byte;
474
            screen.rgb2scr = rgb_3byte;
473
            screen.scr2rgb = byte3_rgb;
475
            screen.scr2rgb = byte3_rgb;
-
 
476
            if (!align)
474
            screen.pixelbytes = 3;
477
                screen.pixelbytes = 3;
-
 
478
            else
-
 
479
                screen.pixelbytes = 4;
475
            break;
480
            break;
476
        case 32:
481
        case 32:
477
            screen.rgb2scr = rgb_4byte;
482
            screen.rgb2scr = rgb_4byte;
478
            screen.scr2rgb = byte4_rgb;
483
            screen.scr2rgb = byte4_rgb;
479
            screen.pixelbytes = 4;
484
            screen.pixelbytes = 4;
Line 1214... Line 1219...
1214
{
1219
{
1215
    void *fb_ph_addr;
1220
    void *fb_ph_addr;
1216
    unsigned int fb_width;
1221
    unsigned int fb_width;
1217
    unsigned int fb_height;
1222
    unsigned int fb_height;
1218
    unsigned int fb_bpp;
1223
    unsigned int fb_bpp;
-
 
1224
    unsigned int fb_bpp_align;
1219
    unsigned int fb_scanline;
1225
    unsigned int fb_scanline;
1220
    void *fb_addr;
1226
    void *fb_addr;
1221
    size_t asz;
1227
    size_t asz;
1222
 
1228
 
1223
    async_set_client_connection(fb_client_connection);
1229
    async_set_client_connection(fb_client_connection);
1224
 
1230
 
1225
    fb_ph_addr=(void *)sysinfo_value("fb.address.physical");
1231
    fb_ph_addr=(void *)sysinfo_value("fb.address.physical");
1226
    fb_width=sysinfo_value("fb.width");
1232
    fb_width=sysinfo_value("fb.width");
1227
    fb_height=sysinfo_value("fb.height");
1233
    fb_height=sysinfo_value("fb.height");
1228
    fb_bpp=sysinfo_value("fb.bpp");
1234
    fb_bpp=sysinfo_value("fb.bpp");
-
 
1235
    fb_bpp_align=sysinfo_value("fb.bpp-align");
1229
    fb_scanline=sysinfo_value("fb.scanline");
1236
    fb_scanline=sysinfo_value("fb.scanline");
1230
 
1237
 
1231
    asz = fb_scanline*fb_height;
1238
    asz = fb_scanline*fb_height;
1232
    fb_addr = as_get_mappable_page(asz);
1239
    fb_addr = as_get_mappable_page(asz);
1233
   
1240
   
1234
    map_physmem(fb_ph_addr, fb_addr, ALIGN_UP(asz,PAGE_SIZE) >>PAGE_WIDTH,
1241
    map_physmem(fb_ph_addr, fb_addr, ALIGN_UP(asz,PAGE_SIZE) >>PAGE_WIDTH,
1235
            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
1242
            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
1236
   
1243
   
1237
    screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline);
1244
    screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline, fb_bpp_align);
1238
 
1245
 
1239
    return 0;
1246
    return 0;
1240
}
1247
}
1241
 
1248
 
1242
 
1249