diff options
Diffstat (limited to 'src/geode_common.c')
-rw-r--r-- | src/geode_common.c | 140 |
1 files changed, 69 insertions, 71 deletions
diff --git a/src/geode_common.c b/src/geode_common.c index 083b2f6..2e02af1 100644 --- a/src/geode_common.c +++ b/src/geode_common.c @@ -30,7 +30,7 @@ #include "config.h" #endif -#include <string.h> /* memcmp() */ +#include <string.h> /* memcmp() */ #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> @@ -47,8 +47,6 @@ : "0" (n), "1" (s), "2" (d) \ : "memory") - - #define move1(d,s,n) \ __asm__ __volatile__( \ " rep; movsl\n" \ @@ -74,7 +72,6 @@ : "0" (n), "1" (s), "2" (d) \ : "memory") - void geode_memory_to_screen_blt(unsigned long src, unsigned long dst, unsigned long sp, unsigned long dp, long w, long h, int bpp) @@ -85,33 +82,33 @@ geode_memory_to_screen_blt(unsigned long src, unsigned long dst, switch (n & 3) { case 0: - while (--h >= 0) { - move0(dst, src, m); - src += sp; - dst += dp; - } - break; + while (--h >= 0) { + move0(dst, src, m); + src += sp; + dst += dp; + } + break; case 1: - while (--h >= 0) { - move1(dst, src, m); - src += sp; - dst += dp; - } - break; + while (--h >= 0) { + move1(dst, src, m); + src += sp; + dst += dp; + } + break; case 2: - while (--h >= 0) { - move2(dst, src, m); - src += sp; - dst += dp; - } - break; + while (--h >= 0) { + move2(dst, src, m); + src += sp; + dst += dp; + } + break; case 3: - while (--h >= 0) { - move3(dst, src, m); - src += sp; - dst += dp; - } - break; + while (--h >= 0) { + move3(dst, src, m); + src += sp; + dst += dp; + } + break; } } @@ -130,73 +127,74 @@ GeodeGetRefreshRate(DisplayModePtr pMode) /* This is used by both GX and LX. It could be accelerated for LX, probably, but that would involve a two pass blt, the first to copy the data, and the second - to copy the grey (using a pattern). That seems like a bit of work for a + to copy the grey (using a pattern). That seems like a bit of work for a very underused format - so we'll just use the slow version. */ void GeodeCopyGreyscale(unsigned char *src, unsigned char *dst, - int dstPitch, int srcPitch, int h, int w) + int dstPitch, int srcPitch, int h, int w) { - int i; - unsigned char *src2 = src; - unsigned char *dst2 = dst; - unsigned char *dst3; - unsigned char *src3; - - dstPitch <<= 1; - - while (h--) { - dst3 = dst2; - src3 = src2; - for (i = 0; i < w; i++) { - *dst3++ = *src3++; /* Copy Y data */ - *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ - } - - src3 = src2; - for (i = 0; i < w; i++) { - *dst3++ = *src3++; /* Copy Y data */ - *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ + int i; + unsigned char *src2 = src; + unsigned char *dst2 = dst; + unsigned char *dst3; + unsigned char *src3; + + dstPitch <<= 1; + + while (h--) { + dst3 = dst2; + src3 = src2; + for (i = 0; i < w; i++) { + *dst3++ = *src3++; /* Copy Y data */ + *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ + } + + src3 = src2; + for (i = 0; i < w; i++) { + *dst3++ = *src3++; /* Copy Y data */ + *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ + } + + dst2 += dstPitch; + src2 += srcPitch; } - - dst2 += dstPitch; - src2 += srcPitch; - } } #if defined(linux) #include <linux/fb.h> -int GeodeGetSizeFromFB(unsigned int *size) +int +GeodeGetSizeFromFB(unsigned int *size) { - struct fb_fix_screeninfo fix; - int ret; - int fd = open("/dev/fb0", O_RDONLY); + struct fb_fix_screeninfo fix; + int ret; + int fd = open("/dev/fb0", O_RDONLY); - if (fd == -1) - return -1; + if (fd == -1) + return -1; - ret = ioctl(fd, FBIOGET_FSCREENINFO, &fix); - close(fd); + ret = ioctl(fd, FBIOGET_FSCREENINFO, &fix); + close(fd); - if (!ret) { - if (!memcmp(fix.id, "Geode", 5)) { - *size = fix.smem_len; - return 0; - } + if (!ret) { + if (!memcmp(fix.id, "Geode", 5)) { + *size = fix.smem_len; + return 0; } + } - return -1; + return -1; } #else -int GeodeGetSizeFromFB(unsigned int *size) +int +GeodeGetSizeFromFB(unsigned int *size) { - return -1; + return -1; } #endif - |