changeset 26677:e3ae3a37ea8a

Add ati-hack suboption that aligns the lines to 32/64 bytes for PBO transfers to avoid what is probably a bug in the driver.
author reimar
date Sat, 10 May 2008 11:48:17 +0000
parents 84d1a6f19490
children 174c031a5df0
files libvo/vo_gl.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Fri May 09 17:51:44 2008 +0000
+++ b/libvo/vo_gl.c	Sat May 10 11:48:17 2008 +0000
@@ -80,6 +80,7 @@
 static uint32_t image_height;
 static uint32_t image_format;
 static int many_fmts;
+static int ati_hack;
 static int use_glFinish;
 static int swap_interval;
 static GLenum gl_target;
@@ -672,6 +673,8 @@
   if (!gl_buffer)
     GenBuffers(1, &gl_buffer);
   BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer);
+  if (ati_hack)
+    mpi->width = (mpi->width + 63) & ~63;
   mpi->stride[0] = mpi->width * mpi->bpp / 8;
   if (mpi->stride[0] * mpi->height > gl_buffersize) {
     BufferData(GL_PIXEL_UNPACK_BUFFER, mpi->stride[0] * mpi->height,
@@ -789,6 +792,7 @@
   {"yuv",          OPT_ARG_INT,  &use_yuv,      (opt_test_f)int_non_neg},
   {"lscale",       OPT_ARG_INT,  &lscale,       (opt_test_f)int_non_neg},
   {"cscale",       OPT_ARG_INT,  &cscale,       (opt_test_f)int_non_neg},
+  {"ati-hack",     OPT_ARG_BOOL, &ati_hack,     NULL},
   {"glfinish",     OPT_ARG_BOOL, &use_glFinish, NULL},
   {"swapinterval", OPT_ARG_INT,  &swap_interval,NULL},
   {"customprog",   OPT_ARG_MSTRZ,&custom_prog,  NULL},
@@ -811,6 +815,7 @@
     cscale = 0;
     use_rectangle = 0;
     use_glFinish = 0;
+    ati_hack = 0;
     swap_interval = 1;
     slice_height = 0;
     custom_prog = NULL;
@@ -835,6 +840,8 @@
               "    0: use power-of-two textures\n"
               "    1: use texture_rectangle\n"
               "    2: use texture_non_power_of_two\n"
+              "  ati-hack\n"
+              "    Workaround ATI bug with PBOs\n"
               "  glfinish\n"
               "    Call glFinish() before swapping buffers\n"
               "  swapinterval=<n>\n"