summaryrefslogtreecommitdiffstats
path: root/video/out/vo_gpu.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-01 05:05:00 +0100
committerwm4 <wm4@nowhere>2017-12-01 05:57:01 +0100
commit91586c35924ff8bd54eab549e7326d6cf2868b46 (patch)
treeb76152da6a15dd1afcb8d7db396d47195d5b6427 /video/out/vo_gpu.c
parent2cf58362932be56645b16942ef3985eb2d0af65f (diff)
downloadmpv-91586c35924ff8bd54eab549e7326d6cf2868b46.tar.bz2
mpv-91586c35924ff8bd54eab549e7326d6cf2868b46.tar.xz
vo_gpu: make it possible to load multiple hwdec interop drivers
Make the VO<->decoder interface capable of supporting multiple hwdec APIs at once. The main gain is that this simplifies autoprobing a lot. Before this change, it could happen that the VO loaded the "wrong" hwdec API, and the decoder was stuck with the choice (breaking hw decoding). With the change applied, the VO simply loads all available APIs, so autoprobing trickery is left entirely to the decoder. In the past, we were quite careful about not accidentally loading the wrong interop drivers. This was in part to make sure autoprobing works, but also because libva had this obnoxious bug of dumping garbage to stderr when using the API. libva was fixed, so this is not a problem anymore. The --opengl-hwdec-interop option is changed in various ways (again...), and renamed to --gpu-hwdec-interop. It does not have much use anymore, other than debugging. It's notable that the order in the hwdec interop array ra_hwdec_drivers[] still matters if multiple drivers support the same image formats, so the option can explicitly force one, if that should ever be necessary, or more likely, for debugging. One example are the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both support d3d11 input. vo_gpu now always loads the interop lazily by default, but when it does, it loads them all. vo_opengl_cb now always loads them when the GL context handle is initialized. I don't expect that this causes any problems. It's now possible to do things like changing between vdpau and nvdec decoding at runtime. This is also preparation for cleaning up vd_lavc.c hwdec autoprobing. It's another reason why hwdec_devices_request_all() does not take a hwdec type anymore.
Diffstat (limited to 'video/out/vo_gpu.c')
-rw-r--r--video/out/vo_gpu.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/video/out/vo_gpu.c b/video/out/vo_gpu.c
index d739cf6bfa..6a971dd94b 100644
--- a/video/out/vo_gpu.c
+++ b/video/out/vo_gpu.c
@@ -50,7 +50,6 @@ struct gpu_priv {
char *context_type;
struct ra_ctx_opts opts;
struct gl_video *renderer;
- struct ra_hwdec *hwdec;
int events;
};
@@ -120,23 +119,18 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
return 0;
}
-static void request_hwdec_api(struct vo *vo, void *api)
+static void request_hwdec_api(struct vo *vo)
{
struct gpu_priv *p = vo->priv;
- if (p->hwdec)
- return;
-
- p->hwdec = ra_hwdec_load_api(vo->log, p->ctx->ra, vo->global,
- vo->hwdec_devs, (intptr_t)api);
- gl_video_set_hwdec(p->renderer, p->hwdec);
+ gl_video_load_hwdecs_all(p->renderer, vo->hwdec_devs);
}
-static void call_request_hwdec_api(void *ctx, enum hwdec_type type)
+static void call_request_hwdec_api(void *ctx)
{
// Roundabout way to run hwdec loading on the VO thread.
// Redirects to request_hwdec_api().
- vo_control(ctx, VOCTRL_LOAD_HWDEC_API, (void *)(intptr_t)type);
+ vo_control(ctx, VOCTRL_LOAD_HWDEC_API, NULL);
}
static void get_and_update_icc_profile(struct gpu_priv *p)
@@ -195,7 +189,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
return true;
}
case VOCTRL_LOAD_HWDEC_API:
- request_hwdec_api(vo, data);
+ request_hwdec_api(vo);
return true;
case VOCTRL_UPDATE_RENDER_OPTS: {
gl_video_configure_queue(p->renderer, vo);
@@ -266,7 +260,6 @@ static void uninit(struct vo *vo)
struct gpu_priv *p = vo->priv;
gl_video_uninit(p->renderer);
- ra_hwdec_uninit(p->hwdec);
if (vo->hwdec_devs) {
hwdec_devices_set_loader(vo->hwdec_devs, NULL, NULL);
hwdec_devices_destroy(vo->hwdec_devs);
@@ -298,12 +291,9 @@ static int preinit(struct vo *vo)
get_and_update_icc_profile(p);
vo->hwdec_devs = hwdec_devices_create();
-
hwdec_devices_set_loader(vo->hwdec_devs, call_request_hwdec_api, vo);
- p->hwdec = ra_hwdec_load(vo->log, p->ctx->ra, vo->global,
- vo->hwdec_devs, vo->opts->gl_hwdec_interop);
- gl_video_set_hwdec(p->renderer, p->hwdec);
+ gl_video_load_hwdecs(p->renderer, vo->hwdec_devs, false);
return 0;