diff options
author | wm4 <wm4@nowhere> | 2017-12-01 05:05:00 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-12-01 05:57:01 +0100 |
commit | 91586c35924ff8bd54eab549e7326d6cf2868b46 (patch) | |
tree | b76152da6a15dd1afcb8d7db396d47195d5b6427 /video/hwdec.h | |
parent | 2cf58362932be56645b16942ef3985eb2d0af65f (diff) | |
download | mpv-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/hwdec.h')
-rw-r--r-- | video/hwdec.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/video/hwdec.h b/video/hwdec.h index 2b89c3247c..3a551ef6f7 100644 --- a/video/hwdec.h +++ b/video/hwdec.h @@ -87,18 +87,18 @@ struct mp_hwdec_ctx *hwdec_devices_get_first(struct mp_hwdec_devices *devs); void hwdec_devices_add(struct mp_hwdec_devices *devs, struct mp_hwdec_ctx *ctx); // Remove this from the list of internal devices. Idempotent/ignores entries -// not added yet. +// not added yet. This is not thread-safe. void hwdec_devices_remove(struct mp_hwdec_devices *devs, struct mp_hwdec_ctx *ctx); // Can be used to enable lazy loading of an API with hwdec_devices_request(). // If used at all, this must be set/unset during initialization/uninitialization, // as concurrent use with hwdec_devices_request() is a race condition. void hwdec_devices_set_loader(struct mp_hwdec_devices *devs, - void (*load_api)(void *ctx, enum hwdec_type type), void *load_api_ctx); + void (*load_api)(void *ctx), void *load_api_ctx); -// Cause VO to lazily load the requested device, and will block until this is -// done (even if not available). -void hwdec_devices_request(struct mp_hwdec_devices *devs, enum hwdec_type type); +// Cause VO to lazily load all devices, and will block until this is done (even +// if not available). +void hwdec_devices_request_all(struct mp_hwdec_devices *devs); // Convenience function: // - return NULL if devs==NULL @@ -107,6 +107,9 @@ void hwdec_devices_request(struct mp_hwdec_devices *devs, enum hwdec_type type); // - then return the mp_hwdec_ctx.ctx field void *hwdec_devices_load(struct mp_hwdec_devices *devs, enum hwdec_type type); +// Return "," concatenated list (for introspection/debugging). Use talloc_free(). +char *hwdec_devices_get_names(struct mp_hwdec_devices *devs); + struct mp_image; // Per AV_HWDEVICE_TYPE_* functions, queryable via hwdec_get_hwcontext_fns(). |