On Sat, 2003-07-26 at 16:25, Aubin Paul wrote:
> On Sat, Jul 26, 2003 at 09:03:13AM +0200, Jesper Skov wrote:
> > Doing "SDL_GFXDRIVER=fbcon SDL_FBDEV=/dev/fb1 freevo" results in SDL
> > blanking the primary output.
> >
> > So pygame doesn't appear to behave in the same manner as mplayer. I
> > guess I'll have to look at the code to see if I can figure out why.
>
> It's probably something in SDL specifically not Pygame or Freevo, so
> you should probably start there.
>
> > If pygame could behave like mplayer (i.e., run from a terminal in X, but
> > redirect all its output/gfx to /dev/fb1) I'd be a very happy camper.
>
> Let me know how it turns out...
It is indeed SDL that's the cause of the problem. See the crude hack in
the attached patch - it makes Freevo run on TV-out, while leaving X
running on the primary output.
A proper fix would involve making a new SDL display driver which takes
the video stuff from 'fbcon' and the keyboard/mouse stuff from 'x11'.
The double-buffering case also needs to be addressed.
Personally, I plan on controlling Freevo solely by remote, and I'm not
interested in spending the time on such a modification of SDL. But maybe
the patch will wet someone's appetite?
Cheers,
Jesper
diff -uprN --exclude-from=/home/jskov/lib/diff-excludes -P /tmp/x/SDL-1.2/src/video/fbcon/SDL_fbvideo.c ./SDL_fbvideo.c
--- /tmp/x/SDL-1.2/src/video/fbcon/SDL_fbvideo.c 2002-09-02 23:42:15.000000000 +0200
+++ ./SDL_fbvideo.c 2003-07-26 21:22:47.000000000 +0200
@@ -52,6 +52,11 @@ static char rcsid =
#include "SDL_fbriva.h"
+#define FREEVO_HACK 1
+#if FREEVO_HACK
+# define BROKEN_MODES
+#endif
+
#if defined(i386) && defined(FB_TYPE_VGA_PLANES)
#define VGA16_FBCON_SUPPORT
#ifndef FB_AUX_VGA_PLANES_VGA4
@@ -726,10 +731,12 @@ static SDL_Surface *FB_SetVideoMode(_THI
char *surfaces_mem;
int surfaces_len;
+#if !FREEVO_HACK
/* Set the terminal into graphics mode */
if ( FB_EnterGraphicsMode(this) < 0 ) {
return(NULL);
}
+#endif
/* Restore the original palette */
FB_RestorePalette(this);
@@ -745,6 +752,9 @@ static SDL_Surface *FB_SetVideoMode(_THI
#endif
if ( (vinfo.xres != width) || (vinfo.yres != height) ||
(vinfo.bits_per_pixel != bpp) || (flags & SDL_DOUBLEBUF) ) {
+#if FREEVO_HACK
+ return NULL;
+#else
vinfo.activate = FB_ACTIVATE_NOW;
vinfo.accel_flags = 0;
vinfo.bits_per_pixel = bpp;
@@ -776,6 +786,7 @@ static SDL_Surface *FB_SetVideoMode(_THI
return(NULL);
}
}
+#endif /* FREEVO_HACK */
} else {
int maxheight;
@@ -1294,6 +1305,7 @@ static void FB_VGA16Update(_THIS, int nu
void FB_SavePaletteTo(_THIS, int palette_len, __u16 *area)
{
+#if !FREEVO_HACK
struct fb_cmap cmap;
cmap.start = 0;
@@ -1303,10 +1315,12 @@ void FB_SavePaletteTo(_THIS, int palette
cmap.blue = &area[2*palette_len];
cmap.transp = NULL;
ioctl(console_fd, FBIOGETCMAP, &cmap);
+#endif
}
void FB_RestorePaletteFrom(_THIS, int palette_len, __u16 *area)
{
+#if !FREEVO_HACK
struct fb_cmap cmap;
cmap.start = 0;
@@ -1316,11 +1330,13 @@ void FB_RestorePaletteFrom(_THIS, int pa
cmap.blue = &area[2*palette_len];
cmap.transp = NULL;
ioctl(console_fd, FBIOPUTCMAP, &cmap);
+#endif
}
static void FB_SavePalette(_THIS, struct fb_fix_screeninfo *finfo,
struct fb_var_screeninfo *vinfo)
{
+#if !FREEVO_HACK
int i;
/* Save hardware palette, if needed */
@@ -1359,16 +1375,19 @@ static void FB_SavePalette(_THIS, struct
}
FB_RestorePaletteFrom(this, 256, new_entries);
}
+#endif
}
static void FB_RestorePalette(_THIS)
{
+#if !FREEVO_HACK
/* Restore the original palette */
if ( saved_cmap ) {
FB_RestorePaletteFrom(this, saved_cmaplen, saved_cmap);
free(saved_cmap);
saved_cmap = NULL;
}
+#endif
}
static int FB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
@@ -1392,7 +1411,11 @@ static int FB_SetColors(_THIS, int first
cmap.blue = b;
cmap.transp = NULL;
+#if !FREEVO_HACK
if( (ioctl(console_fd, FBIOPUTCMAP, &cmap) < 0) ||
+#else
+ if (
+#endif
!(this->screen->flags & SDL_HWPALETTE) ) {
colors = this->screen->format->palette->colors;
ncolors = this->screen->format->palette->ncolors;
@@ -1469,12 +1492,13 @@ static void FB_VideoQuit(_THIS)
munmap(mapped_io, mapped_iolen);
mapped_io = NULL;
}
-
+#if !FREEVO_HACK
/* Restore the original video mode and palette */
if ( FB_InGraphicsMode(this) ) {
FB_RestorePalette(this);
ioctl(console_fd, FBIOPUT_VSCREENINFO, &saved_vinfo);
}
+#endif
/* We're all done with the framebuffer */
close(console_fd);