[MPlayer-cvslog] r34898 - trunk/libvo/vo_gl.c

reimar subversion at mplayerhq.hu
Mon May 14 21:32:00 CEST 2012


Author: reimar
Date: Mon May 14 21:31:59 2012
New Revision: 34898

Log:
Align glMapBuffer result.
Mesa for some silly reason returns a pointer that is only
8 byte aligned.
Fixes -dr and force-pbo crashes (on e.g. x86) and bad output
(on e.g. PPC).

Modified:
   trunk/libvo/vo_gl.c

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	Mon May 14 20:11:24 2012	(r34897)
+++ trunk/libvo/vo_gl.c	Mon May 14 21:31:59 2012	(r34898)
@@ -929,7 +929,7 @@ static uint32_t get_image(mp_image_t *mp
     mpi->height = texture_height;
   }
   mpi->stride[0] = mpi->width * mpi->bpp / 8;
-  needed_size = mpi->stride[0] * mpi->height;
+  needed_size = mpi->stride[0] * mpi->height + 31;
   if (mesa_buffer) {
 #ifdef CONFIG_GL_X11
     if (mesa_bufferptr && needed_size > mesa_buffersize) {
@@ -952,7 +952,8 @@ static uint32_t get_image(mp_image_t *mp
     }
     if (!gl_bufferptr)
       gl_bufferptr = mpglMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
-    mpi->planes[0] = gl_bufferptr;
+    mpi->priv = gl_bufferptr;
+    mpi->planes[0] = (uint8_t *)gl_bufferptr + (-(intptr_t)gl_bufferptr & 31);
     mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
   }
   if (!mpi->planes[0]) {
@@ -1052,7 +1053,7 @@ static uint32_t draw_image(mp_image_t *m
       mpglPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, 1);
       w = texture_width;
     } else {
-      intptr_t base = (intptr_t)planes[0];
+      intptr_t base = (intptr_t)mpi->priv;
       if (ati_hack) { w = texture_width; h = texture_height; }
       if (mpi_flipped)
         base += (mpi->h - 1) * stride[0];


More information about the MPlayer-cvslog mailing list