diff options
author | Aaron Boxer <boxerab@protonmail.com> | 2022-09-27 12:12:54 -0400 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2022-10-26 18:41:47 +0000 |
commit | 7358b9d37126e824cbc3a226d832e9cc1d7b01ea (patch) | |
tree | c477ad6f03145563f31e9877e583a9a50c4c6946 /video/out/wldmabuf | |
parent | 964692ad4cec90888bb437064c53d8844db9f590 (diff) | |
download | mpv-7358b9d37126e824cbc3a226d832e9cc1d7b01ea.tar.bz2 mpv-7358b9d37126e824cbc3a226d832e9cc1d7b01ea.tar.xz |
vo_dmabuf_wayland: wayland VO displaying dmabuf buffers
Wayland VO that can display images from either vaapi or drm hwdec
The PR adds the following changes:
1. a context_wldmabuf context with no gl dependencies
2. no-op ra_wldmabuf and dmabuf_interop_wldmabuf objects
no-op because there is no need to map/unmap the drmprime buffer,
and there is no need to manage any textures.
Tested on both x86_64 and rk3399 AArch64
Diffstat (limited to 'video/out/wldmabuf')
-rw-r--r-- | video/out/wldmabuf/context_wldmabuf.c | 44 | ||||
-rw-r--r-- | video/out/wldmabuf/ra_wldmabuf.c | 44 | ||||
-rw-r--r-- | video/out/wldmabuf/ra_wldmabuf.h | 22 |
3 files changed, 110 insertions, 0 deletions
diff --git a/video/out/wldmabuf/context_wldmabuf.c b/video/out/wldmabuf/context_wldmabuf.c new file mode 100644 index 0000000000..a22cb2bf44 --- /dev/null +++ b/video/out/wldmabuf/context_wldmabuf.c @@ -0,0 +1,44 @@ +/* + * This file is part of mpv video player. + * + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * mpv is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "video/out/wayland_common.h" +#include "video/out/opengl/context.h" +#include "ra_wldmabuf.h" + +static void uninit(struct ra_ctx *ctx) +{ + ra_free(&ctx->ra); + vo_wayland_uninit(ctx->vo); +} + +static bool init(struct ra_ctx *ctx) +{ + if (!vo_wayland_init(ctx->vo)) { + vo_wayland_uninit(ctx->vo); + return false; + } + ctx->ra = ra_create_wayland(ctx->log, ctx->vo->wl->display); + + return true; +} + +const struct ra_ctx_fns ra_ctx_wldmabuf = { + .type = "none", + .name = "wldmabuf", + .init = init, + .uninit = uninit, +}; diff --git a/video/out/wldmabuf/ra_wldmabuf.c b/video/out/wldmabuf/ra_wldmabuf.c new file mode 100644 index 0000000000..8b59bd4a07 --- /dev/null +++ b/video/out/wldmabuf/ra_wldmabuf.c @@ -0,0 +1,44 @@ +/* + * This file is part of mpv. + * + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * mpv is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "video/out/wayland_common.h" +#include "video/out/gpu/ra.h" +#include "ra_wldmabuf.h" + +static void destroy(struct ra *ra) +{ +} + +static struct ra_fns ra_fns_wldmabuf = { + .destroy = destroy, +}; + +struct ra *ra_create_wayland(struct mp_log *log, struct wl_display *display) +{ + struct ra *ra = talloc_zero(NULL, struct ra); + + ra->fns = &ra_fns_wldmabuf; + ra->log = log; + ra_add_native_resource(ra, "wl", display); + + return ra; +} + +bool ra_is_wldmabuf(struct ra *ra) +{ + return (ra->fns == &ra_fns_wldmabuf); +} diff --git a/video/out/wldmabuf/ra_wldmabuf.h b/video/out/wldmabuf/ra_wldmabuf.h new file mode 100644 index 0000000000..231b4c3ce8 --- /dev/null +++ b/video/out/wldmabuf/ra_wldmabuf.h @@ -0,0 +1,22 @@ +/* + * This file is part of mpv. + * + * mpv is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * mpv is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with mpv. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once +#include "video/out/wayland_common.h" + +struct ra *ra_create_wayland(struct mp_log *log, struct wl_display *display); +bool ra_is_wldmabuf(struct ra *ra); |