summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/hwdec_dxva2egl.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/hwdec_dxva2egl.c')
-rw-r--r--video/out/opengl/hwdec_dxva2egl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/video/out/opengl/hwdec_dxva2egl.c b/video/out/opengl/hwdec_dxva2egl.c
index 0f8a4adbb1..979ef59745 100644
--- a/video/out/opengl/hwdec_dxva2egl.c
+++ b/video/out/opengl/hwdec_dxva2egl.c
@@ -73,7 +73,7 @@ static int init(struct ra_hwdec *hw)
struct priv_owner *p = hw->priv;
HRESULT hr;
- if (!ra_is_gl(hw->ra))
+ if (!ra_is_gl(hw->ra_ctx->ra))
return -1;
if (!angle_load())
return -1;
@@ -88,8 +88,7 @@ static int init(struct ra_hwdec *hw)
return -1;
const char *exts = eglQueryString(egl_display, EGL_EXTENSIONS);
- if (!exts ||
- !strstr(exts, "EGL_ANGLE_d3d_share_handle_client_buffer")) {
+ if (!gl_check_extension(exts, "EGL_ANGLE_d3d_share_handle_client_buffer")) {
return -1;
}
@@ -182,7 +181,14 @@ static int init(struct ra_hwdec *hw)
p->hwctx = (struct mp_hwdec_ctx){
.driver_name = hw->driver->name,
.av_device_ref = d3d9_wrap_device_ref((IDirect3DDevice9 *)p->device9ex),
+ .hw_imgfmt = IMGFMT_DXVA2,
};
+
+ if (!p->hwctx.av_device_ref) {
+ MP_VERBOSE(hw, "Failed to create hwdevice_ctx\n");
+ goto fail;
+ }
+
hwdec_devices_add(hw->devs, &p->hwctx);
return 0;
@@ -337,7 +343,7 @@ static int mapper_map(struct ra_hwdec_mapper *mapper)
// of the above StretchRect. Timeout of 8ms is required to reliably
// render 4k on Intel Haswell, Ivybridge and Cherry Trail Atom.
const int max_retries = 8;
- const int64_t wait_us = 1000;
+ const int64_t wait_ns = MP_TIME_MS_TO_NS(1);
int retries = 0;
while (true) {
hr = IDirect3DQuery9_GetData(p->query9, NULL, 0, D3DGETDATA_FLUSH);
@@ -347,10 +353,10 @@ static int mapper_map(struct ra_hwdec_mapper *mapper)
} else if (hr == S_FALSE) {
if (++retries > max_retries) {
MP_VERBOSE(mapper, "Failed to flush frame after %lld ms\n",
- (long long)(wait_us * max_retries) / 1000);
+ (long long)MP_TIME_MS_TO_NS(wait_ns * max_retries));
break;
}
- mp_sleep_us(wait_us);
+ mp_sleep_ns(wait_ns);
} else {
break;
}