Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merged r2981:2982 from branches/SDL-1.2: fbcon getpagesize() compile …
…fix.
  • Loading branch information
icculus committed Feb 15, 2007
1 parent c05c966 commit efd5039
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions configure.in
Expand Up @@ -1117,6 +1117,7 @@ AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[d
]) ])
AC_MSG_RESULT($video_fbcon) AC_MSG_RESULT($video_fbcon)
if test x$video_fbcon = xyes; then if test x$video_fbcon = xyes; then
AC_CHECK_FUNCS(getpagesize)
AC_DEFINE(SDL_VIDEO_DRIVER_FBCON) AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c" SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
have_video=yes have_video=yes
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config.h.in
Expand Up @@ -130,6 +130,7 @@
#undef HAVE_NANOSLEEP #undef HAVE_NANOSLEEP
#undef HAVE_CLOCK_GETTIME #undef HAVE_CLOCK_GETTIME
#undef HAVE_DLVSYM #undef HAVE_DLVSYM
#undef HAVE_GETPAGESIZE


#else #else
/* We may need some replacement for stdarg.h here */ /* We may need some replacement for stdarg.h here */
Expand Down
16 changes: 15 additions & 1 deletion src/video/fbcon/SDL_fbvideo.c
Expand Up @@ -177,6 +177,19 @@ static void FB_SavePalette(_THIS, struct fb_fix_screeninfo *finfo,
struct fb_var_screeninfo *vinfo); struct fb_var_screeninfo *vinfo);
static void FB_RestorePalette(_THIS); static void FB_RestorePalette(_THIS);


static int SDL_getpagesize(void)
{
#ifdef HAVE_GETPAGESIZE
return getpagesize();
#elif defined(PAGE_SIZE)
return PAGE_SIZE;
#else
#error Can not determine system page size.
return 4096; /* this is what it USED to be in Linux... */
#endif
}


/* Small wrapper for mmap() so we can play nicely with no-mmu hosts /* Small wrapper for mmap() so we can play nicely with no-mmu hosts
* (non-mmu hosts disallow the MAP_SHARED flag) */ * (non-mmu hosts disallow the MAP_SHARED flag) */


Expand Down Expand Up @@ -508,6 +521,7 @@ FB_SortModes(_THIS)
static int static int
FB_VideoInit(_THIS, SDL_PixelFormat * vformat) FB_VideoInit(_THIS, SDL_PixelFormat * vformat)
{ {
const int pagesize = SDL_getpagesize();
struct fb_fix_screeninfo finfo; struct fb_fix_screeninfo finfo;
struct fb_var_screeninfo vinfo; struct fb_var_screeninfo vinfo;
int i, j; int i, j;
Expand Down Expand Up @@ -589,7 +603,7 @@ FB_VideoInit(_THIS, SDL_PixelFormat * vformat)


/* Memory map the device, compensating for buggy PPC mmap() */ /* Memory map the device, compensating for buggy PPC mmap() */
mapped_offset = (((long) finfo.smem_start) - mapped_offset = (((long) finfo.smem_start) -
(((long) finfo.smem_start) & ~(PAGE_SIZE - 1))); (((long) finfo.smem_start) & ~(pagesize - 1)));
mapped_memlen = finfo.smem_len + mapped_offset; mapped_memlen = finfo.smem_len + mapped_offset;
mapped_mem = do_mmap(NULL, mapped_memlen, mapped_mem = do_mmap(NULL, mapped_memlen,
PROT_READ | PROT_WRITE, MAP_SHARED, console_fd, 0); PROT_READ | PROT_WRITE, MAP_SHARED, console_fd, 0);
Expand Down

0 comments on commit efd5039

Please sign in to comment.