summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl_cb.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vo_opengl_cb.c')
-rw-r--r--video/out/vo_opengl_cb.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/video/out/vo_opengl_cb.c b/video/out/vo_opengl_cb.c
index 40930fbcae..4ac0c96b1e 100644
--- a/video/out/vo_opengl_cb.c
+++ b/video/out/vo_opengl_cb.c
@@ -89,13 +89,16 @@ struct mpv_opengl_cb_context {
struct vo *active;
int hwdec_api;
+ // --- This is only mutable while initialized=false, during which nothing
+ // except the OpenGL context manager is allowed to access it.
+ struct mp_hwdec_devices *hwdec_devs;
+
// --- All of these can only be accessed from the thread where the host
// application's OpenGL context is current - i.e. only while the
// host application is calling certain mpv_opengl_cb_* APIs.
GL *gl;
struct gl_video *renderer;
struct gl_hwdec *hwdec;
- struct mp_hwdec_info hwdec_info; // it's also semi-immutable after init
};
static void update(struct vo_priv *p);
@@ -176,15 +179,14 @@ int mpv_opengl_cb_init_gl(struct mpv_opengl_cb_context *ctx, const char *exts,
mpgl_load_functions2(ctx->gl, get_proc_address, get_proc_address_ctx,
exts, ctx->log);
- ctx->renderer = gl_video_init(ctx->gl, ctx->log, ctx->global, NULL);
+ ctx->renderer = gl_video_init(ctx->gl, ctx->log, ctx->global);
if (!ctx->renderer)
return MPV_ERROR_UNSUPPORTED;
- ctx->hwdec = gl_hwdec_load_api_id(ctx->log, ctx->gl, ctx->global,
- ctx->hwdec_api);
+ ctx->hwdec_devs = hwdec_devices_create();
+ ctx->hwdec = gl_hwdec_load_api(ctx->log, ctx->gl, ctx->global,
+ ctx->hwdec_devs, ctx->hwdec_api);
gl_video_set_hwdec(ctx->renderer, ctx->hwdec);
- if (ctx->hwdec)
- ctx->hwdec_info.hwctx = ctx->hwdec->hwctx;
pthread_mutex_lock(&ctx->lock);
// We don't know the exact caps yet - use a known superset
@@ -222,6 +224,8 @@ int mpv_opengl_cb_uninit_gl(struct mpv_opengl_cb_context *ctx)
ctx->renderer = NULL;
gl_hwdec_uninit(ctx->hwdec);
ctx->hwdec = NULL;
+ hwdec_devices_destroy(ctx->hwdec_devs);
+ ctx->hwdec_devs = NULL;
talloc_free(ctx->gl);
ctx->gl = NULL;
talloc_free(ctx->new_opts_cfg);
@@ -274,6 +278,8 @@ int mpv_opengl_cb_draw(mpv_opengl_cb_context *ctx, int fbo, int vp_w, int vp_h)
ctx->gl->debug_context = opts->use_gl_debug;
gl_video_set_debug(ctx->renderer, opts->use_gl_debug);
}
+ if (gl_video_icc_auto_enabled(ctx->renderer))
+ MP_ERR(ctx, "icc-profile-auto is not available with opengl-cb\n");
}
ctx->reconfigured = false;
ctx->update_new_opts = false;
@@ -514,11 +520,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
char *arg = data;
return reparse_cmdline(p, arg);
}
- case VOCTRL_GET_HWDEC_INFO: {
- struct mp_hwdec_info **arg = data;
- *arg = p->ctx ? &p->ctx->hwdec_info : NULL;
- return true;
- }
}
return VO_NOTIMPL;
@@ -561,6 +562,8 @@ static int preinit(struct vo *vo)
p->ctx->eq_changed = true;
pthread_mutex_unlock(&p->ctx->lock);
+ vo->hwdec_devs = p->ctx->hwdec_devs;
+
return 0;
}