summaryrefslogtreecommitdiffstats
path: root/video/hwdec.h
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2022-02-06 14:18:59 -0800
committerPhilip Langdale <github.philipl@overt.org>2022-02-17 20:02:32 -0800
commit5186651f304fb49867f2542d2eb149f8191cf0de (patch)
treec04acfdbf374bb4142c0c564a73aecd98082c977 /video/hwdec.h
parentbc9805c71a67b2717c79533731608eff679cded1 (diff)
downloadmpv-5186651f304fb49867f2542d2eb149f8191cf0de.tar.bz2
mpv-5186651f304fb49867f2542d2eb149f8191cf0de.tar.xz
vo_gpu: hwdec: load hwdec interops on-demand by default
Historically, we have treated hwdec interop loading as a completely separate step from loading the hwdecs themselves. Some hwdecs need an interop, and some don't, and users generally configure the exact hwdec they want, so interops that aren't relevant for that hwdec shouldn't be loaded to save time and avoid warning/error spam. The basic approach here is to recognise that interops are tied to hwdecs by imgfmt. The hwdec outputs some format, and an interop is needed to get that format to the vo without read back. So, when we try to load an hwdec, instead of just blindly loading all interops as we do today, let's pass the imgfmt in and only load interops that work for that format. If more than one interop is available for the format, the existing logic (whatever it is) will continue to be used to pick one. We also have one callsite in filters where we seem to pre-emptively load all the interops. It's probably possible to trace down a specific format but for now I'm just letting it keep loading all of them; it's no worse than before. You may notice there is no documentation update - and that's because the current docs say that when the interop mode is `auto`, the interop is loaded on demand. So reality now reflects the docs. How nice.
Diffstat (limited to 'video/hwdec.h')
-rw-r--r--video/hwdec.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/video/hwdec.h b/video/hwdec.h
index b2ca8ca894..a57010d33f 100644
--- a/video/hwdec.h
+++ b/video/hwdec.h
@@ -55,11 +55,12 @@ void hwdec_devices_remove(struct mp_hwdec_devices *devs, struct mp_hwdec_ctx *ct
// 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), void *load_api_ctx);
+ void (*load_api)(void *ctx, int imgfmt), void *load_api_ctx);
-// 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);
+// Cause VO to lazily load all devices for a specified img format, and will
+// block until this is done (even if not available). Pass IMGFMT_NONE to load
+// all available devices.
+void hwdec_devices_request_for_img_fmt(struct mp_hwdec_devices *devs, int imgfmt);
// Return "," concatenated list (for introspection/debugging). Use talloc_free().
char *hwdec_devices_get_names(struct mp_hwdec_devices *devs);