diff options
author | Martin-Éric Racine <q-funk@iki.fi> | 2008-01-14 03:05:48 +0200 |
---|---|---|
committer | Martin-Éric Racine <q-funk@iki.fi> | 2008-01-14 03:05:48 +0200 |
commit | cf5e5d2b37de2504b76d96e1f26a5450550b8320 (patch) | |
tree | 399afd78a4244ef975ab09420d00ba225fc7cbaf /src/amd_common.c | |
parent | 471f96cf85c6db9952ff4443f84a3c8d701927e7 (diff) |
Basic OLPC support from Bernardo Innocenti and Jordan Crouse.xf86-video-amd-2.7.7.5
Diffstat (limited to 'src/amd_common.c')
-rw-r--r-- | src/amd_common.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/amd_common.c b/src/amd_common.c index 86a8e86..375ade8 100644 --- a/src/amd_common.c +++ b/src/amd_common.c @@ -30,6 +30,13 @@ #include "config.h" #endif +#include <string.h> /* memcmp() */ +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <sys/ioctl.h> + #include "xf86.h" #include "amd.h" @@ -157,3 +164,39 @@ GeodeCopyGreyscale(unsigned char *src, unsigned char *dst, src2 += srcPitch; } } + +#if defined(linux) + +#include <linux/fb.h> + +int GeodeGetSizeFromFB(unsigned int *size) +{ + struct fb_fix_screeninfo fix; + int ret; + int fd = open("/dev/fb0", O_RDONLY); + + if (fd == -1) + return -1; + + ret = ioctl(fd, FBIOGET_FSCREENINFO, &fix); + close(fd); + + if (!ret) { + if (!memcmp(fix.id, "Geode", 5)) { + *size = fix.smem_len; + return 0; + } + } + + return -1; +} + +#else + +int GeodeGetSizeFromFB(unsigned int *size) +{ + return -1; +} + +#endif + |