aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib
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
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')
-rw-r--r--com32/lib/sys/vesa/fmtpixel.c36
-rw-r--r--com32/lib/sys/vesa/screencpy.c3
-rw-r--r--com32/lib/sys/vesa/video.h3
3 files changed, 21 insertions, 21 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;
diff --git a/com32/lib/sys/vesa/screencpy.c b/com32/lib/sys/vesa/screencpy.c
index 837499e2..ac9b24ea 100644
--- a/com32/lib/sys/vesa/screencpy.c
+++ b/com32/lib/sys/vesa/screencpy.c
@@ -98,9 +98,8 @@ void __vesacon_copy_to_screen(size_t dst, const uint32_t *src, size_t npixels)
char rowbuf[bytes+4];
const char *s;
- __vesacon_format_pixels(rowbuf, src, npixels);
+ s = (const char *)__vesacon_format_pixels(rowbuf, src, npixels);
- s = rowbuf;
while (bytes) {
win_off = dst & omask;
win_pos = dst & ~omask;
diff --git a/com32/lib/sys/vesa/video.h b/com32/lib/sys/vesa/video.h
index c5f26034..40537c19 100644
--- a/com32/lib/sys/vesa/video.h
+++ b/com32/lib/sys/vesa/video.h
@@ -60,7 +60,8 @@ enum vesa_pixel_format {
};
extern enum vesa_pixel_format __vesacon_pixel_format;
extern unsigned int __vesacon_bytes_per_pixel;
-typedef void * (*__vesacon_format_pixels_t)(void *, const uint32_t *, size_t);
+typedef const void * (*__vesacon_format_pixels_t)(void *, const uint32_t *,
+ size_t);
extern __vesacon_format_pixels_t __vesacon_format_pixels;
extern const __vesacon_format_pixels_t __vesacon_format_pixels_list[PXF_NONE];