summaryrefslogtreecommitdiffstats
path: root/video/out/vo_vaapi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-05-09 19:42:03 +0200
committerwm4 <wm4@nowhere>2016-05-09 20:03:22 +0200
commit46fff8d31af0b79fe3de4aaee93bb66c248118a0 (patch)
treeefe5b04a4e9daf89195a4c758fe93ace9bee385f /video/out/vo_vaapi.c
parentee4c00698f7e4b04579494f262e668840c2668b3 (diff)
downloadmpv-46fff8d31af0b79fe3de4aaee93bb66c248118a0.tar.bz2
mpv-46fff8d31af0b79fe3de4aaee93bb66c248118a0.tar.xz
video: refactor how VO exports hwdec device handles
The main change is with video/hwdec.h. mp_hwdec_info is made opaque (and renamed to mp_hwdec_devices). Its accessors are mainly thread-safe (or documented where not), which makes the whole thing saner and cleaner. In particular, thread-safety rules become less subtle and more obvious. The new internal API makes it easier to support multiple OpenGL interop backends. (Although this is not done yet, and it's not clear whether it ever will.) This also removes all the API-specific fields from mp_hwdec_ctx and replaces them with a "ctx" field. For d3d in particular, we drop the mp_d3d_ctx struct completely, and pass the interfaces directly. Remove the emulation checks from vaapi.c and vdpau.c; they are pointless, and the checks that matter are done on the VO layer. The d3d hardware decoders might slightly change behavior: dxva2-copy will not use the VO device anymore if the VO supports proper interop. This pretty much assumes that any in such cases the VO will not use any form of exclusive mode, which makes using the VO device in copy mode unnecessary. This is a big refactor. Some things may be untested and could be broken.
Diffstat (limited to 'video/out/vo_vaapi.c')
-rw-r--r--video/out/vo_vaapi.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c
index 5275d4d28d..dc8aaacf9e 100644
--- a/video/out/vo_vaapi.c
+++ b/video/out/vo_vaapi.c
@@ -68,7 +68,6 @@ struct priv {
struct vo *vo;
VADisplay display;
struct mp_vaapi_ctx *mpvaapi;
- struct mp_hwdec_info hwdec_info;
struct mp_image_params image_params;
struct mp_rect src_rect;
@@ -515,11 +514,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
struct priv *p = vo->priv;
switch (request) {
- case VOCTRL_GET_HWDEC_INFO: {
- struct mp_hwdec_info **arg = data;
- *arg = &p->hwdec_info;
- return true;
- }
case VOCTRL_SET_EQUALIZER: {
struct voctrl_set_equalizer_args *eq = data;
return set_equalizer(p, eq->name, eq->value);
@@ -561,6 +555,11 @@ static void uninit(struct vo *vo)
free_subpicture(p, &part->image);
}
+ if (vo->hwdec_devs) {
+ hwdec_devices_remove(vo->hwdec_devs, &p->mpvaapi->hwctx);
+ hwdec_devices_destroy(vo->hwdec_devs);
+ }
+
va_destroy(p->mpvaapi);
vo_x11_uninit(vo);
@@ -591,8 +590,6 @@ static int preinit(struct vo *vo)
goto fail;
}
- p->hwdec_info.hwctx = &p->mpvaapi->hwctx;
-
if (va_guess_if_emulated(p->mpvaapi)) {
MP_WARN(vo, "VA-API is most likely emulated via VDPAU.\n"
"It's better to use VDPAU directly with: --vo=vdpau\n");
@@ -645,6 +642,10 @@ static int preinit(struct vo *vo)
p->va_num_display_attrs = 0;
p->mp_display_attr = talloc_zero_array(vo, int, p->va_num_display_attrs);
}
+
+ vo->hwdec_devs = hwdec_devices_create();
+ hwdec_devices_add(vo->hwdec_devs, &p->mpvaapi->hwctx);
+
return 0;
fail: