Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148275881
D50843.1786085846.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D50843.1786085846.diff
View Options
diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c
--- a/sys/dev/vt/hw/fb/vt_fb.c
+++ b/sys/dev/vt/hw/fb/vt_fb.c
@@ -34,6 +34,7 @@
#include <sys/queue.h>
#include <sys/fbio.h>
#include <sys/kernel.h>
+#include <sys/endian.h>
#include <dev/vt/vt.h>
#include <dev/vt/hw/fb/vt_fb.h>
#include <dev/vt/colors/vt_termcolors.h>
@@ -78,6 +79,22 @@
*(uint16_t *)(sc->fb_vbase + o) = v;
}
+static void
+vt_fb_mem_wr3(struct fb_info *sc, uint32_t o, uint32_t v)
+{
+ uint8_t *b = (uint8_t *)sc->fb_vbase + o;
+
+ KASSERT((o + 2 < sc->fb_size), ("Offset %#08x out of fb size", o + 2));
+ /*
+ * We want to write three bytes, independent
+ * of endianness. Multiply _QUAD_LOWWORD and
+ * _QUAD_HIGHWORD by 2 to skip the middle byte.
+ */
+ b[_QUAD_LOWWORD * 2] = v & 0xff;
+ b[1] = (v >> 8) & 0xff;
+ b[_QUAD_HIGHWORD * 2] = (v >> 16) & 0xff;
+}
+
static void
vt_fb_mem_wr4(struct fb_info *sc, uint32_t o, uint32_t v)
{
@@ -187,9 +204,7 @@
vt_fb_mem_wr2(info, o, c);
break;
case 3:
- vt_fb_mem_wr1(info, o, (c >> 16) & 0xff);
- vt_fb_mem_wr1(info, o + 1, (c >> 8) & 0xff);
- vt_fb_mem_wr1(info, o + 2, c & 0xff);
+ vt_fb_mem_wr3(info, o, c);
break;
case 4:
vt_fb_mem_wr4(info, o, c);
@@ -246,12 +261,7 @@
case 3:
for (h = 0; h < info->fb_height; h++)
for (o = 0; o < info->fb_stride - 2; o += 3) {
- vt_fb_mem_wr1(info, h*info->fb_stride + o,
- (c >> 16) & 0xff);
- vt_fb_mem_wr1(info, h*info->fb_stride + o + 1,
- (c >> 8) & 0xff);
- vt_fb_mem_wr1(info, h*info->fb_stride + o + 2,
- c & 0xff);
+ vt_fb_mem_wr3(info, h*info->fb_stride + o, c);
}
break;
case 4:
@@ -317,10 +327,7 @@
vt_fb_mem_wr2(info, o, cc);
break;
case 3:
- /* Packed mode, so unaligned. Byte access. */
- vt_fb_mem_wr1(info, o, (cc >> 16) & 0xff);
- vt_fb_mem_wr1(info, o + 1, (cc >> 8) & 0xff);
- vt_fb_mem_wr1(info, o + 2, cc & 0xff);
+ vt_fb_mem_wr3(info, o, cc);
break;
case 4:
vt_fb_mem_wr4(info, o, cc);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 7, 6:57 AM (19 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29365544
Default Alt Text
D50843.1786085846.diff (1 KB)
Attached To
Mode
D50843: vt_fb: account for endianness
Attached
Detach File
Event Timeline
Log In to Comment