summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-07-12 16:04:56 -0500
committerDudemanguy <random342@airmail.cc>2023-07-12 16:59:59 -0500
commit7409f4a6c97c80e35dfc3055ec8cb9c29ab9b092 (patch)
tree141aa3f4089470199279c9e0294a29d455195041 /video/out
parentb57cf110c9c1bdea826455093ccc767be5739ce8 (diff)
downloadmpv-7409f4a6c97c80e35dfc3055ec8cb9c29ab9b092.tar.bz2
mpv-7409f4a6c97c80e35dfc3055ec8cb9c29ab9b092.tar.xz
vo_dmabuf_wayland: stop lazy loading hwdec
The implementation was copied from vo_gpu/vo_gpu_next but fundamentally it doesn't make sense for this VO. Hardware decoding is not optional in vo_dmabuf_wayland. We should be sure to request and load all supported formats in the preinit and fail if there are any problems. There should be no functional change from before, but it's more conceptually correct this way.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vo_dmabuf_wayland.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c
index e4c3bf3768..46fe3571a3 100644
--- a/video/out/vo_dmabuf_wayland.c
+++ b/video/out/vo_dmabuf_wayland.c
@@ -601,13 +601,6 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
return 0;
}
-static void call_request_hwdec_api(void *ctx, struct hwdec_imgfmt_request *params)
-{
- // Roundabout way to run hwdec loading on the VO thread.
- // Redirects to request_hwdec_api().
- vo_control(ctx, VOCTRL_LOAD_HWDEC_API, params);
-}
-
static int control(struct vo *vo, uint32_t request, void *data)
{
struct priv *p = vo->priv;
@@ -615,13 +608,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
int ret;
switch (request) {
- case VOCTRL_LOAD_HWDEC_API:
- assert(p->hwdec_ctx.ra_ctx);
- struct hwdec_imgfmt_request* req = (struct hwdec_imgfmt_request*)data;
- if (!is_supported_fmt(req->imgfmt))
- return 0;
- ra_hwdec_ctx_load_fmt(&p->hwdec_ctx, vo->hwdec_devs, req);
- return (p->hwdec_ctx.num_hwdecs > 0);
case VOCTRL_RESET:
p->destroy_buffers = true;
return VO_TRUE;
@@ -725,16 +711,25 @@ static int preinit(struct vo *vo)
wl_surface_attach(vo->wl->surface, p->solid_buffer, 0, 0);
vo->hwdec_devs = hwdec_devices_create();
- hwdec_devices_set_loader(vo->hwdec_devs, call_request_hwdec_api, vo);
- assert(!p->hwdec_ctx.ra_ctx);
p->hwdec_ctx = (struct ra_hwdec_ctx) {
.log = p->log,
.global = p->global,
.ra_ctx = p->ctx,
};
-
ra_hwdec_ctx_init(&p->hwdec_ctx, vo->hwdec_devs, NULL, true);
+ // Loop through hardware accelerated formats and only request known
+ // supported formats.
+ for (int i = IMGFMT_VDPAU_OUTPUT; i < IMGFMT_AVPIXFMT_START; ++i) {
+ if (is_supported_fmt(i)) {
+ struct hwdec_imgfmt_request params = {
+ .imgfmt = i,
+ .probing = false,
+ };
+ ra_hwdec_ctx_load_fmt(&p->hwdec_ctx, vo->hwdec_devs, &params);
+ }
+ }
+
for (int i = 0; i < p->hwdec_ctx.num_hwdecs; i++) {
struct ra_hwdec *hw = p->hwdec_ctx.hwdecs[i];
if (ra_get_native_resource(p->ctx->ra, "VADisplay")) {