diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/hwdec.h | 4 | ||||
-rw-r--r-- | video/out/hwdec/dmabuf_interop_wl.c | 3 | ||||
-rw-r--r-- | video/out/hwdec/hwdec_vaapi.c | 23 |
3 files changed, 25 insertions, 5 deletions
diff --git a/video/hwdec.h b/video/hwdec.h index 44008dece0..723c60f427 100644 --- a/video/hwdec.h +++ b/video/hwdec.h @@ -23,6 +23,10 @@ struct mp_hwdec_ctx { // This will be used for hardware conversion of frame formats. // NULL otherwise. const char *conversion_filter_name; + + // The libavutil hwconfig to be used when querying constraints for the + // conversion filter. Can be NULL if no special config is required. + void *conversion_config; }; // Used to communicate hardware decoder device handles from VO to video decoder. diff --git a/video/out/hwdec/dmabuf_interop_wl.c b/video/out/hwdec/dmabuf_interop_wl.c index 9f0d490228..606a0aa601 100644 --- a/video/out/hwdec/dmabuf_interop_wl.c +++ b/video/out/hwdec/dmabuf_interop_wl.c @@ -54,7 +54,8 @@ static bool map(struct ra_hwdec_mapper *mapper, return false; } - MP_VERBOSE(mapper, "Supported Wayland display format: '%s(%016lx)'\n", + MP_VERBOSE(mapper, "Supported Wayland display format %s: '%s(%016lx)'\n", + mp_imgfmt_to_name(mapper->src->params.hw_subfmt), mp_tag_str(drm_format), mapper_p->desc.objects[0].format_modifier); return true; diff --git a/video/out/hwdec/hwdec_vaapi.c b/video/out/hwdec/hwdec_vaapi.c index fafc331277..2eb458fa99 100644 --- a/video/out/hwdec/hwdec_vaapi.c +++ b/video/out/hwdec/hwdec_vaapi.c @@ -113,8 +113,14 @@ struct priv_owner { static void uninit(struct ra_hwdec *hw) { struct priv_owner *p = hw->priv; - if (p->ctx) + if (p->ctx) { hwdec_devices_remove(hw->devs, &p->ctx->hwctx); + if (p->ctx->hwctx.conversion_config) { + AVVAAPIHWConfig *hwconfig = p->ctx->hwctx.conversion_config; + vaDestroyConfig(p->ctx->display, hwconfig->config_id); + av_freep(&p->ctx->hwctx.conversion_config); + } + } va_destroy(p->ctx); } @@ -131,11 +137,10 @@ const static dmabuf_interop_init interop_inits[] = { NULL }; -const static char *conversion_filter_name = "scale_vaapi"; - static int init(struct ra_hwdec *hw) { struct priv_owner *p = hw->priv; + VAStatus vas; for (int i = 0; interop_inits[i]; i++) { if (interop_inits[i](hw, &p->dmabuf_interop)) { @@ -173,13 +178,23 @@ static int init(struct ra_hwdec *hw) return -1; } + VAConfigID config_id; + AVVAAPIHWConfig *hwconfig = NULL; + vas = vaCreateConfig(p->display, VAProfileNone, VAEntrypointVideoProc, NULL, + 0, &config_id); + if (vas == VA_STATUS_SUCCESS) { + hwconfig = av_hwdevice_hwconfig_alloc(p->ctx->av_device_ref); + hwconfig->config_id = config_id; + } + // it's now safe to set the display resource ra_add_native_resource(hw->ra_ctx->ra, "VADisplay", p->display); p->ctx->hwctx.hw_imgfmt = IMGFMT_VAAPI; p->ctx->hwctx.supported_formats = p->formats; p->ctx->hwctx.driver_name = hw->driver->name; - p->ctx->hwctx.conversion_filter_name = conversion_filter_name; + p->ctx->hwctx.conversion_filter_name = "scale_vaapi"; + p->ctx->hwctx.conversion_config = hwconfig; hwdec_devices_add(hw->devs, &p->ctx->hwctx); return 0; } |