Subversion Repositories HelenOS

Rev

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

Rev 3675 Rev 3684
Line 189... Line 189...
189
{
189
{
190
    *((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
190
    *((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
191
        BLUE(rgb, 3);
191
        BLUE(rgb, 3);
192
}
192
}
193
 
193
 
194
static void sb1500rgb_byte8(void *dst, int rgb)
-
 
195
{
-
 
196
    if (RED(rgb, 1) && GREEN(rgb, 1) && BLUE(rgb, 1))
-
 
197
        *((uint8_t *) dst) = 255;
-
 
198
    else if (RED(rgb, 1) && GREEN(rgb, 1))
-
 
199
        *((uint8_t *) dst) = 150;
-
 
200
    else if (GREEN(rgb, 1) && BLUE(rgb, 1))
-
 
201
        *((uint8_t *) dst) = 47;
-
 
202
    else if (RED(rgb, 1) && BLUE(rgb, 1))
-
 
203
        *((uint8_t *) dst) = 48;
-
 
204
    else if (RED(rgb, 1))
-
 
205
        *((uint8_t *) dst) = 32;
-
 
206
    else if (GREEN(rgb, 1))
-
 
207
        *((uint8_t *) dst) = 47;
-
 
208
    else if (BLUE(rgb, 1))
-
 
209
        *((uint8_t *) dst) = 2;
-
 
210
    else
-
 
211
        *((uint8_t *) dst) = 1;
-
 
212
}
-
 
213
 
-
 
214
/** Return pixel color - 8-bit depth (color palette/3:2:3)
194
/** Return pixel color - 8-bit depth (color palette/3:2:3)
215
 *
195
 *
216
 * See the comment for rgb_byte().
196
 * See the comment for rgb_byte().
217
 */
197
 */
218
static int byte8_rgb(void *src)
198
static int byte8_rgb(void *src)
Line 464... Line 444...
464
    case VISUAL_INDIRECT_8:
444
    case VISUAL_INDIRECT_8:
465
        rgb2scr = rgb_byte8;
445
        rgb2scr = rgb_byte8;
466
        scr2rgb = byte8_rgb;
446
        scr2rgb = byte8_rgb;
467
        pixelbytes = 1;
447
        pixelbytes = 1;
468
        break;
448
        break;
469
    case VISUAL_SB1500_PALETTE:
-
 
470
        rgb2scr = sb1500rgb_byte8;
-
 
471
        scr2rgb = byte8_rgb;
-
 
472
        pixelbytes = 1;
-
 
473
        break;
-
 
474
    case VISUAL_RGB_5_5_5:
449
    case VISUAL_RGB_5_5_5:
475
        rgb2scr = rgb_byte555;
450
        rgb2scr = rgb_byte555;
476
        scr2rgb = byte555_rgb;
451
        scr2rgb = byte555_rgb;
477
        pixelbytes = 2;
452
        pixelbytes = 2;
478
        break;
453
        break;
Line 503... Line 478...
503
        break;
478
        break;
504
    default:
479
    default:
505
        panic("Unsupported visual.\n");
480
        panic("Unsupported visual.\n");
506
    }
481
    }
507
   
482
   
508
    unsigned int fbsize = props->scan * props->y + props->offset;
483
    unsigned int fbsize = props->scan * props->y;
509
   
484
   
510
    /* Map the framebuffer */
485
    /* Map the framebuffer */
511
    fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr, fbsize);
486
    fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr + props->offset,
-
 
487
        fbsize);
512
    fbaddress += props->offset;
488
    fbaddress += props->offset;
513
   
489
   
514
    xres = props->x;
490
    xres = props->x;
515
    yres = props->y;
491
    yres = props->y;
516
    scanline = props->scan;
492
    scanline = props->scan;
Line 529... Line 505...
529
    sysinfo_set_item_val("fb.width", NULL, xres);
505
    sysinfo_set_item_val("fb.width", NULL, xres);
530
    sysinfo_set_item_val("fb.height", NULL, yres);
506
    sysinfo_set_item_val("fb.height", NULL, yres);
531
    sysinfo_set_item_val("fb.scanline", NULL, props->scan);
507
    sysinfo_set_item_val("fb.scanline", NULL, props->scan);
532
    sysinfo_set_item_val("fb.visual", NULL, props->visual);
508
    sysinfo_set_item_val("fb.visual", NULL, props->visual);
533
    sysinfo_set_item_val("fb.address.physical", NULL, props->addr);
509
    sysinfo_set_item_val("fb.address.physical", NULL, props->addr);
-
 
510
    sysinfo_set_item_val("fb.offset", NULL, props->offset);
534
    sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors);
511
    sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors);
535
 
512
 
536
    /* Allocate double buffer */
513
    /* Allocate double buffer */
537
    unsigned int order = fnzb(SIZE2FRAMES(fbsize) - 1) + 1;
514
    unsigned int order = fnzb(SIZE2FRAMES(fbsize) - 1) + 1;
538
    dbbuffer = (uint8_t *) frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
515
    dbbuffer = (uint8_t *) frame_alloc(order, FRAME_ATOMIC | FRAME_KA);