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