summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-11-10 10:06:33 +0100
committerwm4 <wm4@nowhere>2017-11-10 10:06:33 +0100
commit4a6b04bdb9305642bda5cf5695d0e303a002b132 (patch)
treeb7ea4dc06e1207156ce464a631125c83552cc2fa
parented1af997270fa10722e6a0f8f07f0ffb61bd3e09 (diff)
downloadmpv-4a6b04bdb9305642bda5cf5695d0e303a002b132.tar.bz2
mpv-4a6b04bdb9305642bda5cf5695d0e303a002b132.tar.xz
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.
-rw-r--r--video/out/gpu/video.c9
1 files 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;