Rev 3602 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3602 | Rev 3742 | ||
---|---|---|---|
Line 84... | Line 84... | ||
84 | static keyfield_t *interbuffer = NULL; /**< Pointer to memory shared |
84 | static keyfield_t *interbuffer = NULL; /**< Pointer to memory shared |
85 | * with framebufer used for |
85 | * with framebufer used for |
86 | * faster virtual console |
86 | * faster virtual console |
87 | * switching */ |
87 | * switching */ |
88 | 88 | ||
89 | static int kernel_pixmap = -1; /**< Number of fb pixmap, where kernel |
- | |
90 | * console is stored */ |
- | |
91 | - | ||
92 | 89 | ||
93 | /** Find unused virtual console. |
90 | /** Find unused virtual console. |
94 | * |
91 | * |
95 | */ |
92 | */ |
96 | static int find_free_connection(void) |
93 | static int find_free_connection(void) |
Line 185... | Line 182... | ||
185 | if (console == active_console) |
182 | if (console == active_console) |
186 | curs_goto(scr->position_y, scr->position_x); |
183 | curs_goto(scr->position_y, scr->position_x); |
187 | 184 | ||
188 | } |
185 | } |
189 | 186 | ||
190 | /** Save current screen to pixmap, draw old pixmap |
- | |
191 | * |
- | |
192 | * @param oldpixmap Old pixmap |
- | |
193 | * @return ID of pixmap of current screen |
- | |
194 | */ |
- | |
195 | static int switch_screens(int oldpixmap) |
- | |
196 | { |
- | |
197 | int newpmap; |
- | |
198 | - | ||
199 | /* Save screen */ |
- | |
200 | newpmap = async_req_0_0(fb_info.phone, FB_VP2PIXMAP); |
- | |
201 | if (newpmap < 0) |
- | |
202 | return -1; |
- | |
203 | - | ||
204 | if (oldpixmap != -1) { |
- | |
205 | /* Show old screen */ |
- | |
206 | async_msg_2(fb_info.phone, FB_VP_DRAW_PIXMAP, 0, oldpixmap); |
- | |
207 | /* Drop old pixmap */ |
- | |
208 | async_msg_1(fb_info.phone, FB_DROP_PIXMAP, oldpixmap); |
- | |
209 | } |
- | |
210 | - | ||
211 | return newpmap; |
- | |
212 | } |
- | |
213 | - | ||
214 | /** Switch to new console */ |
187 | /** Switch to new console */ |
215 | static void change_console(int newcons) |
188 | static void change_console(int newcons) |
216 | { |
189 | { |
217 | connection_t *conn; |
190 | connection_t *conn; |
218 | static int console_pixmap = -1; |
- | |
219 | int i, j, rc; |
191 | int i, j, rc; |
220 | keyfield_t *field; |
192 | keyfield_t *field; |
221 | style_t *style; |
193 | style_t *style; |
222 | 194 | ||
223 | if (newcons == active_console) |
195 | if (newcons == active_console) |
224 | return; |
196 | return; |
225 | 197 | ||
226 | if (newcons == KERNEL_CONSOLE) { |
198 | if (newcons == KERNEL_CONSOLE) { |
227 | if (active_console == KERNEL_CONSOLE) |
- | |
228 | return; |
- | |
229 | active_console = KERNEL_CONSOLE; |
- | |
230 | curs_visibility(0); |
- | |
231 | - | ||
232 | async_serialize_start(); |
199 | async_serialize_start(); |
233 | if (kernel_pixmap == -1) { |
- | |
234 | /* store/restore unsupported */ |
- | |
235 | set_style_col(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND); |
- | |
236 | clrscr(); |
200 | curs_visibility(0); |
237 | } else { |
- | |
238 | gcons_in_kernel(); |
201 | gcons_in_kernel(); |
239 | console_pixmap = switch_screens(kernel_pixmap); |
- | |
240 | kernel_pixmap = -1; |
- | |
241 | } |
- | |
242 | async_serialize_end(); |
202 | async_serialize_end(); |
243 | 203 | ||
244 | __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE); |
204 | if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) |
- | 205 | active_console = KERNEL_CONSOLE; |
|
245 | return; |
206 | else |
- | 207 | newcons == active_console; |
|
246 | } |
208 | } |
247 | 209 | ||
- | 210 | if (newcons != KERNEL_CONSOLE) { |
|
248 | async_serialize_start(); |
211 | async_serialize_start(); |
249 | 212 | ||
250 | if (console_pixmap != -1) { |
213 | if (active_console == KERNEL_CONSOLE) |
251 | kernel_pixmap = switch_screens(console_pixmap); |
- | |
252 | console_pixmap = -1; |
214 | gcons_redraw_console(); |
253 | } |
215 | |
254 | active_console = newcons; |
216 | active_console = newcons; |
255 | gcons_change_console(newcons); |
217 | gcons_change_console(newcons); |
256 | conn = &connections[active_console]; |
218 | conn = &connections[active_console]; |
257 | 219 | ||
258 | set_style(&conn->screenbuffer.style); |
220 | set_style(&conn->screenbuffer.style); |
Line 294... | Line 256... | ||
294 | conn->screenbuffer.position_x); |
256 | conn->screenbuffer.position_x); |
295 | curs_visibility(conn->screenbuffer.is_cursor_visible); |
257 | curs_visibility(conn->screenbuffer.is_cursor_visible); |
296 | 258 | ||
297 | async_serialize_end(); |
259 | async_serialize_end(); |
298 | } |
260 | } |
- | 261 | } |
|
299 | 262 | ||
300 | /** Handler for keyboard */ |
263 | /** Handler for keyboard */ |
301 | static void keyboard_events(ipc_callid_t iid, ipc_call_t *icall) |
264 | static void keyboard_events(ipc_callid_t iid, ipc_call_t *icall) |
302 | { |
265 | { |
303 | ipc_callid_t callid; |
266 | ipc_callid_t callid; |
Line 495... | Line 458... | ||
495 | if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) |
458 | if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) |
496 | return -1; |
459 | return -1; |
497 | async_new_connection(phonehash, 0, NULL, keyboard_events); |
460 | async_new_connection(phonehash, 0, NULL, keyboard_events); |
498 | 461 | ||
499 | /* Connect to framebuffer driver */ |
462 | /* Connect to framebuffer driver */ |
500 | - | ||
501 | fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0, 0); |
463 | fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0, 0); |
502 | while (fb_info.phone < 0) { |
464 | while (fb_info.phone < 0) { |
503 | usleep(10000); |
465 | usleep(10000); |
504 | fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0, 0); |
466 | fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0, 0); |
505 | } |
467 | } |
506 | 468 | ||
507 | /* Save old kernel screen */ |
- | |
508 | kernel_pixmap = switch_screens(-1); |
- | |
509 | - | ||
510 | /* Initialize gcons */ |
469 | /* Initialize gcons */ |
511 | gcons_init(fb_info.phone); |
470 | gcons_init(fb_info.phone); |
512 | /* Synchronize, the gcons can have something in queue */ |
471 | /* Synchronize, the gcons can have something in queue */ |
513 | async_req_0_0(fb_info.phone, FB_FLUSH); |
472 | async_req_0_0(fb_info.phone, FB_FLUSH); |
514 | /* Enable double buffering */ |
- | |
515 | async_msg_2(fb_info.phone, FB_VIEWPORT_DB, (sysarg_t) -1, 1); |
- | |
516 | 473 | ||
517 | async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.rows, |
474 | async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.rows, |
518 | &fb_info.cols); |
475 | &fb_info.cols); |
519 | set_style_col(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND); |
476 | set_style_col(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND); |
520 | clrscr(); |
477 | clrscr(); |