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.
This commit is contained in:
wm4
2015-11-16 16:15:07 +01:00
parent bf0b178e71
commit 07c546b2b4
+9
View File
@@ -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);
}