From 07c546b2b494a620edc98dadd5dd78a052ec6783 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 16 Nov 2015 16:15:07 +0100 Subject: vo_opengl: fix backend autoprobing We want the following behavior: - VO probed, backend probed: only accept non-sw, fail completely otherwise - VO forced, backend probed: use the first non-sw, or if none is found, fall back to the first working sw backend - VO probed, backend forced: (I don't care about this case) - VO forced, backend forced: just use that backend Also, on backend probe failure the vo->probed field was left in its old state. --- video/out/opengl/common.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'video') diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c index e0e3d498ca..3ac01268d5 100644 --- a/video/out/opengl/common.c +++ b/video/out/opengl/common.c @@ -597,6 +597,7 @@ static MPGLContext *init_backend(struct vo *vo, const struct mpgl_driver *driver MP_VERBOSE(vo, "Initializing OpenGL backend '%s'\n", ctx->driver->name); ctx->priv = talloc_zero_size(ctx, ctx->driver->priv_size); if (ctx->driver->init(ctx, vo_flags) < 0) { + vo->probing = old_probing; talloc_free(ctx); return NULL; } @@ -639,6 +640,14 @@ MPGLContext *mpgl_init(struct vo *vo, const char *backend_name, int vo_flags) if (ctx) break; } + // VO forced, but no backend is ok => force the first that works at all + if (!ctx && !vo->probing) { + for (int n = 0; n < MP_ARRAY_SIZE(backends); n++) { + ctx = init_backend(vo, backends[n], false, vo_flags); + if (ctx) + break; + } + } } else if (index >= 0) { ctx = init_backend(vo, backends[index], false, vo_flags); } -- cgit v1.2.3