Skip to content

Commit

Permalink
vo_opengl: fix backend autoprobing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wm4 committed Nov 16, 2015
1 parent bf0b178 commit 07c546b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions video/out/opengl/common.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 07c546b

Please sign in to comment.