From 4a6b04bdb9305642bda5cf5695d0e303a002b132 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 10 Nov 2017 10:06:33 +0100 Subject: vo_gpu: never pass flipped images to ra or ra backends Seems like the last refactor to this code broke playing flipped images, at least with --opengl-pbo --gpu-api=opengl. Flipping is rather a shitmess. The main problem is that OpenGL does not support flipped uploading. The original vo_gl implementation considered it important to handle the flipped case efficiently, so instead of uploading the image line by line backwards, it uploaded it flipped, and then flipped it in the renderer (basically the upload path ignored the flipping). The ra code and backends probably have an insane and inconsistent mix of semantics, so fix this by never passing it flipped images in the first place. In the future, the backends should probably support flipped images directly. Fixes #5097. --- video/out/gpu/video.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 9cc889b401..4cdf20dfae 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -3262,8 +3262,6 @@ static bool pass_upload_image(struct gl_video *p, struct mp_image *mpi, uint64_t for (int n = 0; n < p->plane_count; n++) { struct texplane *plane = &vimg->planes[n]; - plane->flipped = mpi->stride[0] < 0; - struct ra_tex_upload_params params = { .tex = plane->tex, .src = mpi->planes[n], @@ -3271,6 +3269,13 @@ static bool pass_upload_image(struct gl_video *p, struct mp_image *mpi, uint64_t .stride = mpi->stride[n], }; + plane->flipped = params.stride < 0; + if (plane->flipped) { + int h = mp_image_plane_h(mpi, n); + params.src = (char *)params.src + (h - 1) * params.stride; + params.stride = -params.stride; + } + struct dr_buffer *mapped = gl_find_dr_buffer(p, mpi->planes[n]); if (mapped) { params.buf = mapped->buf; -- cgit v1.2.3