Changes in kernel/genarch/src/fb/fb.c [c0699467:c263c77] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/fb/fb.c
rc0699467 rc263c77 36 36 #include <genarch/fb/font-8x16.h> 37 37 #include <genarch/fb/logo-196x66.h> 38 #include <genarch/fb/visuals.h> 38 39 #include <genarch/fb/fb.h> 39 40 #include <console/chardev.h> … … 81 82 SPINLOCK_DECLARE(lock); 82 83 83 parea_t parea;84 85 84 uint8_t *addr; 86 85 uint16_t *backbuf; … … 110 109 } fb_instance_t; 111 110 112 static void fb_putchar(outdev_t *dev, wchar_t ch );111 static void fb_putchar(outdev_t *dev, wchar_t ch, bool silent); 113 112 static void fb_redraw_internal(fb_instance_t *instance); 114 113 static void fb_redraw(outdev_t *dev); … … 216 215 * 217 216 */ 218 static void logo_hide(fb_instance_t *instance )217 static void logo_hide(fb_instance_t *instance, bool silent) 219 218 { 220 219 instance->ylogo = 0; … … 222 221 instance->rowtrim = instance->rows; 223 222 224 if ( (!instance->parea.mapped) || (console_override))223 if (!silent) 225 224 fb_redraw_internal(instance); 226 225 } … … 230 229 */ 231 230 static void glyph_draw(fb_instance_t *instance, uint16_t glyph, 232 unsigned int col, unsigned int row, bool overlay)231 unsigned int col, unsigned int row, bool silent, bool overlay) 233 232 { 234 233 unsigned int x = COL2X(col); … … 237 236 238 237 if (y >= instance->ytrim) 239 logo_hide(instance );238 logo_hide(instance, silent); 240 239 241 240 if (!overlay) 242 241 instance->backbuf[BB_POS(instance, col, row)] = glyph; 243 242 244 if ( (!instance->parea.mapped) || (console_override)) {243 if (!silent) { 245 244 for (yd = 0; yd < FONT_SCANLINES; yd++) 246 245 memcpy(&instance->addr[FB_POS(instance, x, y + yd + instance->ylogo)], … … 254 253 * 255 254 */ 256 static void screen_scroll(fb_instance_t *instance )255 static void screen_scroll(fb_instance_t *instance, bool silent) 257 256 { 258 257 if (instance->ylogo > 0) { 259 logo_hide(instance );258 logo_hide(instance, silent); 260 259 return; 261 260 } 262 261 263 if ( (!instance->parea.mapped) || (console_override)) {262 if (!silent) { 264 263 unsigned int row; 265 264 … … 299 298 } 300 299 301 static void cursor_put(fb_instance_t *instance )300 static void cursor_put(fb_instance_t *instance, bool silent) 302 301 { 303 302 unsigned int col = instance->position % instance->cols; 304 303 unsigned int row = instance->position / instance->cols; 305 304 306 glyph_draw(instance, fb_font_glyph(U_CURSOR), col, row, true);307 } 308 309 static void cursor_remove(fb_instance_t *instance )305 glyph_draw(instance, fb_font_glyph(U_CURSOR), col, row, silent, true); 306 } 307 308 static void cursor_remove(fb_instance_t *instance, bool silent) 310 309 { 311 310 unsigned int col = instance->position % instance->cols; … … 313 312 314 313 glyph_draw(instance, instance->backbuf[BB_POS(instance, col, row)], 315 col, row, true);314 col, row, silent, true); 316 315 } 317 316 … … 363 362 * 364 363 */ 365 static void fb_putchar(outdev_t *dev, wchar_t ch )364 static void fb_putchar(outdev_t *dev, wchar_t ch, bool silent) 366 365 { 367 366 fb_instance_t *instance = (fb_instance_t *) dev->data; … … 370 369 switch (ch) { 371 370 case '\n': 372 cursor_remove(instance );371 cursor_remove(instance, silent); 373 372 instance->position += instance->cols; 374 373 instance->position -= instance->position % instance->cols; 375 374 break; 376 375 case '\r': 377 cursor_remove(instance );376 cursor_remove(instance, silent); 378 377 instance->position -= instance->position % instance->cols; 379 378 break; 380 379 case '\b': 381 cursor_remove(instance );380 cursor_remove(instance, silent); 382 381 if (instance->position % instance->cols) 383 382 instance->position--; 384 383 break; 385 384 case '\t': 386 cursor_remove(instance );385 cursor_remove(instance, silent); 387 386 do { 388 387 glyph_draw(instance, fb_font_glyph(' '), 389 388 instance->position % instance->cols, 390 instance->position / instance->cols, false);389 instance->position / instance->cols, silent, false); 391 390 instance->position++; 392 391 } while ((instance->position % 8) … … 396 395 glyph_draw(instance, fb_font_glyph(ch), 397 396 instance->position % instance->cols, 398 instance->position / instance->cols, false);397 instance->position / instance->cols, silent, false); 399 398 instance->position++; 400 399 } … … 402 401 if (instance->position >= instance->cols * instance->rows) { 403 402 instance->position -= instance->cols; 404 screen_scroll(instance );405 } 406 407 cursor_put(instance );403 screen_scroll(instance, silent); 404 } 405 406 cursor_put(instance, silent); 408 407 409 408 spinlock_unlock(&instance->lock); … … 556 555 557 556 spinlock_initialize(&instance->lock, "*fb.instance.lock"); 558 559 557 instance->rgb_conv = rgb_conv; 560 558 instance->pixelbytes = pixelbytes; … … 625 623 glyphs_render(instance); 626 624 627 link_initialize(&instance->parea.link);628 instance->parea.pbase = props->addr;629 instance->parea.frames = SIZE2FRAMES(fbsize);630 instance->parea.unpriv = false;631 instance->parea.mapped = false;632 ddi_parea_register(&instance->parea);633 634 625 if (!fb_exported) { 635 626 /* 636 * We export the kernel framebuffer for uspace usage. 637 * This is used in the case the uspace framebuffer 638 * driver is not self-sufficient. 627 * This is the necessary evil until the userspace driver is entirely 628 * self-sufficient. 639 629 */ 640 630 sysinfo_set_item_val("fb", NULL, true);
Note:
See TracChangeset
for help on using the changeset viewer.