summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-02 12:44:46 +0200
committerwm4 <wm4@nowhere>2015-09-02 13:17:23 +0200
commit8ffbb22c270aeef063755fc9b00c4d272959d930 (patch)
tree543a6c3b199aaef091e023ce9fde187c61da9ca0
parent42411203639c4c570be1b7dee3778cca27ff4832 (diff)
downloadmpv-8ffbb22c270aeef063755fc9b00c4d272959d930.tar.bz2
mpv-8ffbb22c270aeef063755fc9b00c4d272959d930.tar.xz
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.)
-rw-r--r--video/out/gl_video.c8
1 files 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;