Changeset ca645a2 in mainline for kernel/genarch/src/fb/fb.c


Ignore:
Timestamp:
2019-01-02T10:41:50Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7acd787
Parents:
e8d3165e
Message:

Slightly improve KFB scrolling speed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/fb/fb.c

    re8d3165e rca645a2  
    7676            (instance)->cols + (col))
    7777
     78#define BB_NEXT_COL(pos) (++(pos))
     79
    7880#define GLYPH_POS(instance, glyph, y) \
    7981        ((glyph) * (instance)->glyphbytes + (y) * (instance)->glyphscanline)
     
    270272                                unsigned int x;
    271273                                unsigned int col;
     274                                size_t bb_pos = BB_POS(instance, 0, row);
     275                                size_t bb_pos1 = BB_POS(instance, 0, row + 1);
    272276
    273277                                for (col = 0, x = 0; col < instance->cols;
     
    276280
    277281                                        if (row < instance->rows - 1) {
    278                                                 if (instance->backbuf[BB_POS(instance, col, row)] ==
    279                                                     instance->backbuf[BB_POS(instance, col, row + 1)])
    280                                                         continue;
    281 
    282                                                 glyph = instance->backbuf[BB_POS(instance, col, row + 1)];
     282                                                if (instance->backbuf[bb_pos] ==
     283                                                    instance->backbuf[bb_pos1])
     284                                                        goto skip;
     285
     286                                                glyph = instance->backbuf[bb_pos1];
    283287                                        } else
    284288                                                glyph = 0;
     
    287291                                            &instance->glyphs[GLYPH_POS(instance, glyph, yd)],
    288292                                            instance->glyphscanline);
     293                                skip:
     294                                        BB_NEXT_COL(bb_pos);
     295                                        BB_NEXT_COL(bb_pos1);
    289296                                }
    290297                        }
     
    373380                        unsigned int x;
    374381                        unsigned int col;
     382                        size_t bb_pos = BB_POS(instance, 0, row);
    375383
    376384                        for (col = 0, x = 0; col < instance->cols;
    377385                            col++, x += FONT_WIDTH) {
    378386                                uint16_t glyph =
    379                                     instance->backbuf[BB_POS(instance, col, row)];
     387                                    instance->backbuf[bb_pos];
    380388                                void *dst = &instance->addr[FB_POS(instance, x, y + yd)];
    381389                                void *src = &instance->glyphs[GLYPH_POS(instance, glyph, yd)];
    382390                                memcpy(dst, src, instance->glyphscanline);
     391                                BB_NEXT_COL(bb_pos);
    383392                        }
    384393                }
Note: See TracChangeset for help on using the changeset viewer.