FreeBSD Bugzilla – Attachment 148738 Details for
Bug 194635
Speed optimisation for framebuffer console driver on Raspberry Pi
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
unified diff on /sys/arm/broadcom/bcm2835/bcm2835_fb.c
bcm2835_fb.c.diff (text/plain), 3.91 KB, created by
Stefan Berndt
on 2014-10-28 16:07:50 UTC
(
hide
)
Description:
unified diff on /sys/arm/broadcom/bcm2835/bcm2835_fb.c
Filename:
MIME Type:
Creator:
Stefan Berndt
Created:
2014-10-28 16:07:50 UTC
Size:
3.91 KB
patch
obsolete
>--- bcm2835_fb.c.old 2014-01-16 21:33:23.000000000 +0100 >+++ bcm2835_fb.c 2014-10-27 16:52:32.000000000 +0100 >@@ -77,7 +77,26 @@ > uint8_t b; > }; > >-static struct argb bcmfb_palette[16] = { >+static uint16_t bcmfb_palette16[16] = { >+ 0x0000, >+ 0x0015, >+ 0x0540, >+ 0x0555, >+ 0xa800, >+ 0xa815, >+ 0xaaa0, >+ 0xad55, >+ 0x52aa, >+ 0x52bf, >+ 0x57ea, >+ 0x57ff, >+ 0xfaaa, >+ 0xfabf, >+ 0xffea, >+ 0xffff >+}; >+ >+static struct argb bcmfb_palette24[16] = { > {0x00, 0x00, 0x00, 0x00}, > {0x00, 0x00, 0x00, 0xaa}, > {0x00, 0x00, 0xaa, 0x00}, >@@ -96,6 +115,25 @@ > {0x00, 0xff, 0xff, 0xff} > }; > >+static uint32_t bcmfb_palette32[16] = { >+ 0x00000000, >+ 0x00aa0000, >+ 0x0000aa00, >+ 0x00aaaa00, >+ 0x000000aa, >+ 0x00aa00aa, >+ 0x000055aa, >+ 0x00aaaaaa, >+ 0x00555555, >+ 0x00ff5555, >+ 0x0055ff55, >+ 0x00ffff55, >+ 0x005555ff, >+ 0x00ff55ff, >+ 0x0055ffff, >+ 0x00ffffff >+}; >+ > /* mouse pointer from dev/syscons/scgfbrndr.c */ > static u_char mouse_pointer[16] = { > 0x00, 0x40, 0x60, 0x70, 0x78, 0x7c, 0x7e, 0x68, >@@ -902,11 +940,17 @@ > struct video_adapter_softc *sc; > int row; > int col; >- int i, j, k; >+ int i, j; > uint8_t *addr; >+ uint16_t *addr16; >+ uint32_t *addr32; > u_char *p; >- uint8_t fg, bg, color; >- uint16_t rgb; >+ uint8_t fg, bg; >+ uint32_t fg32, bg32; >+ uint8_t fg24r, bg24r, fg24g, bg24g, fg24b, bg24b; >+ uint16_t fg16, bg16; >+ u_char pa; >+ uint32_t stride; > > sc = (struct video_adapter_softc *)adp; > >@@ -916,48 +960,69 @@ > row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; > col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; > p = sc->font + c*BCMFB_FONT_HEIGHT; >- addr = (uint8_t *)sc->fb_addr >- + (row + sc->ymargin)*(sc->stride) >- + (sc->depth/8) * (col + sc->xmargin); > > fg = a & 0xf ; > bg = (a >> 4) & 0xf; > >- for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { >- for (j = 0, k = 7; j < 8; j++, k--) { >- if ((p[i] & (1 << k)) == 0) >- color = bg; >- else >- color = fg; >+ addr = (uint8_t *)sc->fb_addr >+ + (row + sc->ymargin)*(sc->stride) >+ + (sc->depth/8) * (col + sc->xmargin); > >- switch (sc->depth) { >- case 32: >- addr[4*j+0] = bcmfb_palette[color].r; >- addr[4*j+1] = bcmfb_palette[color].g; >- addr[4*j+2] = bcmfb_palette[color].b; >- addr[4*j+3] = bcmfb_palette[color].a; >- break; >- case 24: >- addr[3*j] = bcmfb_palette[color].r; >- addr[3*j+1] = bcmfb_palette[color].g; >- addr[3*j+2] = bcmfb_palette[color].b; >- break; >- case 16: >- rgb = (bcmfb_palette[color].r >> 3) << 11; >- rgb |= (bcmfb_palette[color].g >> 2) << 5; >- rgb |= (bcmfb_palette[color].b >> 3); >- addr[2*j] = rgb & 0xff; >- addr[2*j + 1] = (rgb >> 8) & 0xff; >- default: >- /* Not supported yet */ >- break; >+ switch (sc->depth) { >+ case 32: >+ fg32 = bcmfb_palette32[fg]; >+ bg32 = bcmfb_palette32[bg]; >+ addr32 = (uint32_t *)addr; >+ stride = sc->stride >> 2; >+ for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { >+ pa = p[i]; >+ for (j = 0; j < 8; j++) { >+ addr32[j] = (pa & 128) ? fg32 : bg32; >+ pa = pa << 1; > } >+ addr32 += stride; > } >- >- addr += (sc->stride); >+ break; >+ case 24: >+ fg24r = bcmfb_palette24[fg].r; >+ fg24g = bcmfb_palette24[fg].g; >+ fg24b = bcmfb_palette24[fg].b; >+ bg24r = bcmfb_palette24[bg].r; >+ bg24g = bcmfb_palette24[bg].g; >+ bg24b = bcmfb_palette24[bg].b; >+ for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { >+ pa = p[i]; >+ for (j = 0; j < 24; j+=3) { >+ if (pa & 128) { >+ addr[j] = fg24r; >+ addr[j+1] = fg24g; >+ addr[j+2] = fg24b; >+ } else { >+ addr[j] = bg24r; >+ addr[j+1] = bg24g; >+ addr[j+2] = bg24b; >+ } >+ pa = pa << 1; >+ } >+ addr += sc->stride; >+ } >+ break; >+ case 16: >+ fg16 = bcmfb_palette16[fg]; >+ bg16 = bcmfb_palette16[bg]; >+ stride = sc->stride >> 1; >+ addr16 = (uint16_t *)addr; >+ for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { >+ pa = p[i]; >+ for (j = 0; j < 8; j++) { >+ addr16[j] = (pa & 128) ? fg16 : bg16; >+ pa = pa << 1; >+ } >+ addr16 += stride; >+ } >+ break; > } >- >- return (0); >+ return (0); > } > > static int
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 194635
:
148707
| 148738 |
149418