From 8ffbb22c270aeef063755fc9b00c4d272959d930 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 2 Sep 2015 12:44:46 +0200 Subject: vo_opengl: simplify PBO copy Use mp_image_copy() instead of copying manually. (This function checks whether the destination is regarded writeable, which it is not, because the destination is the source image with changed pointers, so refcounting has to be removed from the destination image by resetting mpi->bufs.) --- video/out/gl_video.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/video/out/gl_video.c b/video/out/gl_video.c index e9610ed10b..eb6010e632 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -2283,6 +2283,7 @@ static bool map_image(struct gl_video *p, struct mp_image *mpi) mpi->planes[n] = plane->buffer_ptr; gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); } + memset(mpi->bufs, 0, sizeof(mpi->bufs)); return true; } @@ -2313,12 +2314,7 @@ static void gl_video_upload_image(struct gl_video *p, struct mp_image *mpi) mp_image_t mpi2 = *mpi; bool pbo = false; if (!vimg->planes[0].buffer_ptr && map_image(p, &mpi2)) { - for (int n = 0; n < p->plane_count; n++) { - int line_bytes = mp_image_plane_w(mpi, n) * p->image_desc.bytes[n]; - int plane_h = mp_image_plane_h(mpi, n); - memcpy_pic(mpi2.planes[n], mpi->planes[n], line_bytes, plane_h, - mpi2.stride[n], mpi->stride[n]); - } + mp_image_copy(&mpi2, mpi); pbo = true; } vimg->image_flipped = mpi2.stride[0] < 0; -- cgit v1.2.3