Subversion Repositories HelenOS

Rev

Rev 1366 | Rev 1404 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1363 vana 1
/*
2
 * Copyright (C) 2006 Jakub Vana
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
 
29
#include <stdio.h>
30
#include <ddi.h>
31
#include <task.h>
32
#include <stdlib.h>
33
#include <ddi.h>
34
#include <sysinfo.h>
35
#include <align.h>
36
#include <as.h>
37
#include <ipc/fb.h>
38
 
39
 
40
#include <ipc/ipc.h>
41
#include <ipc/services.h>
42
#include <unistd.h>
43
#include <stdlib.h>
44
#include <ipc/ns.h>
45
 
46
#include <kernel/errno.h>
1392 palkovsky 47
#include <async.h>
1363 vana 48
 
49
#include "fb.h"
50
 
51
#define EFB (-1)
52
 
53
#define DEFAULT_BGCOLOR     0x000080
54
#define DEFAULT_FGCOLOR     0xffff00
55
#define DEFAULT_LOGOCOLOR   0x0000ff
56
 
57
#define MAIN_BGCOLOR        0x404000
58
#define MAIN_FGCOLOR        0x000000
59
#define MAIN_LOGOCOLOR  0x404000
60
 
61
#define SPACING (2)
62
 
63
#define H_NO_VFBS 3
64
#define V_NO_VFBS 3
65
 
66
 
67
static void fb_putchar(int item,char ch);
68
int create_window(int item,unsigned int x, unsigned int y,unsigned int x_size, unsigned int y_size,
69
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR);
70
void fb_init(int item,__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan,
71
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR);
72
 
73
 
74
unsigned int mod_col(unsigned int col,int mod);
75
 
76
 
77
 
1392 palkovsky 78
static int init_fb(void)
1363 vana 79
{
80
    __address fb_ph_addr;
81
    unsigned int fb_width;
82
    unsigned int fb_height;
83
    unsigned int fb_bpp;
84
    unsigned int fb_scanline;
85
    __address fb_addr;
86
    int a=0;
1392 palkovsky 87
    int i,j,k;
88
    int w;
89
    char text[]="HelenOS Framebuffer driver\non Virtual Framebuffer\nVFB ";
1363 vana 90
 
91
    fb_ph_addr=sysinfo_value("fb.address.physical");
92
    fb_width=sysinfo_value("fb.width");
93
    fb_height=sysinfo_value("fb.height");
94
    fb_bpp=sysinfo_value("fb.bpp");
95
    fb_scanline=sysinfo_value("fb.scanline");
96
 
97
    fb_addr=ALIGN_UP(((__address)set_maxheapsize(USER_ADDRESS_SPACE_SIZE_ARCH>>1)),PAGE_SIZE);
98
 
99
 
1392 palkovsky 100
 
1363 vana 101
    map_physmem(task_get_id(),(void *)((__address)fb_ph_addr),(void *)fb_addr,
1392 palkovsky 102
            (fb_scanline*fb_height+PAGE_SIZE-1)>>PAGE_WIDTH,1);
1363 vana 103
 
104
    fb_init(0,fb_addr, fb_width, fb_height, fb_bpp, fb_scanline,
105
        MAIN_BGCOLOR,MAIN_FGCOLOR,MAIN_LOGOCOLOR);
106
 
107
    fb_putchar(0,'\n');
108
    fb_putchar(0,' ');
109
 
1392 palkovsky 110
    for(i=0;i<H_NO_VFBS;i++)
111
        for(j=0;j<V_NO_VFBS;j++) {
112
            w = create_window(0,(fb_width/H_NO_VFBS)*i+SPACING,
113
                      (fb_height/V_NO_VFBS)*j+SPACING,(fb_width/H_NO_VFBS)-2*SPACING ,
114
                      (fb_height/V_NO_VFBS)-2*SPACING,mod_col(DEFAULT_BGCOLOR,/*i+j*H_NO_VFBS*/0),
115
                      mod_col(DEFAULT_FGCOLOR,/*i+j*H_NO_VFBS*/0),
116
                      mod_col(DEFAULT_LOGOCOLOR,/*i+j*H_NO_VFBS)*/0));
117
 
118
            if( w== EFB)
119
                return -1;
120
 
121
            for(k=0;text[k];k++)
122
                fb_putchar(w,text[k]);
123
            fb_putchar(w,w+'0');
124
            fb_putchar(w,'\n');
125
        }
126
    return 0;
127
}
1363 vana 128
 
1392 palkovsky 129
int vfb_no = 1;
130
void client_connection(ipc_callid_t iid, ipc_call_t *icall)
131
{
132
    ipc_callid_t callid;
133
    ipc_call_t call;
134
    int vfb = vfb_no++;
1363 vana 135
 
1392 palkovsky 136
    if (vfb > 9) {
137
        ipc_answer_fast(iid, ELIMIT, 0,0);
138
        return;
139
    }
140
    ipc_answer_fast(iid, 0, 0, 0);
1363 vana 141
 
1392 palkovsky 142
    while (1) {
143
        callid = async_get_call(&call);
144
        switch (IPC_GET_METHOD(call)) {
145
        case IPC_M_PHONE_HUNGUP:
146
            ipc_answer_fast(callid,0,0,0);
147
            return; /* Exit thread */
1363 vana 148
 
1392 palkovsky 149
        case FB_PUTCHAR:
150
            ipc_answer_fast(callid,0,0,0);
151
            fb_putchar(vfb,IPC_GET_ARG2(call));
152
            break;
153
        default:
154
            ipc_answer_fast(callid,ENOENT,0,0);
155
        }
1363 vana 156
    }
1392 palkovsky 157
}
1363 vana 158
 
1392 palkovsky 159
int main(int argc, char *argv[])
160
{
1363 vana 161
    ipc_call_t call;
162
    ipc_callid_t callid;
163
    char connected = 0;
164
    int res;
165
    int c;
166
    ipcarg_t phonead;
167
 
168
    ipcarg_t retval, arg1, arg2;
169
 
1392 palkovsky 170
    if(!sysinfo_value("fb")) return -1;
1363 vana 171
 
172
 
173
    if ((res = ipc_connect_to_me(PHONE_NS, SERVICE_VIDEO, 0, &phonead)) != 0)
174
        return -1;
1392 palkovsky 175
 
176
    init_fb();
1363 vana 177
 
1392 palkovsky 178
    async_manager();
179
    /* Never reached */
1363 vana 180
    return 0;
181
}
182
/*
183
 * Copyright (C) 2006 Ondrej Palkovsky
184
 * All rights reserved.
185
 *
186
 * Redistribution and use in source and binary forms, with or without
187
 * modification, are permitted provided that the following conditions
188
 * are met:
189
 *
190
 * - Redistributions of source code must retain the above copyright
191
 *   notice, this list of conditions and the following disclaimer.
192
 * - Redistributions in binary form must reproduce the above copyright
193
 *   notice, this list of conditions and the following disclaimer in the
194
 *   documentation and/or other materials provided with the distribution.
195
 * - The name of the author may not be used to endorse or promote products
196
 *   derived from this software without specific prior written permission.
197
 *
198
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
199
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
200
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
201
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
202
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
203
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
204
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
205
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
206
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
207
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
208
 */
209
 
210
#include "font-8x16.h"
211
#include <string.h>
212
 
213
#include "helenos.xbm"
214
 
215
 
216
 
217
 
218
 
219
 
220
#define GRAPHICS_ITEMS 1024
221
 
222
 
223
/***************************************************************/
224
/* Pixel specific fuctions */
225
 
226
typedef void (*putpixel_fn_t)(int item,unsigned int x, unsigned int y, int color);
227
typedef int (*getpixel_fn_t)(int item,unsigned int x, unsigned int y);
228
 
229
typedef struct framebuffer_descriptor
230
{
231
    __u8 *fbaddress ;
232
 
233
    unsigned int xres ;
234
    unsigned int yres ;
235
    unsigned int scanline ;
236
    unsigned int pixelbytes ;
237
 
238
    unsigned int position ;
239
    unsigned int columns ;
240
    unsigned int rows ;
241
 
242
    unsigned int BGCOLOR;
243
    unsigned int FGCOLOR;
244
    unsigned int LOGOCOLOR;
245
 
246
    putpixel_fn_t putpixel;
247
    getpixel_fn_t getpixel;
248
 
249
}framebuffer_descriptor_t;
250
 
251
void * graphics_items[GRAPHICS_ITEMS+1]={NULL};
252
 
253
#define FB(__a__,__b__) (((framebuffer_descriptor_t*)(graphics_items[__a__]))->__b__)
254
 
255
#define COL_WIDTH   8
256
#define ROW_BYTES   (FB(item,scanline) * FONT_SCANLINES)
257
#define RED(x, bits)    ((x >> (16 + 8 - bits)) & ((1 << bits) - 1))
258
#define GREEN(x, bits)  ((x >> (8 + 8 - bits)) & ((1 << bits) - 1))
259
#define BLUE(x, bits)   ((x >> (8 - bits)) & ((1 << bits) - 1))
260
 
261
#define POINTPOS(x, y)  (y * FB(item,scanline) + x * FB(item,pixelbytes))
262
 
263
 
264
 
265
 
266
/** Put pixel - 24-bit depth, 1 free byte */
267
static void putpixel_4byte(int item,unsigned int x, unsigned int y, int color)
268
{
269
    *((__u32 *)(FB(item,fbaddress) + POINTPOS(x, y))) = color;
270
}
271
 
272
/** Return pixel color - 24-bit depth, 1 free byte */
273
static int getpixel_4byte(int item,unsigned int x, unsigned int y)
274
{
275
    return *((__u32 *)(FB(item,fbaddress) + POINTPOS(x, y))) & 0xffffff;
276
}
277
 
278
/** Put pixel - 24-bit depth */
279
static void putpixel_3byte(int item,unsigned int x, unsigned int y, int color)
280
{
281
    unsigned int startbyte = POINTPOS(x, y);
282
 
283
#if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN))
284
    FB(item,fbaddress)[startbyte] = RED(color, 8);
285
    FB(item,fbaddress)[startbyte + 1] = GREEN(color, 8);
286
    FB(item,fbaddress)[startbyte + 2] = BLUE(color, 8);
287
#else
288
    FB(item,fbaddress)[startbyte + 2] = RED(color, 8);
289
    FB(item,fbaddress)[startbyte + 1] = GREEN(color, 8);
290
    FB(item,fbaddress)[startbyte + 0] = BLUE(color, 8);
291
#endif
292
 
293
}
294
 
295
/** Return pixel color - 24-bit depth */
296
static int getpixel_3byte(int item,unsigned int x, unsigned int y)
297
{
298
    unsigned int startbyte = POINTPOS(x, y);
299
 
300
 
301
 
302
#if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN))
303
    return FB(item,fbaddress)[startbyte] << 16 | FB(item,fbaddress)[startbyte + 1] << 8 | FB(item,fbaddress)[startbyte + 2];
304
#else
305
    return FB(item,fbaddress)[startbyte + 2] << 16 | FB(item,fbaddress)[startbyte + 1] << 8 | FB(item,fbaddress)[startbyte + 0];
306
#endif
307
 
308
 
309
}
310
 
311
/** Put pixel - 16-bit depth (5:6:5) */
312
static void putpixel_2byte(int item,unsigned int x, unsigned int y, int color)
313
{
314
    /* 5-bit, 6-bits, 5-bits */
315
    *((__u16 *)(FB(item,fbaddress) + POINTPOS(x, y))) = RED(color, 5) << 11 | GREEN(color, 6) << 5 | BLUE(color, 5);
316
}
317
 
318
/** Return pixel color - 16-bit depth (5:6:5) */
319
static int getpixel_2byte(int item,unsigned int x, unsigned int y)
320
{
321
    int color = *((__u16 *)(FB(item,fbaddress) + POINTPOS(x, y)));
322
    return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
323
}
324
 
325
/** Put pixel - 8-bit depth (3:2:3) */
326
static void putpixel_1byte(int item,unsigned int x, unsigned int y, int color)
327
{
328
    FB(item,fbaddress)[POINTPOS(x, y)] = RED(color, 3) << 5 | GREEN(color, 2) << 3 | BLUE(color, 3);
329
}
330
 
331
/** Return pixel color - 8-bit depth (3:2:3) */
332
static int getpixel_1byte(int item,unsigned int x, unsigned int y)
333
{
334
    int color = FB(item,fbaddress)[POINTPOS(x, y)];
335
    return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
336
}
337
 
338
/** Fill line with color BGCOLOR */
339
static void clear_line(int item,unsigned int y)
340
{
341
    unsigned int x;
342
    for (x = 0; x < FB(item,xres); x++)
343
        FB(item,putpixel)(item,x, y, FB(item,BGCOLOR));
344
}
345
 
346
 
347
/** Fill screen with background color */
348
static void clear_screen(int item)
349
{
350
    unsigned int y;
351
    for (y = 0; y < FB(item,yres); y++)
352
    {
1392 palkovsky 353
        clear_line(item,y);
1363 vana 354
    }  
355
}
356
 
357
 
358
/** Scroll screen one row up */
359
static void scroll_screen(int item)
360
{
361
    unsigned int i;
362
    unsigned int j;
363
 
364
    for(j=0;j<FB(item,yres)-FONT_SCANLINES;j++)
365
        memcpy((void *) FB(item,fbaddress)+j*FB(item,scanline),
366
            (void *) &FB(item,fbaddress)[ROW_BYTES+j*FB(item,scanline)], FB(item,pixelbytes)*FB(item,xres));
367
 
368
    //memcpy((void *) FB(item,fbaddress), (void *) &FB(item,fbaddress)[ROW_BYTES], FB(item,scanline) * FB(item,yres) - ROW_BYTES);
369
 
370
    /* Clear last row */
371
    for (i = 0; i < FONT_SCANLINES; i++)
372
        clear_line(item,(FB(item,rows) - 1) * FONT_SCANLINES + i);
373
}
374
 
375
 
376
static void invert_pixel(int item,unsigned int x, unsigned int y)
377
{
378
    FB(item,putpixel)(item, x, y, ~FB(item,getpixel)(item, x, y));
379
}
380
 
381
 
382
/** Draw one line of glyph at a given position */
383
static void draw_glyph_line(int item,unsigned int glline, unsigned int x, unsigned int y)
384
{
385
    unsigned int i;
386
 
387
    for (i = 0; i < 8; i++)
388
        if (glline & (1 << (7 - i))) {
389
            FB(item,putpixel)(item,x + i, y, FB(item,FGCOLOR));
390
        } else
391
            FB(item,putpixel)(item,x + i, y, FB(item,BGCOLOR));
392
}
393
 
394
/***************************************************************/
395
/* Character-console functions */
396
 
397
/** Draw character at given position */
398
static void draw_glyph(int item,__u8 glyph, unsigned int col, unsigned int row)
399
{
400
    unsigned int y;
401
 
402
    for (y = 0; y < FONT_SCANLINES; y++)
403
        draw_glyph_line(item ,fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y);
404
}
405
 
406
/** Invert character at given position */
407
static void invert_char(int item,unsigned int col, unsigned int row)
408
{
409
    unsigned int x;
410
    unsigned int y;
411
 
412
    for (x = 0; x < COL_WIDTH; x++)
413
        for (y = 0; y < FONT_SCANLINES; y++)
414
            invert_pixel(item,col * COL_WIDTH + x, row * FONT_SCANLINES + y);
415
}
416
 
417
/** Draw character at default position */
418
static void draw_char(int item,char chr)
419
{
420
    draw_glyph(item ,chr, FB(item,position) % FB(item,columns), FB(item,position) / FB(item,columns));
421
}
422
 
423
static void draw_logo(int item,unsigned int startx, unsigned int starty)
424
{
425
    unsigned int x;
426
    unsigned int y;
427
    unsigned int byte;
428
    unsigned int rowbytes;
429
 
430
    rowbytes = (helenos_width - 1) / 8 + 1;
431
 
432
    for (y = 0; y < helenos_height; y++)
433
        for (x = 0; x < helenos_width; x++) {
434
            byte = helenos_bits[rowbytes * y + x / 8];
435
            byte >>= x % 8;
436
            if (byte & 1)
437
                FB(item,putpixel)(item,startx + x, starty + y, FB(item,LOGOCOLOR));
438
        }
439
}
440
 
441
/***************************************************************/
442
/* Stdout specific functions */
443
 
444
static void invert_cursor(int item)
445
{
446
    invert_char(item,FB(item,position) % FB(item,columns), FB(item,position) / FB(item,columns));
447
}
448
 
449
/** Print character to screen
450
 *
451
 *  Emulate basic terminal commands
452
 */
453
static void fb_putchar(int item,char ch)
454
{
455
 
456
    switch (ch) {
457
        case '\n':
458
            invert_cursor(item);
459
            FB(item,position) += FB(item,columns);
460
            FB(item,position) -= FB(item,position) % FB(item,columns);
461
            break;
462
        case '\r':
463
            invert_cursor(item);
464
            FB(item,position) -= FB(item,position) % FB(item,columns);
465
            break;
466
        case '\b':
467
            invert_cursor(item);
468
            if (FB(item,position) % FB(item,columns))
469
                FB(item,position)--;
470
            break;
471
        case '\t':
472
            invert_cursor(item);
473
            do {
474
                draw_char(item,' ');
475
                FB(item,position)++;
476
            } while (FB(item,position) % 8);
477
            break;
478
        default:
479
            draw_char(item,ch);
480
            FB(item,position)++;
481
    }
482
 
483
    if (FB(item,position) >= FB(item,columns) * FB(item,rows)) {
484
        FB(item,position) -= FB(item,columns);
485
        scroll_screen(item);
486
    }
487
 
488
    invert_cursor(item);
489
 
490
}
491
 
492
 
493
/** Initialize framebuffer as a chardev output device
494
 *
495
 * @param addr Address of theframebuffer
496
 * @param x    Screen width in pixels
497
 * @param y    Screen height in pixels
498
 * @param bpp  Bits per pixel (8, 16, 24, 32)
499
 * @param scan Bytes per one scanline
500
 *
501
 */
502
void fb_init(int item,__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan,
503
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR)
504
{
505
 
506
    if( (graphics_items[item]=malloc(sizeof(framebuffer_descriptor_t))) ==NULL)
507
    {
508
        return;
509
    }
510
 
511
    switch (bpp) {
512
        case 8:
513
            FB(item,putpixel) = putpixel_1byte;
514
            FB(item,getpixel) = getpixel_1byte;
515
            FB(item,pixelbytes) = 1;
516
            break;
517
        case 16:
518
            FB(item,putpixel) = putpixel_2byte;
519
            FB(item,getpixel) = getpixel_2byte;
520
            FB(item,pixelbytes) = 2;
521
            break;
522
        case 24:
523
            FB(item,putpixel) = putpixel_3byte;
524
            FB(item,getpixel) = getpixel_3byte;
525
            FB(item,pixelbytes) = 3;
526
            break;
527
        case 32:
528
            FB(item,putpixel) = putpixel_4byte;
529
            FB(item,getpixel) = getpixel_4byte;
530
            FB(item,pixelbytes) = 4;
531
            break;
532
    }
533
 
534
 
1392 palkovsky 535
    FB(item,fbaddress) = (unsigned char *) addr;
536
    FB(item,xres) = x;
537
    FB(item,yres) = y;
538
    FB(item,scanline) = scan;
1363 vana 539
 
540
 
1392 palkovsky 541
    FB(item,rows) = y / FONT_SCANLINES;
542
    FB(item,columns) = x / COL_WIDTH;
1363 vana 543
 
544
    FB(item,BGCOLOR)=BGCOLOR;
545
    FB(item,FGCOLOR)=FGCOLOR;
546
    FB(item,LOGOCOLOR)=LOGOCOLOR;
547
 
548
 
1392 palkovsky 549
    clear_screen(item);
550
    draw_logo(item,FB(item,xres) - helenos_width, 0);
551
    invert_cursor(item);
1363 vana 552
 
553
}
554
 
555
 
556
static int get_free_item()
557
{
558
    int item;
559
    for(item=0;graphics_items[item]!=NULL;item++);
560
    return (item==GRAPHICS_ITEMS)?EFB:item;
561
}
562
 
563
unsigned int mod_col(unsigned int col,int mod)
564
{
565
    if(mod & 1) col^=0xff;
566
    if(mod & 2) col^=0xff00;
567
    if(mod & 4) col^=0xff0000;
568
    return col;
569
}
570
 
571
 
572
int create_window(int item,unsigned int x, unsigned int y,unsigned int x_size, unsigned int y_size,
573
    unsigned int BGCOLOR,unsigned int FGCOLOR,unsigned int LOGOCOLOR)
574
{
575
    int item_new;
576
 
577
    if(EFB==(item_new=get_free_item()))return EFB;
578
 
579
 
580
    if( (graphics_items[item_new]=malloc(sizeof(framebuffer_descriptor_t))) ==NULL)
581
    {
582
        return EFB;
583
    }
584
 
585
 
586
 
587
    FB(item_new,putpixel) = FB(item,putpixel);
588
    FB(item_new,getpixel) = FB(item,getpixel);
589
    FB(item_new,pixelbytes) = FB(item,pixelbytes);
590
 
591
    FB(item_new,fbaddress) = FB(item,fbaddress) + POINTPOS(x, y) ;
592
    FB(item_new,xres) = x_size;
593
    FB(item_new,yres) = y_size;
594
    FB(item_new,scanline) =  FB(item,scanline);
595
 
596
 
597
    FB(item_new,rows) = y_size / FONT_SCANLINES;
598
    FB(item_new,columns) = x_size / COL_WIDTH;
599
 
600
    FB(item_new,BGCOLOR)=BGCOLOR;
601
    FB(item_new,FGCOLOR)=FGCOLOR;
602
    FB(item_new,LOGOCOLOR)=LOGOCOLOR;
603
 
604
 
605
    clear_screen(item_new);
606
    draw_logo(item_new,FB(item_new,xres) - helenos_width, 0);
607
    invert_cursor(item_new);
608
 
609
    return item_new;
610
}
611
 
612
 
613