String drawing optim
Quoted 12 lines · Geert Uytterhoeven
Quoted 10 lines · James Simmons
Quoted 4 lines
What about getting rid of one-char putc, implementing it in terms of putcs? I'm doing it in matroxfb patches, and nobody complained yet, and with current length of {fbcon,accel}_putc{s,} I was not able to find measurable speed difference between putc and putc through putcs variants.
Hm. I compressed all the image drawing functions into
accel_putcswhich is used in many places. I then placedaccel_putc()intofbcon_putc(). I could haveaccel_putcs()called infbcon_putc(). The advantage is smaller amount of code. The offset is a big more overhead plus a function call. What do people think here?
Quoted 7 lines
putc()is almost never called, IIRC. We did our best to combine as much data as possible and callputcs().A quick grep showed ->con_putc() is called only in
drivers/char/vt.cfor:
- Complementing the pointer position (for gpm)
- Inserting/deleting single characters
- Softcursor
Insert and Delete char are especially funny, as they do:
scr_memsetw(p, video_erase_char, nr * 2);
...
attr = video_erase_char >> 8;
while (nr--) {
sw->con_putc(vc_cons[currcons].d,
video_erase_char, y,
video_num_columns-1-nr);
}attr = oldattr;
so we can turn whole loop into one single putcs() call, asking for painting 'nr' characters from 'p' at y,video_num_columns-nr, which will definitely help... And I believe that vc's attr is not used by putc/putcs anymore, we always pass color explicit (in upper bits of character).
Petr Vandrovec