changeset 4894:abe1a2edb422

use 4 buffers, fallback to fewer buffers if the video ram isnt large enough
author michael
date Thu, 28 Feb 2002 16:20:58 +0000
parents 904cc3813582
children e0f8928a4f6b
files vidix/drivers/mach64_vid.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/vidix/drivers/mach64_vid.c	Thu Feb 28 13:50:09 2002 +0000
+++ b/vidix/drivers/mach64_vid.c	Thu Feb 28 16:20:58 2002 +0000
@@ -843,12 +843,18 @@
 int vixConfigPlayback(vidix_playback_t *info)
 {
   if(!is_supported_fourcc(info->fourcc)) return ENOSYS;
-  if(info->num_frames>3) info->num_frames=3; //more than 3 make no sense at the moment but they do work
 
   mach64_compute_framesize(info);
-  mach64_overlay_offset = mach64_ram_size - info->frame_size*info->num_frames;
-  mach64_overlay_offset &= 0xffff0000;
-  if(mach64_overlay_offset < 0) return EINVAL;
+
+  if(info->num_frames>4) info->num_frames=4;
+  for(;info->num_frames>0; info->num_frames--)
+  {
+      mach64_overlay_offset = mach64_ram_size - info->frame_size*info->num_frames;
+      mach64_overlay_offset &= 0xffff0000;
+      if(mach64_overlay_offset>0) break;
+  }
+  if(info->num_frames <= 0) return EINVAL;
+
   info->dga_addr = (char *)mach64_mem_base + mach64_overlay_offset;
   mach64_vid_init_video(info);
   return 0;