Changeset 76fca31 in mainline for uspace/srv/console/console.c
- Timestamp:
- 2008-12-16T19:02:07Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5ae4443
- Parents:
- 8fe5980
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/console/console.c
r8fe5980 r76fca31 87 87 * switching */ 88 88 89 static int kernel_pixmap = -1; /**< Number of fb pixmap, where kernel90 * console is stored */91 92 89 93 90 /** Find unused virtual console. … … 188 185 } 189 186 190 /** Save current screen to pixmap, draw old pixmap191 *192 * @param oldpixmap Old pixmap193 * @return ID of pixmap of current screen194 */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 187 /** Switch to new console */ 215 188 static void change_console(int newcons) 216 189 { 217 190 connection_t *conn; 218 static int console_pixmap = -1;219 191 int i, j, rc; 220 192 keyfield_t *field; 221 193 style_t *style; 222 194 223 195 if (newcons == active_console) 224 196 return; 225 197 226 198 if (newcons == KERNEL_CONSOLE) { 199 async_serialize_start(); 200 curs_visibility(0); 201 gcons_in_kernel(); 202 async_serialize_end(); 203 204 if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) 205 active_console = KERNEL_CONSOLE; 206 else 207 newcons == active_console; 208 } 209 210 if (newcons != KERNEL_CONSOLE) { 211 async_serialize_start(); 212 227 213 if (active_console == KERNEL_CONSOLE) 228 return; 229 active_console = KERNEL_CONSOLE; 214 gcons_redraw_console(); 215 216 active_console = newcons; 217 gcons_change_console(newcons); 218 conn = &connections[active_console]; 219 220 set_style(&conn->screenbuffer.style); 230 221 curs_visibility(0); 231 232 async_serialize_start(); 233 if (kernel_pixmap == -1) { 234 /* store/restore unsupported */ 235 set_style_col(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND); 222 if (interbuffer) { 223 for (i = 0; i < conn->screenbuffer.size_x; i++) 224 for (j = 0; j < conn->screenbuffer.size_y; j++) { 225 unsigned int size_x; 226 227 size_x = conn->screenbuffer.size_x; 228 interbuffer[i + j * size_x] = 229 *get_field_at(&conn->screenbuffer, i, j); 230 } 231 /* This call can preempt, but we are already at the end */ 232 rc = async_req_0_0(fb_info.phone, FB_DRAW_TEXT_DATA); 233 } 234 235 if ((!interbuffer) || (rc != 0)) { 236 set_style(&conn->screenbuffer.style); 236 237 clrscr(); 237 } else { 238 gcons_in_kernel(); 239 console_pixmap = switch_screens(kernel_pixmap); 240 kernel_pixmap = -1; 238 style = &conn->screenbuffer.style; 239 240 for (j = 0; j < conn->screenbuffer.size_y; j++) 241 for (i = 0; i < conn->screenbuffer.size_x; i++) { 242 field = get_field_at(&conn->screenbuffer, i, j); 243 if (!style_same(*style, field->style)) 244 set_style(&field->style); 245 style = &field->style; 246 if ((field->character == ' ') && 247 (style_same(field->style, 248 conn->screenbuffer.style))) 249 continue; 250 251 prtchr(field->character, j, i); 252 } 241 253 } 254 255 curs_goto(conn->screenbuffer.position_y, 256 conn->screenbuffer.position_x); 257 curs_visibility(conn->screenbuffer.is_cursor_visible); 258 242 259 async_serialize_end(); 243 244 __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE); 245 return; 246 } 247 248 async_serialize_start(); 249 250 if (console_pixmap != -1) { 251 kernel_pixmap = switch_screens(console_pixmap); 252 console_pixmap = -1; 253 } 254 active_console = newcons; 255 gcons_change_console(newcons); 256 conn = &connections[active_console]; 257 258 set_style(&conn->screenbuffer.style); 259 curs_visibility(0); 260 if (interbuffer) { 261 for (i = 0; i < conn->screenbuffer.size_x; i++) 262 for (j = 0; j < conn->screenbuffer.size_y; j++) { 263 unsigned int size_x; 264 265 size_x = conn->screenbuffer.size_x; 266 interbuffer[i + j * size_x] = 267 *get_field_at(&conn->screenbuffer, i, j); 268 } 269 /* This call can preempt, but we are already at the end */ 270 rc = async_req_0_0(fb_info.phone, FB_DRAW_TEXT_DATA); 271 } 272 273 if ((!interbuffer) || (rc != 0)) { 274 set_style(&conn->screenbuffer.style); 275 clrscr(); 276 style = &conn->screenbuffer.style; 277 278 for (j = 0; j < conn->screenbuffer.size_y; j++) 279 for (i = 0; i < conn->screenbuffer.size_x; i++) { 280 field = get_field_at(&conn->screenbuffer, i, j); 281 if (!style_same(*style, field->style)) 282 set_style(&field->style); 283 style = &field->style; 284 if ((field->character == ' ') && 285 (style_same(field->style, 286 conn->screenbuffer.style))) 287 continue; 288 289 prtchr(field->character, j, i); 290 } 291 } 292 293 curs_goto(conn->screenbuffer.position_y, 294 conn->screenbuffer.position_x); 295 curs_visibility(conn->screenbuffer.is_cursor_visible); 296 297 async_serialize_end(); 260 } 298 261 } 299 262 … … 498 461 499 462 /* Connect to framebuffer driver */ 500 501 463 fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0, 0); 502 464 while (fb_info.phone < 0) { … … 505 467 } 506 468 507 /* Save old kernel screen */508 kernel_pixmap = switch_screens(-1);509 510 469 /* Initialize gcons */ 511 470 gcons_init(fb_info.phone); 512 471 /* Synchronize, the gcons can have something in queue */ 513 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 474 async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.rows,
Note:
See TracChangeset
for help on using the changeset viewer.