summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libvo/mga_common.c16
-rw-r--r--libvo/video_out.c2
-rw-r--r--libvo/vo_mga.c17
-rw-r--r--libvo/vo_xmga.c18
4 files changed, 28 insertions, 25 deletions
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index 50a5954635..96eb765c6a 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -1,6 +1,8 @@
// mga_vid drawing functions
+extern int mga_next_frame;
+
static void
write_frame_g200(uint8_t *y,uint8_t *cr, uint8_t *cb)
{
@@ -154,17 +156,15 @@ draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
static void
vo_mga_flip_page(void)
{
-#if 0
- ioctl(f,MGA_VID_FSEL,&next_frame);
-
- if (next_frame)
- vid_data = frame1;
- else
- vid_data = frame0;
- next_frame = 2 - next_frame; // switch between fields A1 and B1
+// printf("-- flip to %d --\n",mga_next_frame);
+#if 1
+ ioctl(f,MGA_VID_FSEL,&mga_next_frame);
+ mga_next_frame=(mga_next_frame+1)&3;
+ vid_data=frames[mga_next_frame];
#endif
+
}
diff --git a/libvo/video_out.c b/libvo/video_out.c
index a5483d3126..3163c3d0dd 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -35,6 +35,8 @@
// Externally visible list of all vo drivers
//
+int mga_next_frame=0;
+
extern vo_functions_t video_out_mga;
extern vo_functions_t video_out_xmga;
extern vo_functions_t video_out_x11;
diff --git a/libvo/vo_mga.c b/libvo/vo_mga.c
index 9416f7b9d3..bd91eae003 100644
--- a/libvo/vo_mga.c
+++ b/libvo/vo_mga.c
@@ -50,8 +50,7 @@ static vo_info_t vo_info =
};
static mga_vid_config_t mga_vid_config;
-static uint8_t *vid_data, *frame0, *frame1;
-static int next_frame = 0;
+static uint8_t *vid_data, *frames[4];
static int f;
#include "mga_common.c"
@@ -98,14 +97,16 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3
ioctl(f,MGA_VID_ON,0);
frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
- frame_mem = (char*)mmap(0,frame_size*2,PROT_WRITE,MAP_SHARED,f,0);
- frame0 = frame_mem;
- frame1 = frame_mem + frame_size;
- vid_data = frame0;
- next_frame = 0;
+ frame_mem = (char*)mmap(0,frame_size*4,PROT_WRITE,MAP_SHARED,f,0);
+ frames[0] = frame_mem;
+ frames[1] = frame_mem + 1*frame_size;
+ frames[2] = frame_mem + 2*frame_size;
+ frames[3] = frame_mem + 3*frame_size;
+ mga_next_frame = 0;
+ vid_data = frames[mga_next_frame];
//clear the buffer
- memset(frame_mem,0x80,frame_size*2);
+ memset(frame_mem,0x80,frame_size*4);
return 0;
}
diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c
index c84f7778c3..ee91a2e231 100644
--- a/libvo/vo_xmga.c
+++ b/libvo/vo_xmga.c
@@ -55,9 +55,7 @@ static vo_info_t vo_info =
static mga_vid_config_t mga_vid_config;
static uint8_t * vid_data;
-static uint8_t * frame0;
-static uint8_t * frame1;
-static int next_frame=0;
+static uint8_t * frames[4];
static int f;
static Display * mDisplay;
@@ -277,12 +275,14 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_
#endif
frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2;
- frame_mem=(char*)mmap( 0,frame_size*2,PROT_WRITE,MAP_SHARED,f,0 );
- frame0=frame_mem;
- frame1=frame_mem + frame_size;
- vid_data=frame0;
- next_frame=0;
- memset( frame_mem,0x80,frame_size * 2 );
+ frame_mem=(char*)mmap( 0,frame_size*4,PROT_WRITE,MAP_SHARED,f,0 );
+ frames[0] = frame_mem;
+ frames[1] = frame_mem + 1*frame_size;
+ frames[2] = frame_mem + 2*frame_size;
+ frames[3] = frame_mem + 3*frame_size;
+ mga_next_frame=0;
+ vid_data=frames[mga_next_frame];
+ memset( frame_mem,0x80,frame_size * 4 );
XFlush( mDisplay );
XSync( mDisplay,False );