summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-01-17 11:49:55 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-01-18 00:25:00 -0800
commit342e36ea1152ab82863522c486004f38131e88aa (patch)
tree46b433a7d5366b64abf61bf888c06d8f0110cb84
parent07753bbb4a02aa7bf480dcf772f9f71bd84c9300 (diff)
downloadmpv-342e36ea1152ab82863522c486004f38131e88aa.tar.bz2
mpv-342e36ea1152ab82863522c486004f38131e88aa.tar.xz
vo_gpu: skip DR for unsupported image formats
DR (direct rendering) works by having the decoder decode into the GPU staging buffers, instead of copying the video data on texture upload. We did this even for formats unsupported by the GPU or the renderer. This "worked" because the staging memory is untyped, and the video frame was converted by libswscale to a supported format, and then uploaded with a copy using the normal non-DR texture upload path. Even though it "works", we don't gain anything from using the staging buffers for decoding, since we can't use them for upload anyway. Also, staging memory might be potentially limited (what really happens is up to the driver). It's easy to avoid, so just skip it in these cases.
-rw-r--r--video/out/gpu/video.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 96afd56564..6e7b3ddf2b 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -3849,6 +3849,9 @@ static void gl_video_dr_free_buffer(void *opaque, uint8_t *data)
struct mp_image *gl_video_get_image(struct gl_video *p, int imgfmt, int w, int h,
int stride_align)
{
+ if (!gl_video_check_format(p, imgfmt))
+ return NULL;
+
int size = mp_image_get_alloc_size(imgfmt, w, h, stride_align);
if (size < 0)
return NULL;