Subversion Repositories HelenOS

Rev

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

Rev 4584 Rev 4644
Line 67... Line 67...
67
/** Information about framebuffer */
67
/** Information about framebuffer */
68
struct {
68
struct {
69
    int phone;      /**< Framebuffer phone */
69
    int phone;      /**< Framebuffer phone */
70
    ipcarg_t cols;  /**< Framebuffer columns */
70
    ipcarg_t cols;  /**< Framebuffer columns */
71
    ipcarg_t rows;  /**< Framebuffer rows */
71
    ipcarg_t rows;  /**< Framebuffer rows */
-
 
72
    int color_cap;  /**< Color capabilities (FB_CCAP_xxx) */
72
} fb_info;
73
} fb_info;
73
 
74
 
74
typedef struct {
75
typedef struct {
75
    size_t index;             /**< Console index */
76
    size_t index;             /**< Console index */
76
    size_t refcount;          /**< Connection reference count */
77
    size_t refcount;          /**< Connection reference count */
Line 170... Line 171...
170
        set_rgb_color(attrs->a.r.fg_color, attrs->a.r.bg_color);
171
        set_rgb_color(attrs->a.r.fg_color, attrs->a.r.bg_color);
171
        break;
172
        break;
172
    }
173
    }
173
}
174
}
174
 
175
 
-
 
176
int ccap_fb_to_con(int ccap_fb, int *ccap_con)
-
 
177
{
-
 
178
    switch (ccap_fb) {
-
 
179
    case FB_CCAP_NONE: *ccap_con = CONSOLE_CCAP_NONE; break;
-
 
180
    case FB_CCAP_STYLE: *ccap_con = CONSOLE_CCAP_STYLE; break;
-
 
181
    case FB_CCAP_INDEXED: *ccap_con = CONSOLE_CCAP_INDEXED; break;
-
 
182
    case FB_CCAP_RGB: *ccap_con = CONSOLE_CCAP_RGB; break;
-
 
183
    default: return EINVAL;
-
 
184
    }
-
 
185
 
-
 
186
    return EOK;
-
 
187
}
-
 
188
 
175
/** Send an area of screenbuffer to the FB driver. */
189
/** Send an area of screenbuffer to the FB driver. */
176
static void fb_update_area(console_t *cons, ipcarg_t x0, ipcarg_t y0, ipcarg_t width, ipcarg_t height)
190
static void fb_update_area(console_t *cons, ipcarg_t x0, ipcarg_t y0, ipcarg_t width, ipcarg_t height)
177
{
191
{
178
    if (interbuffer) {
192
    if (interbuffer) {
179
        ipcarg_t x;
193
        ipcarg_t x;
Line 524... Line 538...
524
    ipc_callid_t callid;
538
    ipc_callid_t callid;
525
    ipc_call_t call;
539
    ipc_call_t call;
526
    ipcarg_t arg1;
540
    ipcarg_t arg1;
527
    ipcarg_t arg2;
541
    ipcarg_t arg2;
528
    ipcarg_t arg3;
542
    ipcarg_t arg3;
-
 
543
 
-
 
544
    int cons_ccap;
-
 
545
    int rc;
529
   
546
   
530
    async_serialize_start();
547
    async_serialize_start();
531
    if (cons->refcount == 0)
548
    if (cons->refcount == 0)
532
        gcons_notify_connect(cons->index);
549
        gcons_notify_connect(cons->index);
533
   
550
   
Line 586... Line 603...
586
            break;
603
            break;
587
        case CONSOLE_GET_SIZE:
604
        case CONSOLE_GET_SIZE:
588
            arg1 = fb_info.cols;
605
            arg1 = fb_info.cols;
589
            arg2 = fb_info.rows;
606
            arg2 = fb_info.rows;
590
            break;
607
            break;
-
 
608
        case CONSOLE_GET_COLOR_CAP:
-
 
609
            rc = ccap_fb_to_con(fb_info.color_cap, &cons_ccap);
-
 
610
            if (rc != EOK) {
-
 
611
                ipc_answer_0(callid, rc);
-
 
612
                continue;
-
 
613
            }
-
 
614
            arg1 = cons_ccap;
-
 
615
            break;
591
        case CONSOLE_SET_STYLE:
616
        case CONSOLE_SET_STYLE:
592
            fb_pending_flush();
617
            fb_pending_flush();
593
            arg1 = IPC_GET_ARG1(call);
618
            arg1 = IPC_GET_ARG1(call);
594
            screenbuffer_set_style(&cons->scr, arg1);
619
            screenbuffer_set_style(&cons->scr, arg1);
595
            if (cons == active_console)
620
            if (cons == active_console)
Line 637... Line 662...
637
    change_console(prev_console);
662
    change_console(prev_console);
638
}
663
}
639
 
664
 
640
static bool console_init(void)
665
static bool console_init(void)
641
{
666
{
-
 
667
    ipcarg_t color_cap;
-
 
668
 
642
    /* Connect to keyboard driver */
669
    /* Connect to keyboard driver */
643
    kbd_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_KEYBOARD, 0, 0);
670
    kbd_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_KEYBOARD, 0, 0);
644
    if (kbd_phone < 0) {
671
    if (kbd_phone < 0) {
645
        printf(NAME ": Failed to connect to keyboard service\n");
672
        printf(NAME ": Failed to connect to keyboard service\n");
646
        return false;
673
        return false;
Line 672... Line 699...
672
    gcons_init(fb_info.phone);
699
    gcons_init(fb_info.phone);
673
   
700
   
674
    /* Synchronize, the gcons could put something in queue */
701
    /* Synchronize, the gcons could put something in queue */
675
    async_req_0_0(fb_info.phone, FB_FLUSH);
702
    async_req_0_0(fb_info.phone, FB_FLUSH);
676
    async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows);
703
    async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows);
-
 
704
    async_req_0_1(fb_info.phone, FB_GET_COLOR_CAP, &color_cap);
-
 
705
    fb_info.color_cap = color_cap;
677
   
706
   
678
    /* Set up shared memory buffer. */
707
    /* Set up shared memory buffer. */
679
    size_t ib_size = sizeof(keyfield_t) * fb_info.cols * fb_info.rows;
708
    size_t ib_size = sizeof(keyfield_t) * fb_info.cols * fb_info.rows;
680
    interbuffer = as_get_mappable_page(ib_size);
709
    interbuffer = as_get_mappable_page(ib_size);
681
   
710