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