Rev 891 | Rev 1135 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 891 | Rev 896 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (C) 2006 Ondrej Palkovsky |
2 | * Copyright (C) 2006 Ondrej Palkovsky |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
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 |
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. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
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 |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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 |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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 |
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. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #include <genarch/fb/font-8x16.h> |
29 | #include <genarch/fb/font-8x16.h> |
30 | #include <genarch/fb/fb.h> |
30 | #include <genarch/fb/fb.h> |
31 | #include <console/chardev.h> |
31 | #include <console/chardev.h> |
32 | #include <console/console.h> |
32 | #include <console/console.h> |
33 | #include <panic.h> |
33 | #include <panic.h> |
- | 34 | #include <memstr.h> |
|
34 | 35 | ||
35 | #include "helenos.xbm" |
36 | #include "helenos.xbm" |
36 | 37 | ||
37 | SPINLOCK_INITIALIZE(fb_lock); |
38 | SPINLOCK_INITIALIZE(fb_lock); |
38 | 39 | ||
39 | static __u8 *fbaddress=NULL; |
40 | static __u8 *fbaddress=NULL; |
40 | static int xres,yres; |
41 | static int xres,yres; |
41 | static int position=0; |
42 | static int position=0; |
42 | static int columns=0; |
43 | static int columns=0; |
43 | static int rows=0; |
44 | static int rows=0; |
44 | static int pixelbytes=0; |
45 | static int pixelbytes=0; |
45 | 46 | ||
46 | #define COL_WIDTH 8 |
47 | #define COL_WIDTH 8 |
47 | #define ROW_HEIGHT (FONT_SCANLINES) |
48 | #define ROW_HEIGHT (FONT_SCANLINES) |
48 | #define ROW_PIX (xres*ROW_HEIGHT*pixelbytes) |
49 | #define ROW_PIX (xres*ROW_HEIGHT*pixelbytes) |
49 | 50 | ||
50 | #define BGCOLOR 0x000080 |
51 | #define BGCOLOR 0x000080 |
51 | #define FGCOLOR 0xffff00 |
52 | #define FGCOLOR 0xffff00 |
52 | #define LOGOCOLOR 0x2020b0 |
53 | #define LOGOCOLOR 0x2020b0 |
53 | 54 | ||
54 | #define RED(x,bits) ((x >> (16+8-bits)) & ((1<<bits)-1)) |
55 | #define RED(x,bits) ((x >> (16+8-bits)) & ((1<<bits)-1)) |
55 | #define GREEN(x,bits) ((x >> (8+8-bits)) & ((1<<bits)-1)) |
56 | #define GREEN(x,bits) ((x >> (8+8-bits)) & ((1<<bits)-1)) |
56 | #define BLUE(x,bits) ((x >> (8-bits)) & ((1<<bits)-1)) |
57 | #define BLUE(x,bits) ((x >> (8-bits)) & ((1<<bits)-1)) |
57 | 58 | ||
58 | #define POINTPOS(x,y) ((y*xres+x)*pixelbytes) |
59 | #define POINTPOS(x,y) ((y*xres+x)*pixelbytes) |
59 | 60 | ||
60 | /***************************************************************/ |
61 | /***************************************************************/ |
61 | /* Pixel specific fuctions */ |
62 | /* Pixel specific fuctions */ |
62 | 63 | ||
63 | static void (*putpixel)(int x,int y,int color); |
64 | static void (*putpixel)(int x,int y,int color); |
64 | static int (*getpixel)(int x,int y); |
65 | static int (*getpixel)(int x,int y); |
65 | 66 | ||
66 | /** Put pixel - 24-bit depth, 1 free byte */ |
67 | /** Put pixel - 24-bit depth, 1 free byte */ |
67 | static void putpixel_4byte(int x,int y,int color) |
68 | static void putpixel_4byte(int x,int y,int color) |
68 | { |
69 | { |
69 | int startbyte = POINTPOS(x,y); |
70 | int startbyte = POINTPOS(x,y); |
70 | 71 | ||
71 | *((__u32 *)(fbaddress+startbyte)) = color; |
72 | *((__u32 *)(fbaddress+startbyte)) = color; |
72 | } |
73 | } |
73 | 74 | ||
74 | /** Return pixel color */ |
75 | /** Return pixel color */ |
75 | static int getpixel_4byte(int x,int y) |
76 | static int getpixel_4byte(int x,int y) |
76 | { |
77 | { |
77 | int startbyte = POINTPOS(x,y); |
78 | int startbyte = POINTPOS(x,y); |
78 | 79 | ||
79 | return *((__u32 *)(fbaddress+startbyte)) & 0xffffff; |
80 | return *((__u32 *)(fbaddress+startbyte)) & 0xffffff; |
80 | } |
81 | } |
81 | 82 | ||
82 | /** Draw pixel of given color on screen - 24-bit depth */ |
83 | /** Draw pixel of given color on screen - 24-bit depth */ |
83 | static void putpixel_3byte(int x,int y,int color) |
84 | static void putpixel_3byte(int x,int y,int color) |
84 | { |
85 | { |
85 | int startbyte = POINTPOS(x,y); |
86 | int startbyte = POINTPOS(x,y); |
86 | 87 | ||
87 | fbaddress[startbyte] = RED(color,8); |
88 | fbaddress[startbyte] = RED(color,8); |
88 | fbaddress[startbyte+1] = GREEN(color,8); |
89 | fbaddress[startbyte+1] = GREEN(color,8); |
89 | fbaddress[startbyte+2] = BLUE(color,8); |
90 | fbaddress[startbyte+2] = BLUE(color,8); |
90 | } |
91 | } |
91 | 92 | ||
92 | static int getpixel_3byte(int x,int y) |
93 | static int getpixel_3byte(int x,int y) |
93 | { |
94 | { |
94 | int startbyte = POINTPOS(x,y); |
95 | int startbyte = POINTPOS(x,y); |
95 | int result; |
96 | int result; |
96 | 97 | ||
97 | result = fbaddress[startbyte] << 16 \ |
98 | result = fbaddress[startbyte] << 16 \ |
98 | | fbaddress[startbyte+1] << 8 \ |
99 | | fbaddress[startbyte+1] << 8 \ |
99 | | fbaddress[startbyte+2]; |
100 | | fbaddress[startbyte+2]; |
100 | return result; |
101 | return result; |
101 | } |
102 | } |
102 | 103 | ||
103 | /** Put pixel - 16-bit depth (5:6:6) */ |
104 | /** Put pixel - 16-bit depth (5:6:6) */ |
104 | static void putpixel_2byte(int x,int y,int color) |
105 | static void putpixel_2byte(int x,int y,int color) |
105 | { |
106 | { |
106 | int startbyte = POINTPOS(x,y); |
107 | int startbyte = POINTPOS(x,y); |
107 | int compcolor; |
108 | int compcolor; |
108 | 109 | ||
109 | /* 5-bit, 5-bits, 5-bits */ |
110 | /* 5-bit, 5-bits, 5-bits */ |
110 | compcolor = RED(color,5) << 11 \ |
111 | compcolor = RED(color,5) << 11 \ |
111 | | GREEN(color,6) << 5 \ |
112 | | GREEN(color,6) << 5 \ |
112 | | BLUE(color,5); |
113 | | BLUE(color,5); |
113 | *((__u16 *)(fbaddress+startbyte)) = compcolor; |
114 | *((__u16 *)(fbaddress+startbyte)) = compcolor; |
114 | } |
115 | } |
115 | 116 | ||
116 | static int getpixel_2byte(int x,int y) |
117 | static int getpixel_2byte(int x,int y) |
117 | { |
118 | { |
118 | int startbyte = POINTPOS(x,y); |
119 | int startbyte = POINTPOS(x,y); |
119 | int color; |
120 | int color; |
120 | int red,green,blue; |
121 | int red,green,blue; |
121 | 122 | ||
122 | color = *((__u16 *)(fbaddress+startbyte)); |
123 | color = *((__u16 *)(fbaddress+startbyte)); |
123 | red = (color >> 11) & 0x1f; |
124 | red = (color >> 11) & 0x1f; |
124 | green = (color >> 5) & 0x3f; |
125 | green = (color >> 5) & 0x3f; |
125 | blue = color & 0x1f; |
126 | blue = color & 0x1f; |
126 | return (red << (16+3)) | (green << (8+2)) | (blue << 3); |
127 | return (red << (16+3)) | (green << (8+2)) | (blue << 3); |
127 | } |
128 | } |
128 | 129 | ||
129 | /** Put pixel - 8-bit depth (3:2:3) */ |
130 | /** Put pixel - 8-bit depth (3:2:3) */ |
130 | static void putpixel_1byte(int x,int y,int color) |
131 | static void putpixel_1byte(int x,int y,int color) |
131 | { |
132 | { |
132 | int compcolor; |
133 | int compcolor; |
133 | 134 | ||
134 | /* 3-bit, 2-bits, 3-bits */ |
135 | /* 3-bit, 2-bits, 3-bits */ |
135 | compcolor = RED(color,3) << 5 \ |
136 | compcolor = RED(color,3) << 5 \ |
136 | | GREEN(color,2) << 3 \ |
137 | | GREEN(color,2) << 3 \ |
137 | | BLUE(color,3); |
138 | | BLUE(color,3); |
138 | fbaddress[POINTPOS(x,y)] = compcolor; |
139 | fbaddress[POINTPOS(x,y)] = compcolor; |
139 | } |
140 | } |
140 | 141 | ||
141 | 142 | ||
142 | static int getpixel_1byte(int x,int y) |
143 | static int getpixel_1byte(int x,int y) |
143 | { |
144 | { |
144 | int color; |
145 | int color; |
145 | int red,green,blue; |
146 | int red,green,blue; |
146 | 147 | ||
147 | color = fbaddress[POINTPOS(x,y)]; |
148 | color = fbaddress[POINTPOS(x,y)]; |
148 | red = (color >> 5) & 0x7; |
149 | red = (color >> 5) & 0x7; |
149 | green = (color >> 3) & 0x3; |
150 | green = (color >> 3) & 0x3; |
150 | blue = color & 0x7; |
151 | blue = color & 0x7; |
151 | return (red << (16+5)) | (green << (8+6)) | blue << 5; |
152 | return (red << (16+5)) | (green << (8+6)) | blue << 5; |
152 | } |
153 | } |
153 | 154 | ||
154 | static void clear_line(int y); |
155 | static void clear_line(int y); |
155 | /** Scroll screen one row up */ |
156 | /** Scroll screen one row up */ |
156 | static void scroll_screen(void) |
157 | static void scroll_screen(void) |
157 | { |
158 | { |
158 | int i; |
159 | int i; |
159 | 160 | ||
160 | for (i=0;i < (xres*yres*pixelbytes)-ROW_PIX; i++) |
161 | memcpy((void *) fbaddress, (void *) &fbaddress[ROW_PIX], (xres*yres*pixelbytes)-ROW_PIX); |
161 | fbaddress[i] = fbaddress[i+ROW_PIX]; |
- | |
162 | 162 | ||
163 | /* Clear last row */ |
163 | /* Clear last row */ |
164 | for (i=0; i < ROW_HEIGHT;i++) |
164 | for (i=0; i < ROW_HEIGHT;i++) |
165 | clear_line((rows-1)*ROW_HEIGHT+i); |
165 | clear_line((rows-1)*ROW_HEIGHT+i); |
166 | 166 | ||
167 | } |
167 | } |
168 | 168 | ||
169 | 169 | ||
170 | /***************************************************************/ |
170 | /***************************************************************/ |
171 | /* Screen specific function */ |
171 | /* Screen specific function */ |
172 | 172 | ||
173 | /** Fill line with color BGCOLOR */ |
173 | /** Fill line with color BGCOLOR */ |
174 | static void clear_line(int y) |
174 | static void clear_line(int y) |
175 | { |
175 | { |
176 | int x; |
176 | int x; |
177 | for (x=0; x<xres;x++) |
177 | for (x=0; x<xres;x++) |
178 | (*putpixel)(x,y,BGCOLOR); |
178 | (*putpixel)(x,y,BGCOLOR); |
179 | } |
179 | } |
180 | 180 | ||
181 | /** Fill screen with background color */ |
181 | /** Fill screen with background color */ |
182 | static void clear_screen(void) |
182 | static void clear_screen(void) |
183 | { |
183 | { |
184 | int y; |
184 | int y; |
185 | 185 | ||
186 | for (y=0; y<yres;y++) |
186 | for (y=0; y<yres;y++) |
187 | clear_line(y); |
187 | clear_line(y); |
188 | } |
188 | } |
189 | 189 | ||
190 | static void invert_pixel(int x, int y) |
190 | static void invert_pixel(int x, int y) |
191 | { |
191 | { |
192 | (*putpixel)(x,y, ~(*getpixel)(x,y)); |
192 | (*putpixel)(x,y, ~(*getpixel)(x,y)); |
193 | } |
193 | } |
194 | 194 | ||
195 | 195 | ||
196 | /** Draw one line of glyph at a given position */ |
196 | /** Draw one line of glyph at a given position */ |
197 | static void draw_glyph_line(int glline, int x, int y) |
197 | static void draw_glyph_line(int glline, int x, int y) |
198 | { |
198 | { |
199 | int i; |
199 | int i; |
200 | 200 | ||
201 | for (i=0; i < 8; i++) |
201 | for (i=0; i < 8; i++) |
202 | if (glline & (1 << (7-i))) { |
202 | if (glline & (1 << (7-i))) { |
203 | (*putpixel)(x+i,y,FGCOLOR); |
203 | (*putpixel)(x+i,y,FGCOLOR); |
204 | } else |
204 | } else |
205 | (*putpixel)(x+i,y,BGCOLOR); |
205 | (*putpixel)(x+i,y,BGCOLOR); |
206 | } |
206 | } |
207 | 207 | ||
208 | /***************************************************************/ |
208 | /***************************************************************/ |
209 | /* Character-console functions */ |
209 | /* Character-console functions */ |
210 | 210 | ||
211 | /** Draw character at given position */ |
211 | /** Draw character at given position */ |
212 | static void draw_glyph(__u8 glyph, int col, int row) |
212 | static void draw_glyph(__u8 glyph, int col, int row) |
213 | { |
213 | { |
214 | int y; |
214 | int y; |
215 | 215 | ||
216 | for (y=0; y < FONT_SCANLINES; y++) |
216 | for (y=0; y < FONT_SCANLINES; y++) |
217 | draw_glyph_line(fb_font[glyph*FONT_SCANLINES+y], |
217 | draw_glyph_line(fb_font[glyph*FONT_SCANLINES+y], |
218 | col*COL_WIDTH, row*ROW_HEIGHT+y); |
218 | col*COL_WIDTH, row*ROW_HEIGHT+y); |
219 | } |
219 | } |
220 | 220 | ||
221 | /** Invert character at given position */ |
221 | /** Invert character at given position */ |
222 | static void invert_char(int col, int row) |
222 | static void invert_char(int col, int row) |
223 | { |
223 | { |
224 | int x,y; |
224 | int x,y; |
225 | 225 | ||
226 | for (x=0; x < COL_WIDTH; x++) |
226 | for (x=0; x < COL_WIDTH; x++) |
227 | for (y=0; y < FONT_SCANLINES; y++) |
227 | for (y=0; y < FONT_SCANLINES; y++) |
228 | invert_pixel(col*COL_WIDTH+x,row*ROW_HEIGHT+y); |
228 | invert_pixel(col*COL_WIDTH+x,row*ROW_HEIGHT+y); |
229 | } |
229 | } |
230 | 230 | ||
231 | /** Draw character at default position */ |
231 | /** Draw character at default position */ |
232 | static void draw_char(char chr) |
232 | static void draw_char(char chr) |
233 | { |
233 | { |
234 | draw_glyph(chr, position % columns, position/columns); |
234 | draw_glyph(chr, position % columns, position/columns); |
235 | } |
235 | } |
236 | 236 | ||
237 | static void draw_logo(int startx, int starty) |
237 | static void draw_logo(int startx, int starty) |
238 | { |
238 | { |
239 | int x,y; |
239 | int x,y; |
240 | int byte; |
240 | int byte; |
241 | int rowbytes; |
241 | int rowbytes; |
242 | 242 | ||
243 | rowbytes = (helenos_width-1)/8 + 1; |
243 | rowbytes = (helenos_width-1)/8 + 1; |
244 | 244 | ||
245 | for (y=0;y < helenos_height;y++) |
245 | for (y=0;y < helenos_height;y++) |
246 | for (x=0;x < helenos_width; x++ ) { |
246 | for (x=0;x < helenos_width; x++ ) { |
247 | byte = helenos_bits[rowbytes*y + x/8]; |
247 | byte = helenos_bits[rowbytes*y + x/8]; |
248 | byte >>= x % 8; |
248 | byte >>= x % 8; |
249 | if (byte & 1) |
249 | if (byte & 1) |
250 | (*putpixel)(startx+x,starty+y,LOGOCOLOR); |
250 | (*putpixel)(startx+x,starty+y,LOGOCOLOR); |
251 | } |
251 | } |
252 | } |
252 | } |
253 | 253 | ||
254 | /***************************************************************/ |
254 | /***************************************************************/ |
255 | /* Stdout specific functions */ |
255 | /* Stdout specific functions */ |
256 | 256 | ||
257 | static void invert_cursor(void) |
257 | static void invert_cursor(void) |
258 | { |
258 | { |
259 | invert_char(position % columns, position/columns); |
259 | invert_char(position % columns, position/columns); |
260 | } |
260 | } |
261 | 261 | ||
262 | /** Print character to screen |
262 | /** Print character to screen |
263 | * |
263 | * |
264 | * Emulate basic terminal commands |
264 | * Emulate basic terminal commands |
265 | */ |
265 | */ |
266 | static void fb_putchar(chardev_t *dev, char ch) |
266 | static void fb_putchar(chardev_t *dev, char ch) |
267 | { |
267 | { |
268 | spinlock_lock(&fb->lock); |
268 | spinlock_lock(&fb->lock); |
269 | 269 | ||
270 | if (ch == '\n') { |
270 | if (ch == '\n') { |
271 | invert_cursor(); |
271 | invert_cursor(); |
272 | position += columns; |
272 | position += columns; |
273 | position -= position % columns; |
273 | position -= position % columns; |
274 | } else if (ch == '\r') { |
274 | } else if (ch == '\r') { |
275 | invert_cursor(); |
275 | invert_cursor(); |
276 | position -= position % columns; |
276 | position -= position % columns; |
277 | } else if (ch == '\b') { |
277 | } else if (ch == '\b') { |
278 | invert_cursor(); |
278 | invert_cursor(); |
279 | if (position % columns) |
279 | if (position % columns) |
280 | position--; |
280 | position--; |
281 | } else if (ch == '\t') { |
281 | } else if (ch == '\t') { |
282 | invert_cursor(); |
282 | invert_cursor(); |
283 | do { |
283 | do { |
284 | draw_char(' '); |
284 | draw_char(' '); |
285 | position++; |
285 | position++; |
286 | } while (position % 8); |
286 | } while (position % 8); |
287 | } else { |
287 | } else { |
288 | draw_char(ch); |
288 | draw_char(ch); |
289 | position++; |
289 | position++; |
290 | } |
290 | } |
291 | if (position >= columns*rows) { |
291 | if (position >= columns*rows) { |
292 | position -= columns; |
292 | position -= columns; |
293 | scroll_screen(); |
293 | scroll_screen(); |
294 | } |
294 | } |
295 | invert_cursor(); |
295 | invert_cursor(); |
296 | spinlock_unlock(&fb->lock); |
296 | spinlock_unlock(&fb->lock); |
297 | } |
297 | } |
298 | 298 | ||
299 | static chardev_t framebuffer; |
299 | static chardev_t framebuffer; |
300 | static chardev_operations_t fb_ops = { |
300 | static chardev_operations_t fb_ops = { |
301 | .write = fb_putchar, |
301 | .write = fb_putchar, |
302 | }; |
302 | }; |
303 | 303 | ||
304 | 304 | ||
305 | /** Initialize framebuffer as a chardev output device |
305 | /** Initialize framebuffer as a chardev output device |
306 | * |
306 | * |
307 | * @param addr Address of framebuffer |
307 | * @param addr Address of framebuffer |
308 | * @param x X resolution |
308 | * @param x X resolution |
309 | * @param y Y resolution |
309 | * @param y Y resolution |
310 | * @param bytes Bytes per pixel (2,3,4) |
310 | * @param bytes Bytes per pixel (2,3,4) |
311 | */ |
311 | */ |
312 | void fb_init(__address addr, int x, int y, int bytes) |
312 | void fb_init(__address addr, int x, int y, int bytes) |
313 | { |
313 | { |
314 | fbaddress = (unsigned char *)addr; |
314 | fbaddress = (unsigned char *)addr; |
315 | 315 | ||
316 | switch (bytes) { |
316 | switch (bytes) { |
317 | case 1: |
317 | case 1: |
318 | putpixel = putpixel_1byte; |
318 | putpixel = putpixel_1byte; |
319 | getpixel = getpixel_1byte; |
319 | getpixel = getpixel_1byte; |
320 | break; |
320 | break; |
321 | case 2: |
321 | case 2: |
322 | putpixel = putpixel_2byte; |
322 | putpixel = putpixel_2byte; |
323 | getpixel = getpixel_2byte; |
323 | getpixel = getpixel_2byte; |
324 | break; |
324 | break; |
325 | case 3: |
325 | case 3: |
326 | putpixel = putpixel_3byte; |
326 | putpixel = putpixel_3byte; |
327 | getpixel = getpixel_3byte; |
327 | getpixel = getpixel_3byte; |
328 | break; |
328 | break; |
329 | case 4: |
329 | case 4: |
330 | putpixel = putpixel_4byte; |
330 | putpixel = putpixel_4byte; |
331 | getpixel = getpixel_4byte; |
331 | getpixel = getpixel_4byte; |
332 | break; |
332 | break; |
333 | default: |
333 | default: |
334 | panic("Unsupported color depth"); |
334 | panic("Unsupported color depth"); |
335 | } |
335 | } |
336 | 336 | ||
337 | xres = x; |
337 | xres = x; |
338 | yres = y; |
338 | yres = y; |
339 | pixelbytes = bytes; |
339 | pixelbytes = bytes; |
340 | 340 | ||
341 | rows = y/ROW_HEIGHT; |
341 | rows = y/ROW_HEIGHT; |
342 | columns = x/COL_WIDTH; |
342 | columns = x/COL_WIDTH; |
343 | 343 | ||
344 | clear_screen(); |
344 | clear_screen(); |
345 | draw_logo(xres-helenos_width, 0); |
345 | draw_logo(xres-helenos_width, 0); |
346 | invert_cursor(); |
346 | invert_cursor(); |
347 | 347 | ||
348 | chardev_initialize("fb", &framebuffer, &fb_ops); |
348 | chardev_initialize("fb", &framebuffer, &fb_ops); |
349 | stdout = &framebuffer; |
349 | stdout = &framebuffer; |
350 | } |
350 | } |
351 | 351 | ||
352 | 352 |