aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/sys/vesa/fmtpixel.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-13 21:43:00 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-13 21:43:00 -0800
commitbc0516eb0e186087fefc90bca70fb06998ae7a71 (patch)
treea5bd2fab3b283d398ebf1133245961489d27c037 /com32/lib/sys/vesa/fmtpixel.c
parent4105dd749cb52ad061dc0eb04a3a821655d6c91f (diff)
downloadsyslinux-bc0516eb0e186087fefc90bca70fb06998ae7a71.tar.gz
syslinux-bc0516eb0e186087fefc90bca70fb06998ae7a71.tar.xz
syslinux-bc0516eb0e186087fefc90bca70fb06998ae7a71.zip
Bypass pixel conversion when the output format is BGRA32
When the output format is BGRA32, we don't need any conversion at all. Skip the dummy copy.
Diffstat (limited to 'com32/lib/sys/vesa/fmtpixel.c')
-rw-r--r--com32/lib/sys/vesa/fmtpixel.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/com32/lib/sys/vesa/fmtpixel.c b/com32/lib/sys/vesa/fmtpixel.c
index 74c79ef1..fc2732ef 100644
--- a/com32/lib/sys/vesa/fmtpixel.c
+++ b/com32/lib/sys/vesa/fmtpixel.c
@@ -34,23 +34,21 @@
#include <inttypes.h>
#include "video.h"
-/* Format a pixel and return the advanced pointer.
- THIS FUNCTION IS ALLOWED TO WRITE BEYOND THE END OF THE PIXEL. */
-
-static inline uint32_t *copy_dword(uint32_t *dst, const uint32_t *src,
- size_t dword_count)
-{
- asm volatile("cld; rep; movsl"
- : "+D" (dst), "+S" (src), "+c" (dword_count));
- return dst; /* Updated destination pointer */
-}
+/*
+ * Format a sequence of pixels. The first argument is the line buffer;
+ * we can use it to write up to 4 bytes past the end of the last pixel.
+ * Return the place we should be copying from, this is usually the
+ * buffer address, but doesn't *have* to be.
+ */
-static void *format_pxf_bgra32(void *ptr, const uint32_t *p, size_t n)
+static const void *
+format_pxf_bgra32(void *ptr, const uint32_t *p, size_t n)
{
- return copy_dword(ptr, p, n);
+ return p; /* No conversion needed! */
}
-static void *format_pxf_bgr24(void *ptr, const uint32_t *p, size_t n)
+static const void *
+format_pxf_bgr24(void *ptr, const uint32_t *p, size_t n)
{
char *q = ptr;
@@ -58,10 +56,11 @@ static void *format_pxf_bgr24(void *ptr, const uint32_t *p, size_t n)
*(uint32_t *)q = *p++;
q += 3;
}
- return q;
+ return ptr;
}
-static void *format_pxf_le_rgb16_565(void *ptr, const uint32_t *p, size_t n)
+static const void *
+format_pxf_le_rgb16_565(void *ptr, const uint32_t *p, size_t n)
{
uint32_t bgra;
uint16_t *q = ptr;
@@ -73,10 +72,11 @@ static void *format_pxf_le_rgb16_565(void *ptr, const uint32_t *p, size_t n)
((bgra >> (2+8-5)) & (0x3f << 5)) +
((bgra >> (3+16-11)) & (0x1f << 11));
}
- return q;
+ return ptr;
}
-static void *format_pxf_le_rgb15_555(void *ptr, const uint32_t *p, size_t n)
+static const void *
+format_pxf_le_rgb15_555(void *ptr, const uint32_t *p, size_t n)
{
uint32_t bgra;
uint16_t *q = ptr;
@@ -88,7 +88,7 @@ static void *format_pxf_le_rgb15_555(void *ptr, const uint32_t *p, size_t n)
((bgra >> (2+8-5)) & (0x1f << 5)) +
((bgra >> (3+16-10)) & (0x1f << 10));
}
- return q;
+ return ptr;
}
__vesacon_format_pixels_t __vesacon_format_pixels;