Subversion Repositories HelenOS

Rev

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

Rev 3679 Rev 3692
Line 175... Line 175...
175
    int color = *(uint16_t *)(src);
175
    int color = *(uint16_t *)(src);
176
    return (((color >> 11) & 0x1f) << (16 + 3)) |
176
    return (((color >> 11) & 0x1f) << (16 + 3)) |
177
        (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
177
        (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
178
}
178
}
179
 
179
 
180
/** Put pixel - 8-bit depth (color palette/3:2:3)
180
/** Put pixel - 8-bit depth (color palette/3:2:3, inverted)
181
 *
181
 *
182
 * Even though we try 3:2:3 color scheme here, an 8-bit framebuffer
182
 * Even though we try 3:2:3 color scheme here, an 8-bit framebuffer
183
 * will most likely use a color palette. The color appearance
183
 * will most likely use a color palette. The color appearance
184
 * will be pretty random and depend on the default installed
184
 * will be pretty random and depend on the default installed
185
 * palette. This could be fixed by supporting custom palette
185
 * palette. This could be fixed by supporting custom palette
186
 * and setting it to simulate the 8-bit truecolor.
186
 * and setting it to simulate the 8-bit truecolor.
-
 
187
 *
-
 
188
 * Currently we set the palette on the sparc64 port.
-
 
189
 *
-
 
190
 * Note that the byte is being inverted by this function. The reason is
-
 
191
 * that we would like to use a color palette where the white color code
-
 
192
 * is 0 and the black color code is 255, as some machines (SunBlade 1500)
-
 
193
 * use these codes for black and white and prevent to set codes
-
 
194
 * 0 and 255 to other colors.
187
 */
195
 */
188
static void rgb_byte8(void *dst, int rgb)
196
static void rgb_byte8(void *dst, int rgb)
189
{
197
{
190
    *((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
198
    *((uint8_t *) dst) = 255 - (RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
191
        BLUE(rgb, 3);
199
        BLUE(rgb, 3));
192
}
200
}
193
 
201
 
194
/** Return pixel color - 8-bit depth (color palette/3:2:3)
202
/** Return pixel color - 8-bit depth (color palette/3:2:3)
195
 *
203
 *
196
 * See the comment for rgb_byte().
204
 * See the comment for rgb_byte().
197
 */
205
 */
198
static int byte8_rgb(void *src)
206
static int byte8_rgb(void *src)
199
{
207
{
200
    int color = *(uint8_t *)src;
208
    int color = 255 - (*(uint8_t *)src);
201
    return (((color >> 5) & 0x7) << (16 + 5)) |
209
    return (((color >> 5) & 0x7) << (16 + 5)) |
202
        (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
210
        (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
203
}
211
}
204
 
212
 
205
static void putpixel(unsigned int x, unsigned int y, int color)
213
static void putpixel(unsigned int x, unsigned int y, int color)
Line 481... Line 489...
481
    }
489
    }
482
   
490
   
483
    unsigned int fbsize = props->scan * props->y;
491
    unsigned int fbsize = props->scan * props->y;
484
   
492
   
485
    /* Map the framebuffer */
493
    /* Map the framebuffer */
486
    fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr + props->offset,
494
    fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr,
487
        fbsize);
495
        fbsize + props->offset);
488
    fbaddress += props->offset;
496
    fbaddress += props->offset;
489
   
497
   
490
    xres = props->x;
498
    xres = props->x;
491
    yres = props->y;
499
    yres = props->y;
492
    scanline = props->scan;
500
    scanline = props->scan;
493
   
501
   
494
    rows = props->y / FONT_SCANLINES;
502
    rows = props->y / FONT_SCANLINES;
495
    columns = props->x / COL_WIDTH;
503
    columns = props->x / COL_WIDTH;
496
 
504
 
497
    fb_parea.pbase = (uintptr_t) props->addr;
505
    fb_parea.pbase = (uintptr_t) props->addr + props->offset;
498
    fb_parea.vbase = (uintptr_t) fbaddress;
506
    fb_parea.vbase = (uintptr_t) fbaddress;
499
    fb_parea.frames = SIZE2FRAMES(fbsize);
507
    fb_parea.frames = SIZE2FRAMES(fbsize);
500
    fb_parea.cacheable = false;
508
    fb_parea.cacheable = false;
501
    ddi_parea_register(&fb_parea);
509
    ddi_parea_register(&fb_parea);
502
 
510