Subversion Repositories HelenOS

Rev

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

Rev 4377 Rev 4692
Line 49... Line 49...
49
#include <ipc/ipc.h>
49
#include <ipc/ipc.h>
50
#include <ipc/ns.h>
50
#include <ipc/ns.h>
51
#include <ipc/services.h>
51
#include <ipc/services.h>
52
#include <kernel/errno.h>
52
#include <kernel/errno.h>
53
#include <kernel/genarch/fb/visuals.h>
53
#include <kernel/genarch/fb/visuals.h>
54
#include <console/color.h>
54
#include <io/color.h>
55
#include <console/style.h>
55
#include <io/style.h>
56
#include <async.h>
56
#include <async.h>
-
 
57
#include <fibril.h>
57
#include <bool.h>
58
#include <bool.h>
-
 
59
#include <stdio.h>
-
 
60
#include <byteorder.h>
58
 
61
 
59
#include "font-8x16.h"
62
#include "font-8x16.h"
60
#include "fb.h"
63
#include "fb.h"
61
#include "main.h"
64
#include "main.h"
62
#include "../console/screenbuffer.h"
65
#include "../console/screenbuffer.h"
Line 208... Line 211...
208
 
211
 
209
static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col,
212
static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col,
210
    unsigned int row);
213
    unsigned int row);
211
 
214
 
212
 
215
 
213
#define RED(x, bits)                 ((x >> (8 + 8 + 8 - bits)) & ((1 << bits) - 1))
216
#define RED(x, bits)                 (((x) >> (8 + 8 + 8 - (bits))) & ((1 << (bits)) - 1))
214
#define GREEN(x, bits)               ((x >> (8 + 8 - bits)) & ((1 << bits) - 1))
217
#define GREEN(x, bits)               (((x) >> (8 + 8 - (bits))) & ((1 << (bits)) - 1))
215
#define BLUE(x, bits)                ((x >> (8 - bits)) & ((1 << bits) - 1))
218
#define BLUE(x, bits)                (((x) >> (8 - (bits))) & ((1 << (bits)) - 1))
216
 
219
 
217
#define COL2X(col)                   ((col) * FONT_WIDTH)
220
#define COL2X(col)                   ((col) * FONT_WIDTH)
218
#define ROW2Y(row)                   ((row) * FONT_SCANLINES)
221
#define ROW2Y(row)                   ((row) * FONT_SCANLINES)
219
 
222
 
220
#define X2COL(x)                     ((x) / FONT_WIDTH)
223
#define X2COL(x)                     ((x) / FONT_WIDTH)
Line 222... Line 225...
222
 
225
 
223
#define FB_POS(x, y)                 ((y) * screen.scanline + (x) * screen.pixelbytes)
226
#define FB_POS(x, y)                 ((y) * screen.scanline + (x) * screen.pixelbytes)
224
#define BB_POS(vport, col, row)      ((row) * vport->cols + (col))
227
#define BB_POS(vport, col, row)      ((row) * vport->cols + (col))
225
#define GLYPH_POS(glyph, y, cursor)  (((glyph) + (cursor) * FONT_GLYPHS) * screen.glyphbytes + (y) * screen.glyphscanline)
228
#define GLYPH_POS(glyph, y, cursor)  (((glyph) + (cursor) * FONT_GLYPHS) * screen.glyphbytes + (y) * screen.glyphscanline)
226
 
229
 
227
 
230
/*
228
/** ARGB 8:8:8:8 conversion
231
 * RGB conversion and mask functions.
229
 *
232
 *
-
 
233
 * These functions write an RGB value to some memory in some predefined format.
-
 
234
 * The naming convention corresponds to the format created by these functions.
-
 
235
 * The functions use the so called network order (i.e. big endian) with respect
-
 
236
 * to their names.
230
 */
237
 */
-
 
238
 
231
static void rgb_0888(void *dst, uint32_t rgb)
239
static void rgb_0888(void *dst, uint32_t rgb)
232
{
240
{
233
    *((uint32_t *) dst) = rgb & 0x00ffffff;
241
    *((uint32_t *) dst) = host2uint32_t_be((0 << 24) |
-
 
242
        (RED(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | (BLUE(rgb, 8)));
-
 
243
}
-
 
244
 
-
 
245
static void bgr_0888(void *dst, uint32_t rgb)
-
 
246
{
-
 
247
    *((uint32_t *) dst) = host2uint32_t_be((0 << 24) |
-
 
248
        (BLUE(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | (RED(rgb, 8)));
234
}
249
}
235
 
250
 
236
static void mask_0888(void *dst, bool mask)
251
static void mask_0888(void *dst, bool mask)
237
{
252
{
238
    *((uint32_t *) dst) = (mask ? 0x00ffffff : 0);
253
    bgr_0888(dst, mask ? 0xffffff : 0);
239
}
254
}
240
 
255
 
-
 
256
static void rgb_8880(void *dst, uint32_t rgb)
-
 
257
{
-
 
258
    *((uint32_t *) dst) = host2uint32_t_be((RED(rgb, 8) << 24) |
-
 
259
        (GREEN(rgb, 8) << 16) | (BLUE(rgb, 8) << 8) | 0);
-
 
260
}
241
 
261
 
242
/** ABGR 8:8:8:8 conversion
-
 
243
 *
-
 
244
 */
-
 
245
static void bgr_0888(void *dst, uint32_t rgb)
262
static void bgr_8880(void *dst, uint32_t rgb)
246
{
263
{
247
    *((uint32_t *) dst)
264
    *((uint32_t *) dst) = host2uint32_t_be((BLUE(rgb, 8) << 24) |
248
        = (BLUE(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | RED(rgb, 8);
265
        (GREEN(rgb, 8) << 16) | (RED(rgb, 8) << 8) | 0);
249
}
266
}
250
 
267
 
-
 
268
static void mask_8880(void *dst, bool mask)
-
 
269
{
-
 
270
    bgr_8880(dst, mask ? 0xffffff : 0);
-
 
271
}
251
 
272
 
252
/** RGB 8:8:8 conversion
-
 
253
 *
-
 
254
 */
-
 
255
static void rgb_888(void *dst, uint32_t rgb)
273
static void rgb_888(void *dst, uint32_t rgb)
256
{
274
{
-
 
275
    ((uint8_t *) dst)[0] = RED(rgb, 8);
-
 
276
    ((uint8_t *) dst)[1] = GREEN(rgb, 8);
-
 
277
    ((uint8_t *) dst)[2] = BLUE(rgb, 8);
-
 
278
}
-
 
279
 
-
 
280
static void bgr_888(void *dst, uint32_t rgb)
-
 
281
{
257
    ((uint8_t *) dst)[0] = BLUE(rgb, 8);
282
    ((uint8_t *) dst)[0] = BLUE(rgb, 8);
258
    ((uint8_t *) dst)[1] = GREEN(rgb, 8);
283
    ((uint8_t *) dst)[1] = GREEN(rgb, 8);
259
    ((uint8_t *) dst)[2] = RED(rgb, 8);
284
    ((uint8_t *) dst)[2] = RED(rgb, 8);
260
}
285
}
261
 
286
 
262
static void mask_888(void *dst, bool mask)
287
static void mask_888(void *dst, bool mask)
263
{
288
{
264
    if (mask) {
-
 
265
        ((uint8_t *) dst)[0] = 0xff;
-
 
266
        ((uint8_t *) dst)[1] = 0xff;
-
 
267
        ((uint8_t *) dst)[2] = 0xff;
-
 
268
    } else {
-
 
269
        ((uint8_t *) dst)[0] = 0;
-
 
270
        ((uint8_t *) dst)[1] = 0;
-
 
271
        ((uint8_t *) dst)[2] = 0;
289
    bgr_888(dst, mask ? 0xffffff : 0);
272
    }
-
 
273
}
290
}
274
 
291
 
275
 
-
 
276
/** BGR 8:8:8 conversion
-
 
277
 *
-
 
278
 */
-
 
279
static void bgr_888(void *dst, uint32_t rgb)
292
static void rgb_555_be(void *dst, uint32_t rgb)
280
{
293
{
281
    ((uint8_t *) dst)[0] = RED(rgb, 8);
294
    *((uint16_t *) dst) = host2uint16_t_be(RED(rgb, 5) << 10 |
282
    ((uint8_t *) dst)[1] = GREEN(rgb, 8);
-
 
283
    ((uint8_t *) dst)[2] = BLUE(rgb, 8);
295
        GREEN(rgb, 5) << 5 | BLUE(rgb, 5));
284
}
296
}
285
 
297
 
286
 
-
 
287
/** RGB 5:5:5 conversion
-
 
288
 *
-
 
289
 */
-
 
290
static void rgb_555(void *dst, uint32_t rgb)
298
static void rgb_555_le(void *dst, uint32_t rgb)
291
{
299
{
292
    *((uint16_t *) dst)
300
    *((uint16_t *) dst) = host2uint16_t_le(RED(rgb, 5) << 10 |
293
        = (RED(rgb, 5) << 10) | (GREEN(rgb, 5) << 5) | BLUE(rgb, 5);
301
        GREEN(rgb, 5) << 5 | BLUE(rgb, 5));
294
}
302
}
295
 
303
 
296
static void mask_555(void *dst, bool mask)
304
static void rgb_565_be(void *dst, uint32_t rgb)
297
{
305
{
298
    *((uint16_t *) dst) = (mask ? 0x7fff : 0);
306
    *((uint16_t *) dst) = host2uint16_t_be(RED(rgb, 5) << 11 |
-
 
307
        GREEN(rgb, 6) << 5 | BLUE(rgb, 5));
299
}
308
}
300
 
309
 
-
 
310
static void rgb_565_le(void *dst, uint32_t rgb)
-
 
311
{
-
 
312
    *((uint16_t *) dst) = host2uint16_t_le(RED(rgb, 5) << 11 |
-
 
313
        GREEN(rgb, 6) << 5 | BLUE(rgb, 5));
-
 
314
}
301
 
315
 
302
/** RGB 5:6:5 conversion
-
 
303
 *
-
 
304
 */
-
 
305
static void rgb_565(void *dst, uint32_t rgb)
316
static void mask_555(void *dst, bool mask)
306
{
317
{
307
    *((uint16_t *) dst)
-
 
308
        = (RED(rgb, 5) << 11) | (GREEN(rgb, 6) << 5) | BLUE(rgb, 5);
318
    rgb_555_be(dst, mask ? 0xffffff : 0);
309
}
319
}
310
 
320
 
311
static void mask_565(void *dst, bool mask)
321
static void mask_565(void *dst, bool mask)
312
{
322
{
313
    *((uint16_t *) dst) = (mask ? 0xffff : 0);
323
    rgb_565_be(dst, mask ? 0xffffff : 0);
314
}
324
}
315
 
325
 
316
 
-
 
317
/** RGB 3:2:3
-
 
318
 *
-
 
319
 */
-
 
320
static void rgb_323(void *dst, uint32_t rgb)
326
static void bgr_323(void *dst, uint32_t rgb)
321
{
327
{
322
    *((uint8_t *) dst)
328
    *((uint8_t *) dst)
323
        = ~((RED(rgb, 3) << 5) | (GREEN(rgb, 2) << 3) | BLUE(rgb, 3));
329
        = ~((RED(rgb, 3) << 5) | (GREEN(rgb, 2) << 3) | BLUE(rgb, 3));
324
}
330
}
325
 
331
 
326
static void mask_323(void *dst, bool mask)
332
static void mask_323(void *dst, bool mask)
327
{
333
{
328
    *((uint8_t *) dst) = (mask ? 0xff : 0);
334
    bgr_323(dst, mask ? 0x0 : ~0x0);
329
}
335
}
330
 
336
 
331
/** Draw a filled rectangle.
337
/** Draw a filled rectangle.
332
 *
338
 *
333
 * @note Need real implementation that does not access VRAM twice.
339
 * @note Need real implementation that does not access VRAM twice.
Line 373... Line 379...
373
 * @param vport Viewport to redraw
379
 * @param vport Viewport to redraw
374
 *
380
 *
375
 */
381
 */
376
static void vport_redraw(viewport_t *vport)
382
static void vport_redraw(viewport_t *vport)
377
{
383
{
378
    unsigned int row;
-
 
379
    unsigned int col;
384
    unsigned int col;
-
 
385
    unsigned int row;
380
   
386
   
381
    for (row = 0; row < vport->rows; row++) {
387
    for (row = 0; row < vport->rows; row++) {
382
        for (col = 0; col < vport->cols; col++) {
388
        for (col = 0; col < vport->cols; col++) {
383
            draw_vp_glyph(vport, false, col, row);
389
            draw_vp_glyph(vport, false, col, row);
384
        }
390
        }
Line 429... Line 435...
429
 * @param lines Number of lines to scroll
435
 * @param lines Number of lines to scroll
430
 *
436
 *
431
 */
437
 */
432
static void vport_scroll(viewport_t *vport, int lines)
438
static void vport_scroll(viewport_t *vport, int lines)
433
{
439
{
434
    unsigned int row;
-
 
435
    unsigned int col;
440
    unsigned int col;
-
 
441
    unsigned int row;
436
    unsigned int x;
442
    unsigned int x;
437
    unsigned int y;
443
    unsigned int y;
438
    uint32_t glyph;
444
    uint32_t glyph;
439
    uint32_t fg_color;
445
    uint32_t fg_color;
440
    uint32_t bg_color;
446
    uint32_t bg_color;
Line 447... Line 453...
447
   
453
   
448
    y = vport->y;
454
    y = vport->y;
449
    for (row = 0; row < vport->rows; row++) {
455
    for (row = 0; row < vport->rows; row++) {
450
        x = vport->x;
456
        x = vport->x;
451
        for (col = 0; col < vport->cols; col++) {
457
        for (col = 0; col < vport->cols; col++) {
-
 
458
            if (((int) row + lines >= 0) &&
452
            if ((row + lines >= 0) && (row + lines < vport->rows)) {
459
                ((int) row + lines < (int) vport->rows)) {
453
                xbp = &vport->backbuf[BB_POS(vport, col, row + lines)];
460
                xbp = &vport->backbuf[BB_POS(vport, col, row + lines)];
454
                bbp = &vport->backbuf[BB_POS(vport, col, row)];
461
                bbp = &vport->backbuf[BB_POS(vport, col, row)];
455
               
462
               
456
                glyph = xbp->glyph;
463
                glyph = xbp->glyph;
457
                fg_color = xbp->fg_color;
464
                fg_color = xbp->fg_color;
Line 616... Line 623...
616
 *
623
 *
617
 */
624
 */
618
static bool screen_init(void *addr, unsigned int xres, unsigned int yres,
625
static bool screen_init(void *addr, unsigned int xres, unsigned int yres,
619
    unsigned int scan, unsigned int visual)
626
    unsigned int scan, unsigned int visual)
620
{
627
{
621
   
-
 
622
   
-
 
623
    switch (visual) {
628
    switch (visual) {
624
    case VISUAL_INDIRECT_8:
629
    case VISUAL_INDIRECT_8:
625
        screen.rgb_conv = rgb_323;
630
        screen.rgb_conv = bgr_323;
626
        screen.mask_conv = mask_323;
631
        screen.mask_conv = mask_323;
627
        screen.pixelbytes = 1;
632
        screen.pixelbytes = 1;
628
        break;
633
        break;
629
    case VISUAL_RGB_5_5_5:
634
    case VISUAL_RGB_5_5_5_LE:
-
 
635
        screen.rgb_conv = rgb_555_le;
-
 
636
        screen.mask_conv = mask_555;
-
 
637
        screen.pixelbytes = 2;
-
 
638
        break;
-
 
639
    case VISUAL_RGB_5_5_5_BE:
630
        screen.rgb_conv = rgb_555;
640
        screen.rgb_conv = rgb_555_be;
631
        screen.mask_conv = mask_555;
641
        screen.mask_conv = mask_555;
632
        screen.pixelbytes = 2;
642
        screen.pixelbytes = 2;
633
        break;
643
        break;
634
    case VISUAL_RGB_5_6_5:
644
    case VISUAL_RGB_5_6_5_LE:
-
 
645
        screen.rgb_conv = rgb_565_le;
-
 
646
        screen.mask_conv = mask_565;
-
 
647
        screen.pixelbytes = 2;
-
 
648
        break;
-
 
649
    case VISUAL_RGB_5_6_5_BE:
635
        screen.rgb_conv = rgb_565;
650
        screen.rgb_conv = rgb_565_be;
636
        screen.mask_conv = mask_565;
651
        screen.mask_conv = mask_565;
637
        screen.pixelbytes = 2;
652
        screen.pixelbytes = 2;
638
        break;
653
        break;
639
    case VISUAL_RGB_8_8_8:
654
    case VISUAL_RGB_8_8_8:
640
        screen.rgb_conv = rgb_888;
655
        screen.rgb_conv = rgb_888;
Line 645... Line 660...
645
        screen.rgb_conv = bgr_888;
660
        screen.rgb_conv = bgr_888;
646
        screen.mask_conv = mask_888;
661
        screen.mask_conv = mask_888;
647
        screen.pixelbytes = 3;
662
        screen.pixelbytes = 3;
648
        break;
663
        break;
649
    case VISUAL_RGB_8_8_8_0:
664
    case VISUAL_RGB_8_8_8_0:
650
        screen.rgb_conv = rgb_888;
665
        screen.rgb_conv = rgb_8880;
651
        screen.mask_conv = mask_888;
666
        screen.mask_conv = mask_8880;
652
        screen.pixelbytes = 4;
667
        screen.pixelbytes = 4;
653
        break;
668
        break;
654
    case VISUAL_RGB_0_8_8_8:
669
    case VISUAL_RGB_0_8_8_8:
655
        screen.rgb_conv = rgb_0888;
670
        screen.rgb_conv = rgb_0888;
656
        screen.mask_conv = mask_0888;
671
        screen.mask_conv = mask_0888;
Line 659... Line 674...
659
    case VISUAL_BGR_0_8_8_8:
674
    case VISUAL_BGR_0_8_8_8:
660
        screen.rgb_conv = bgr_0888;
675
        screen.rgb_conv = bgr_0888;
661
        screen.mask_conv = mask_0888;
676
        screen.mask_conv = mask_0888;
662
        screen.pixelbytes = 4;
677
        screen.pixelbytes = 4;
663
        break;
678
        break;
-
 
679
    case VISUAL_BGR_8_8_8_0:
-
 
680
        screen.rgb_conv = bgr_8880;
-
 
681
        screen.mask_conv = mask_8880;
-
 
682
        screen.pixelbytes = 4;
-
 
683
        break;
664
    default:
684
    default:
665
        return false;
685
        return false;
666
    }
686
    }
667
   
687
   
668
    screen.fb_addr = (unsigned char *) addr;
688
    screen.fb_addr = (unsigned char *) addr;
Line 1036... Line 1056...
1036
 * @param call   Current call data
1056
 * @param call   Current call data
1037
 * @param vp     Active viewport
1057
 * @param vp     Active viewport
1038
 *
1058
 *
1039
 * @return false if the call was not handled byt this function, true otherwise
1059
 * @return false if the call was not handled byt this function, true otherwise
1040
 *
1060
 *
1041
 * Note: this function is not threads safe, you would have
1061
 * Note: this function is not thread-safe, you would have
1042
 * to redefine static variables with __thread
1062
 * to redefine static variables with fibril_local.
1043
 *
1063
 *
1044
 */
1064
 */
1045
static bool shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
1065
static bool shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
1046
{
1066
{
1047
    static keyfield_t *interbuffer = NULL;
1067
    static keyfield_t *interbuffer = NULL;
Line 1063... Line 1083...
1063
    case IPC_M_SHARE_OUT:
1083
    case IPC_M_SHARE_OUT:
1064
        /* We accept one area for data interchange */
1084
        /* We accept one area for data interchange */
1065
        if (IPC_GET_ARG1(*call) == shm_id) {
1085
        if (IPC_GET_ARG1(*call) == shm_id) {
1066
            void *dest = as_get_mappable_page(IPC_GET_ARG2(*call));
1086
            void *dest = as_get_mappable_page(IPC_GET_ARG2(*call));
1067
            shm_size = IPC_GET_ARG2(*call);
1087
            shm_size = IPC_GET_ARG2(*call);
1068
            if (!ipc_answer_1(callid, EOK, (sysarg_t) dest))
1088
            if (ipc_answer_1(callid, EOK, (sysarg_t) dest)) {
1069
                shm = dest;
-
 
1070
            else
-
 
1071
                shm_id = 0;
1089
                shm_id = 0;
-
 
1090
                return false;
-
 
1091
            }
-
 
1092
            shm = dest;
1072
           
1093
           
1073
            if (shm[0] != 'P')
1094
            if (shm[0] != 'P')
1074
                return false;
1095
                return false;
1075
           
1096
           
1076
            return true;
1097
            return true;
Line 1562... Line 1583...
1562
        ipc_call_t call;
1583
        ipc_call_t call;
1563
        int retval;
1584
        int retval;
1564
        unsigned int i;
1585
        unsigned int i;
1565
        int scroll;
1586
        int scroll;
1566
        wchar_t ch;
1587
        wchar_t ch;
1567
        unsigned int row, col;
1588
        unsigned int col, row;
1568
       
1589
       
1569
        if ((vport->cursor_active) || (anims_enabled))
1590
        if ((vport->cursor_active) || (anims_enabled))
1570
            callid = async_get_call_timeout(&call, 250000);
1591
            callid = async_get_call_timeout(&call, 250000);
1571
        else
1592
        else
1572
            callid = async_get_call(&call);
1593
            callid = async_get_call(&call);
Line 1599... Line 1620...
1599
            /* Exit thread */
1620
            /* Exit thread */
1600
            return;
1621
            return;
1601
       
1622
       
1602
        case FB_PUTCHAR:
1623
        case FB_PUTCHAR:
1603
            ch = IPC_GET_ARG1(call);
1624
            ch = IPC_GET_ARG1(call);
1604
            row = IPC_GET_ARG2(call);
1625
            col = IPC_GET_ARG2(call);
1605
            col = IPC_GET_ARG3(call);
1626
            row = IPC_GET_ARG3(call);
1606
           
1627
           
1607
            if ((col >= vport->cols) || (row >= vport->rows)) {
1628
            if ((col >= vport->cols) || (row >= vport->rows)) {
1608
                retval = EINVAL;
1629
                retval = EINVAL;
1609
                break;
1630
                break;
1610
            }
1631
            }
Line 1618... Line 1639...
1618
            vport_clear(vport);
1639
            vport_clear(vport);
1619
            cursor_show(vport);
1640
            cursor_show(vport);
1620
            retval = EOK;
1641
            retval = EOK;
1621
            break;
1642
            break;
1622
        case FB_CURSOR_GOTO:
1643
        case FB_CURSOR_GOTO:
1623
            row = IPC_GET_ARG1(call);
1644
            col = IPC_GET_ARG1(call);
1624
            col = IPC_GET_ARG2(call);
1645
            row = IPC_GET_ARG2(call);
1625
           
1646
           
1626
            if ((col >= vport->cols) || (row >= vport->rows)) {
1647
            if ((col >= vport->cols) || (row >= vport->rows)) {
1627
                retval = EINVAL;
1648
                retval = EINVAL;
1628
                break;
1649
                break;
1629
            }
1650
            }
Line 1639... Line 1660...
1639
            vport->cursor_active = IPC_GET_ARG1(call);
1660
            vport->cursor_active = IPC_GET_ARG1(call);
1640
            cursor_show(vport);
1661
            cursor_show(vport);
1641
            retval = EOK;
1662
            retval = EOK;
1642
            break;
1663
            break;
1643
        case FB_GET_CSIZE:
1664
        case FB_GET_CSIZE:
1644
            ipc_answer_2(callid, EOK, vport->rows, vport->cols);
1665
            ipc_answer_2(callid, EOK, vport->cols, vport->rows);
-
 
1666
            continue;
-
 
1667
        case FB_GET_COLOR_CAP:
-
 
1668
            ipc_answer_1(callid, EOK, FB_CCAP_RGB);
1645
            continue;
1669
            continue;
1646
        case FB_SCROLL:
1670
        case FB_SCROLL:
1647
            scroll = IPC_GET_ARG1(call);
1671
            scroll = IPC_GET_ARG1(call);
1648
            if ((scroll > (int) vport->rows) || (scroll < (-(int) vport->rows))) {
1672
            if ((scroll > (int) vport->rows) || (scroll < (-(int) vport->rows))) {
1649
                retval = EINVAL;
1673
                retval = EINVAL;
Line 1735... Line 1759...
1735
    unsigned int fb_offset = sysinfo_value("fb.offset");
1759
    unsigned int fb_offset = sysinfo_value("fb.offset");
1736
    unsigned int fb_width = sysinfo_value("fb.width");
1760
    unsigned int fb_width = sysinfo_value("fb.width");
1737
    unsigned int fb_height = sysinfo_value("fb.height");
1761
    unsigned int fb_height = sysinfo_value("fb.height");
1738
    unsigned int fb_scanline = sysinfo_value("fb.scanline");
1762
    unsigned int fb_scanline = sysinfo_value("fb.scanline");
1739
    unsigned int fb_visual = sysinfo_value("fb.visual");
1763
    unsigned int fb_visual = sysinfo_value("fb.visual");
1740
   
1764
 
1741
    unsigned int fbsize = fb_scanline * fb_height;
1765
    unsigned int fbsize = fb_scanline * fb_height;
1742
    void *fb_addr = as_get_mappable_page(fbsize);
1766
    void *fb_addr = as_get_mappable_page(fbsize);
1743
   
1767
 
1744
    if (physmem_map(fb_ph_addr + fb_offset, fb_addr,
1768
    if (physmem_map(fb_ph_addr + fb_offset, fb_addr,
1745
        ALIGN_UP(fbsize, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE) != 0)
1769
        ALIGN_UP(fbsize, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE) != 0)
1746
        return -1;
1770
        return -1;
1747
   
1771
 
1748
    if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual))
1772
    if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual))
1749
        return 0;
1773
        return 0;
1750
   
1774
 
1751
    return -1;
1775
    return -1;
1752
}
1776
}
1753
 
1777
 
1754
/**
1778
/**
1755
 * @}
1779
 * @}