summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2022-03-12 10:54:23 -0800
committerPhilip Langdale <github.philipl@overt.org>2023-05-28 15:46:05 -0700
commit085f3e31a091daf7d6649508b162cfcde826702a (patch)
tree50eb9dc75c2c9071cad2b0e77baba4e97f1cb911 /video/out
parent959ef843d2752e802874b265b21ee6542388a019 (diff)
downloadmpv-085f3e31a091daf7d6649508b162cfcde826702a.tar.bz2
mpv-085f3e31a091daf7d6649508b162cfcde826702a.tar.xz
vo: hwdec: Pass the ra_ctx to hwdecs instead of just the ra
We will need the full ra_ctx to be able to look up all the state required to initialise an ffmpeg vulkan hwcontext, so pass let's pass the ra_ctx instead of just the ra.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/d3d11/hwdec_d3d11va.c4
-rw-r--r--video/out/d3d11/hwdec_dxva2dxgi.c4
-rw-r--r--video/out/gpu/hwdec.c11
-rw-r--r--video/out/gpu/hwdec.h8
-rw-r--r--video/out/gpu/libmpv_gpu.c6
-rw-r--r--video/out/gpu/libmpv_gpu.h2
-rw-r--r--video/out/gpu/video.c9
-rw-r--r--video/out/gpu/video.h3
-rw-r--r--video/out/hwdec/dmabuf_interop_gl.c4
-rw-r--r--video/out/hwdec/dmabuf_interop_pl.c2
-rw-r--r--video/out/hwdec/dmabuf_interop_wl.c2
-rw-r--r--video/out/hwdec/hwdec_aimagereader.c2
-rw-r--r--video/out/hwdec/hwdec_cuda_gl.c4
-rw-r--r--video/out/hwdec/hwdec_cuda_vk.c2
-rw-r--r--video/out/hwdec/hwdec_drmprime.c2
-rw-r--r--video/out/hwdec/hwdec_drmprime_overlay.c8
-rw-r--r--video/out/hwdec/hwdec_vaapi.c4
-rw-r--r--video/out/opengl/hwdec_d3d11egl.c4
-rw-r--r--video/out/opengl/hwdec_dxva2egl.c2
-rw-r--r--video/out/opengl/hwdec_dxva2gldx.c9
-rw-r--r--video/out/opengl/hwdec_ios.m4
-rw-r--r--video/out/opengl/hwdec_osx.c4
-rw-r--r--video/out/opengl/hwdec_rpi.c2
-rw-r--r--video/out/opengl/hwdec_vdpau.c7
-rw-r--r--video/out/opengl/libmpv_gl.c2
-rw-r--r--video/out/vo_dmabuf_wayland.c6
-rw-r--r--video/out/vo_gpu.c2
-rw-r--r--video/out/vo_gpu_next.c2
28 files changed, 65 insertions, 56 deletions
diff --git a/video/out/d3d11/hwdec_d3d11va.c b/video/out/d3d11/hwdec_d3d11va.c
index 73c42e94ff..0242c8fedf 100644
--- a/video/out/d3d11/hwdec_d3d11va.c
+++ b/video/out/d3d11/hwdec_d3d11va.c
@@ -73,9 +73,9 @@ static int init(struct ra_hwdec *hw)
struct priv_owner *p = hw->priv;
HRESULT hr;
- if (!ra_is_d3d11(hw->ra))
+ if (!ra_is_d3d11(hw->ra_ctx->ra))
return -1;
- p->device = ra_d3d11_get_device(hw->ra);
+ p->device = ra_d3d11_get_device(hw->ra_ctx->ra);
if (!p->device)
return -1;
diff --git a/video/out/d3d11/hwdec_dxva2dxgi.c b/video/out/d3d11/hwdec_dxva2dxgi.c
index 8f8433166c..f68e0e3065 100644
--- a/video/out/d3d11/hwdec_dxva2dxgi.c
+++ b/video/out/d3d11/hwdec_dxva2dxgi.c
@@ -74,9 +74,9 @@ static int init(struct ra_hwdec *hw)
int ret = -1;
HRESULT hr;
- if (!ra_is_d3d11(hw->ra))
+ if (!ra_is_d3d11(hw->ra_ctx->ra))
goto done;
- p->dev11 = ra_d3d11_get_device(hw->ra);
+ p->dev11 = ra_d3d11_get_device(hw->ra_ctx->ra);
if (!p->dev11)
goto done;
diff --git a/video/out/gpu/hwdec.c b/video/out/gpu/hwdec.c
index 8b7e271c6a..8b1ab8c961 100644
--- a/video/out/gpu/hwdec.c
+++ b/video/out/gpu/hwdec.c
@@ -83,7 +83,8 @@ const struct ra_hwdec_driver *const ra_hwdec_drivers[] = {
NULL
};
-struct ra_hwdec *ra_hwdec_load_driver(struct ra *ra, struct mp_log *log,
+struct ra_hwdec *ra_hwdec_load_driver(struct ra_ctx *ra_ctx,
+ struct mp_log *log,
struct mpv_global *global,
struct mp_hwdec_devices *devs,
const struct ra_hwdec_driver *drv,
@@ -94,7 +95,7 @@ struct ra_hwdec *ra_hwdec_load_driver(struct ra *ra, struct mp_log *log,
.driver = drv,
.log = mp_log_new(hwdec, log, drv->name),
.global = global,
- .ra = ra,
+ .ra_ctx = ra_ctx,
.devs = devs,
.probing = is_auto,
.priv = talloc_zero_size(hwdec, drv->priv_size),
@@ -134,7 +135,7 @@ struct ra_hwdec_mapper *ra_hwdec_mapper_create(struct ra_hwdec *hwdec,
.owner = hwdec,
.driver = hwdec->driver->mapper,
.log = hwdec->log,
- .ra = hwdec->ra,
+ .ra = hwdec->ra_ctx->ra,
.priv = talloc_zero_size(mapper, hwdec->driver->mapper->priv_size),
.src_params = *params,
.dst_params = *params,
@@ -232,7 +233,7 @@ static void load_add_hwdec(struct ra_hwdec_ctx *ctx, struct mp_hwdec_devices *de
}
struct ra_hwdec *hwdec =
- ra_hwdec_load_driver(ctx->ra, ctx->log, ctx->global, devs, drv, is_auto);
+ ra_hwdec_load_driver(ctx->ra_ctx, ctx->log, ctx->global, devs, drv, is_auto);
if (hwdec)
MP_TARRAY_APPEND(NULL, ctx->hwdecs, ctx->num_hwdecs, hwdec);
}
@@ -249,7 +250,7 @@ static void load_hwdecs_all(struct ra_hwdec_ctx *ctx, struct mp_hwdec_devices *d
void ra_hwdec_ctx_init(struct ra_hwdec_ctx *ctx, struct mp_hwdec_devices *devs,
const char *type, bool load_all_by_default)
{
- assert(ctx->ra);
+ assert(ctx->ra_ctx);
/*
* By default, or if the option value is "auto", we will not pre-emptively
diff --git a/video/out/gpu/hwdec.h b/video/out/gpu/hwdec.h
index 0dd2e14588..7766073e0c 100644
--- a/video/out/gpu/hwdec.h
+++ b/video/out/gpu/hwdec.h
@@ -2,6 +2,7 @@
#define MPGL_HWDEC_H_
#include "video/mp_image.h"
+#include "context.h"
#include "ra.h"
#include "video/hwdec.h"
@@ -10,7 +11,7 @@ struct ra_hwdec_ctx {
// Set these before calling `ra_hwdec_ctx_init`
struct mp_log *log;
struct mpv_global *global;
- struct ra *ra;
+ struct ra_ctx *ra_ctx;
bool loading_done;
struct ra_hwdec **hwdecs;
@@ -38,7 +39,7 @@ struct ra_hwdec {
const struct ra_hwdec_driver *driver;
struct mp_log *log;
struct mpv_global *global;
- struct ra *ra;
+ struct ra_ctx *ra_ctx;
struct mp_hwdec_devices *devs;
// GLSL extensions required to sample textures from this.
const char **glsl_extensions;
@@ -131,7 +132,8 @@ struct ra_hwdec_driver {
extern const struct ra_hwdec_driver *const ra_hwdec_drivers[];
-struct ra_hwdec *ra_hwdec_load_driver(struct ra *ra, struct mp_log *log,
+struct ra_hwdec *ra_hwdec_load_driver(struct ra_ctx *ra_ctx,
+ struct mp_log *log,
struct mpv_global *global,
struct mp_hwdec_devices *devs,
const struct ra_hwdec_driver *drv,
diff --git a/video/out/gpu/libmpv_gpu.c b/video/out/gpu/libmpv_gpu.c
index 8cf3082380..aae1d18eed 100644
--- a/video/out/gpu/libmpv_gpu.c
+++ b/video/out/gpu/libmpv_gpu.c
@@ -81,14 +81,14 @@ static int init(struct render_backend *ctx, mpv_render_param *params)
void *data = params[n].data;
if (entry->size)
data = talloc_memdup(p, data, entry->size);
- ra_add_native_resource(p->context->ra, entry->name, data);
+ ra_add_native_resource(p->context->ra_ctx->ra, entry->name, data);
}
}
- p->renderer = gl_video_init(p->context->ra, ctx->log, ctx->global);
+ p->renderer = gl_video_init(p->context->ra_ctx->ra, ctx->log, ctx->global);
ctx->hwdec_devs = hwdec_devices_create();
- gl_video_init_hwdecs(p->renderer, ctx->hwdec_devs, true);
+ gl_video_init_hwdecs(p->renderer, p->context->ra_ctx, ctx->hwdec_devs, true);
ctx->driver_caps = VO_CAP_ROTATE90;
return 0;
}
diff --git a/video/out/gpu/libmpv_gpu.h b/video/out/gpu/libmpv_gpu.h
index 2c9f712fce..497dcc3f69 100644
--- a/video/out/gpu/libmpv_gpu.h
+++ b/video/out/gpu/libmpv_gpu.h
@@ -9,7 +9,7 @@ struct libmpv_gpu_context {
struct mp_log *log;
const struct libmpv_gpu_context_fns *fns;
- struct ra *ra;
+ struct ra_ctx *ra_ctx;
void *priv;
};
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 0994548034..b957f71258 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -4319,14 +4319,15 @@ struct mp_image *gl_video_get_image(struct gl_video *p, int imgfmt, int w, int h
return res;
}
-void gl_video_init_hwdecs(struct gl_video *p, struct mp_hwdec_devices *devs,
+void gl_video_init_hwdecs(struct gl_video *p, struct ra_ctx *ra_ctx,
+ struct mp_hwdec_devices *devs,
bool load_all_by_default)
{
- assert(!p->hwdec_ctx.ra);
+ assert(!p->hwdec_ctx.ra_ctx);
p->hwdec_ctx = (struct ra_hwdec_ctx) {
.log = p->log,
.global = p->global,
- .ra = p->ra,
+ .ra_ctx = ra_ctx,
};
ra_hwdec_ctx_init(&p->hwdec_ctx, devs, p->opts.hwdec_interop, load_all_by_default);
@@ -4335,6 +4336,6 @@ void gl_video_init_hwdecs(struct gl_video *p, struct mp_hwdec_devices *devs,
void gl_video_load_hwdecs_for_img_fmt(struct gl_video *p, struct mp_hwdec_devices *devs,
struct hwdec_imgfmt_request *params)
{
- assert(p->hwdec_ctx.ra);
+ assert(p->hwdec_ctx.ra_ctx);
ra_hwdec_ctx_load_fmt(&p->hwdec_ctx, devs, params);
}
diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h
index d2b451d5f6..5952998fa5 100644
--- a/video/out/gpu/video.h
+++ b/video/out/gpu/video.h
@@ -222,7 +222,8 @@ void gl_video_reset(struct gl_video *p);
bool gl_video_showing_interpolated_frame(struct gl_video *p);
struct mp_hwdec_devices;
-void gl_video_init_hwdecs(struct gl_video *p, struct mp_hwdec_devices *devs,
+void gl_video_init_hwdecs(struct gl_video *p, struct ra_ctx *ra_ctx,
+ struct mp_hwdec_devices *devs,
bool load_all_by_default);
struct hwdec_imgfmt_request;
void gl_video_load_hwdecs_for_img_fmt(struct gl_video *p, struct mp_hwdec_devices *devs,
diff --git a/video/out/hwdec/dmabuf_interop_gl.c b/video/out/hwdec/dmabuf_interop_gl.c
index 4bca008e58..bd33474289 100644
--- a/video/out/hwdec/dmabuf_interop_gl.c
+++ b/video/out/hwdec/dmabuf_interop_gl.c
@@ -277,7 +277,7 @@ static void vaapi_gl_unmap(struct ra_hwdec_mapper *mapper)
bool dmabuf_interop_gl_init(const struct ra_hwdec *hw,
struct dmabuf_interop *dmabuf_interop)
{
- if (!ra_is_gl(hw->ra)) {
+ if (!ra_is_gl(hw->ra_ctx->ra)) {
// This is not an OpenGL RA.
return false;
}
@@ -289,7 +289,7 @@ bool dmabuf_interop_gl_init(const struct ra_hwdec *hw,
if (!exts)
return false;
- GL *gl = ra_gl_get(hw->ra);
+ GL *gl = ra_gl_get(hw->ra_ctx->ra);
if (!gl_check_extension(exts, "EGL_EXT_image_dma_buf_import") ||
!gl_check_extension(exts, "EGL_KHR_image_base") ||
!gl_check_extension(gl->extensions, "GL_OES_EGL_image") ||
diff --git a/video/out/hwdec/dmabuf_interop_pl.c b/video/out/hwdec/dmabuf_interop_pl.c
index 5a2d690291..0a8ec5b011 100644
--- a/video/out/hwdec/dmabuf_interop_pl.c
+++ b/video/out/hwdec/dmabuf_interop_pl.c
@@ -117,7 +117,7 @@ static void vaapi_pl_unmap(struct ra_hwdec_mapper *mapper)
bool dmabuf_interop_pl_init(const struct ra_hwdec *hw,
struct dmabuf_interop *dmabuf_interop)
{
- pl_gpu gpu = ra_pl_get(hw->ra);
+ pl_gpu gpu = ra_pl_get(hw->ra_ctx->ra);
if (!gpu) {
// This is not a libplacebo RA;
return false;
diff --git a/video/out/hwdec/dmabuf_interop_wl.c b/video/out/hwdec/dmabuf_interop_wl.c
index 76f91aaf9a..9f0d490228 100644
--- a/video/out/hwdec/dmabuf_interop_wl.c
+++ b/video/out/hwdec/dmabuf_interop_wl.c
@@ -67,7 +67,7 @@ static void unmap(struct ra_hwdec_mapper *mapper)
bool dmabuf_interop_wl_init(const struct ra_hwdec *hw,
struct dmabuf_interop *dmabuf_interop)
{
- if (!ra_is_wldmabuf(hw->ra))
+ if (!ra_is_wldmabuf(hw->ra_ctx->ra))
return false;
if (strstr(hw->driver->name, "vaapi") != NULL)
diff --git a/video/out/hwdec/hwdec_aimagereader.c b/video/out/hwdec/hwdec_aimagereader.c
index 10f1c85687..5667580f43 100644
--- a/video/out/hwdec/hwdec_aimagereader.c
+++ b/video/out/hwdec/hwdec_aimagereader.c
@@ -129,7 +129,7 @@ static int init(struct ra_hwdec *hw)
{
struct priv_owner *p = hw->priv;
- if (!ra_is_gl(hw->ra))
+ if (!ra_is_gl(hw->ra_ctx->ra))
return -1;
if (!eglGetCurrentContext())
return -1;
diff --git a/video/out/hwdec/hwdec_cuda_gl.c b/video/out/hwdec/hwdec_cuda_gl.c
index 88952461e7..35b52d0f53 100644
--- a/video/out/hwdec/hwdec_cuda_gl.c
+++ b/video/out/hwdec/hwdec_cuda_gl.c
@@ -110,8 +110,8 @@ bool cuda_gl_init(const struct ra_hwdec *hw) {
struct cuda_hw_priv *p = hw->priv;
CudaFunctions *cu = p->cu;
- if (ra_is_gl(hw->ra)) {
- GL *gl = ra_gl_get(hw->ra);
+ if (ra_is_gl(hw->ra_ctx->ra)) {
+ GL *gl = ra_gl_get(hw->ra_ctx->ra);
if (gl->version < 210 && gl->es < 300) {
MP_VERBOSE(hw, "need OpenGL >= 2.1 or OpenGL-ES >= 3.0\n");
return false;
diff --git a/video/out/hwdec/hwdec_cuda_vk.c b/video/out/hwdec/hwdec_cuda_vk.c
index 37c5288686..e5929b8be6 100644
--- a/video/out/hwdec/hwdec_cuda_vk.c
+++ b/video/out/hwdec/hwdec_cuda_vk.c
@@ -263,7 +263,7 @@ bool cuda_vk_init(const struct ra_hwdec *hw) {
struct cuda_hw_priv *p = hw->priv;
CudaFunctions *cu = p->cu;
- pl_gpu gpu = ra_pl_get(hw->ra);
+ pl_gpu gpu = ra_pl_get(hw->ra_ctx->ra);
if (gpu != NULL) {
if (!(gpu->export_caps.tex & HANDLE_TYPE)) {
MP_VERBOSE(hw, "CUDA hwdec with Vulkan requires exportable texture memory of type 0x%X.\n",
diff --git a/video/out/hwdec/hwdec_drmprime.c b/video/out/hwdec/hwdec_drmprime.c
index 8a7c503757..5051207413 100644
--- a/video/out/hwdec/hwdec_drmprime.c
+++ b/video/out/hwdec/hwdec_drmprime.c
@@ -83,7 +83,7 @@ static int init(struct ra_hwdec *hw)
* there are extensions that supposedly provide this information from the
* drivers. Not properly documented. Of course.
*/
- mpv_opengl_drm_params_v2 *params = ra_get_native_resource(hw->ra,
+ mpv_opengl_drm_params_v2 *params = ra_get_native_resource(hw->ra_ctx->ra,
"drm_params_v2");
/*
diff --git a/video/out/hwdec/hwdec_drmprime_overlay.c b/video/out/hwdec/hwdec_drmprime_overlay.c
index c9725f2e7e..75d2a0740c 100644
--- a/video/out/hwdec/hwdec_drmprime_overlay.c
+++ b/video/out/hwdec/hwdec_drmprime_overlay.c
@@ -148,10 +148,12 @@ static int overlay_frame(struct ra_hwdec *hw, struct mp_image *hw_image,
struct drm_frame next_frame = {0};
int ret;
+ struct ra *ra = hw->ra_ctx->ra;
+
// grab atomic request from native resources
if (p->ctx) {
struct mpv_opengl_drm_params_v2 *drm_params;
- drm_params = (mpv_opengl_drm_params_v2 *)ra_get_native_resource(hw->ra, "drm_params_v2");
+ drm_params = (mpv_opengl_drm_params_v2 *)ra_get_native_resource(ra, "drm_params_v2");
if (!drm_params) {
MP_ERR(hw, "Failed to retrieve drm params from native resources\n");
return -1;
@@ -168,7 +170,7 @@ static int overlay_frame(struct ra_hwdec *hw, struct mp_image *hw_image,
// grab draw plane windowing info to eventually upscale the overlay
// as egl windows could be upscaled to draw plane.
- struct mpv_opengl_drm_draw_surface_size *draw_surface_size = ra_get_native_resource(hw->ra, "drm_draw_surface_size");
+ struct mpv_opengl_drm_draw_surface_size *draw_surface_size = ra_get_native_resource(ra, "drm_draw_surface_size");
if (draw_surface_size) {
scale_dst_rect(hw, draw_surface_size->width, draw_surface_size->height, dst, &p->dst);
} else {
@@ -259,7 +261,7 @@ static int init(struct ra_hwdec *hw)
struct mpv_opengl_drm_params_v2 *drm_params;
- drm_params = ra_get_native_resource(hw->ra, "drm_params_v2");
+ drm_params = ra_get_native_resource(hw->ra_ctx->ra, "drm_params_v2");
if (drm_params) {
p->ctx = drm_atomic_create_context(p->log, drm_params->fd, drm_params->crtc_id,
drm_params->connector_id, draw_plane, drmprime_video_plane);
diff --git a/video/out/hwdec/hwdec_vaapi.c b/video/out/hwdec/hwdec_vaapi.c
index 72a6cce263..9dd1fcd79e 100644
--- a/video/out/hwdec/hwdec_vaapi.c
+++ b/video/out/hwdec/hwdec_vaapi.c
@@ -146,7 +146,7 @@ static int init(struct ra_hwdec *hw)
return -1;
}
- p->display = create_native_va_display(hw->ra, hw->log);
+ p->display = create_native_va_display(hw->ra_ctx->ra, hw->log);
if (!p->display) {
MP_VERBOSE(hw, "Could not create a VA display.\n");
return -1;
@@ -172,7 +172,7 @@ static int init(struct ra_hwdec *hw)
}
// it's now safe to set the display resource
- ra_add_native_resource(hw->ra, "VADisplay", p->display);
+ 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;
diff --git a/video/out/opengl/hwdec_d3d11egl.c b/video/out/opengl/hwdec_d3d11egl.c
index 4a91267bbe..84b985906c 100644
--- a/video/out/opengl/hwdec_d3d11egl.c
+++ b/video/out/opengl/hwdec_d3d11egl.c
@@ -86,7 +86,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;
@@ -98,7 +98,7 @@ static int init(struct ra_hwdec *hw)
if (!eglGetCurrentContext())
return -1;
- GL *gl = ra_gl_get(hw->ra);
+ GL *gl = ra_gl_get(hw->ra_ctx->ra);
const char *exts = eglQueryString(egl_display, EGL_EXTENSIONS);
if (!gl_check_extension(exts, "EGL_ANGLE_d3d_share_handle_client_buffer") ||
diff --git a/video/out/opengl/hwdec_dxva2egl.c b/video/out/opengl/hwdec_dxva2egl.c
index 008af9842d..197d25b9b0 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;
diff --git a/video/out/opengl/hwdec_dxva2gldx.c b/video/out/opengl/hwdec_dxva2gldx.c
index d92dd75d10..0a0784af4c 100644
--- a/video/out/opengl/hwdec_dxva2gldx.c
+++ b/video/out/opengl/hwdec_dxva2gldx.c
@@ -58,21 +58,22 @@ static void uninit(struct ra_hwdec *hw)
static int init(struct ra_hwdec *hw)
{
struct priv_owner *p = hw->priv;
+ struct ra *ra = hw->ra_ctx->ra;
- if (!ra_is_gl(hw->ra))
+ if (!ra_is_gl(ra))
return -1;
- GL *gl = ra_gl_get(hw->ra);
+ GL *gl = ra_gl_get(ra);
if (!(gl->mpgl_caps & MPGL_CAP_DXINTEROP))
return -1;
// AMD drivers won't open multiple dxinterop HANDLES on the same D3D device,
// so we request the one already in use by context_dxinterop
- p->device_h = ra_get_native_resource(hw->ra, "dxinterop_device_HANDLE");
+ p->device_h = ra_get_native_resource(ra, "dxinterop_device_HANDLE");
if (!p->device_h)
return -1;
// But we also still need the actual D3D device
- p->device = ra_get_native_resource(hw->ra, "IDirect3DDevice9Ex");
+ p->device = ra_get_native_resource(ra, "IDirect3DDevice9Ex");
if (!p->device)
return -1;
IDirect3DDevice9Ex_AddRef(p->device);
diff --git a/video/out/opengl/hwdec_ios.m b/video/out/opengl/hwdec_ios.m
index 139779f106..480c9d9fe6 100644
--- a/video/out/opengl/hwdec_ios.m
+++ b/video/out/opengl/hwdec_ios.m
@@ -42,10 +42,10 @@ struct priv {
static bool check_hwdec(struct ra_hwdec *hw)
{
- if (!ra_is_gl(hw->ra))
+ if (!ra_is_gl(hw->ra_ctx->ra))
return false;
- GL *gl = ra_gl_get(hw->ra);
+ GL *gl = ra_gl_get(hw->ra_ctx->ra);
if (gl->es < 200) {
MP_ERR(hw, "need OpenGLES 2.0 for CVOpenGLESTextureCacheCreateTextureFromImage()\n");
return false;
diff --git a/video/out/opengl/hwdec_osx.c b/video/out/opengl/hwdec_osx.c
index 31d49493bb..69e8ca9d09 100644
--- a/video/out/opengl/hwdec_osx.c
+++ b/video/out/opengl/hwdec_osx.c
@@ -43,10 +43,10 @@ struct priv {
static bool check_hwdec(struct ra_hwdec *hw)
{
- if (!ra_is_gl(hw->ra))
+ if (!ra_is_gl(hw->ra_ctx->ra))
return false;
- GL *gl = ra_gl_get(hw->ra);
+ GL *gl = ra_gl_get(hw->ra_ctx->ra);
if (gl->version < 300) {
MP_ERR(hw, "need >= OpenGL 3.0 for core rectangle texture support\n");
return false;
diff --git a/video/out/opengl/hwdec_rpi.c b/video/out/opengl/hwdec_rpi.c
index 045fa75a35..5362832b03 100644
--- a/video/out/opengl/hwdec_rpi.c
+++ b/video/out/opengl/hwdec_rpi.c
@@ -130,7 +130,7 @@ static void update_overlay(struct ra_hwdec *hw, bool check_window_only)
struct mp_rect dst = p->dst;
int defs[4] = {0, 0, 0, 0};
- int *z = ra_get_native_resource(hw->ra, "MPV_RPI_WINDOW");
+ int *z = ra_get_native_resource(hw->ra_ctx->ra, "MPV_RPI_WINDOW");
if (!z)
z = defs;
diff --git a/video/out/opengl/hwdec_vdpau.c b/video/out/opengl/hwdec_vdpau.c
index 7ce2e0630b..acdc703cad 100644
--- a/video/out/opengl/hwdec_vdpau.c
+++ b/video/out/opengl/hwdec_vdpau.c
@@ -46,10 +46,11 @@ struct priv {
static int init(struct ra_hwdec *hw)
{
- Display *x11disp = ra_get_native_resource(hw->ra, "x11");
- if (!x11disp || !ra_is_gl(hw->ra))
+ struct ra *ra = hw->ra_ctx->ra;
+ Display *x11disp = ra_get_native_resource(ra, "x11");
+ if (!x11disp || !ra_is_gl(ra))
return -1;
- GL *gl = ra_gl_get(hw->ra);
+ GL *gl = ra_gl_get(ra);
if (!(gl->mpgl_caps & MPGL_CAP_VDPAU))
return -1;
struct priv_owner *p = hw->priv;
diff --git a/video/out/opengl/libmpv_gl.c b/video/out/opengl/libmpv_gl.c
index 1dcb21231a..c2cc10d43b 100644
--- a/video/out/opengl/libmpv_gl.c
+++ b/video/out/opengl/libmpv_gl.c
@@ -60,7 +60,7 @@ static int init(struct libmpv_gpu_context *ctx, mpv_render_param *params)
p->gl->debug_context = debug;
ra_gl_set_debug(p->ra_ctx->ra, debug);
- ctx->ra = p->ra_ctx->ra;
+ ctx->ra_ctx = p->ra_ctx;
return 0;
}
diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c
index d18aea2a5b..0a691d466e 100644
--- a/video/out/vo_dmabuf_wayland.c
+++ b/video/out/vo_dmabuf_wayland.c
@@ -423,7 +423,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
switch (request) {
case VOCTRL_LOAD_HWDEC_API:
- assert(p->hwdec_ctx.ra);
+ assert(p->hwdec_ctx.ra_ctx);
struct hwdec_imgfmt_request* req = (struct hwdec_imgfmt_request*)data;
if (!is_supported_fmt(req->imgfmt))
return 0;
@@ -529,11 +529,11 @@ static int preinit(struct vo *vo)
vo->hwdec_devs = hwdec_devices_create();
hwdec_devices_set_loader(vo->hwdec_devs, call_request_hwdec_api, vo);
- assert(!p->hwdec_ctx.ra);
+ assert(!p->hwdec_ctx.ra_ctx);
p->hwdec_ctx = (struct ra_hwdec_ctx) {
.log = p->log,
.global = p->global,
- .ra = p->ctx->ra,
+ .ra_ctx = p->ctx,
};
ra_hwdec_ctx_init(&p->hwdec_ctx, vo->hwdec_devs, NULL, true);
diff --git a/video/out/vo_gpu.c b/video/out/vo_gpu.c
index b778ab08ca..8939561a38 100644
--- a/video/out/vo_gpu.c
+++ b/video/out/vo_gpu.c
@@ -308,7 +308,7 @@ static int preinit(struct vo *vo)
vo->hwdec_devs = hwdec_devices_create();
hwdec_devices_set_loader(vo->hwdec_devs, call_request_hwdec_api, vo);
- gl_video_init_hwdecs(p->renderer, vo->hwdec_devs, false);
+ gl_video_init_hwdecs(p->renderer, p->ctx, vo->hwdec_devs, false);
return 0;
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c
index 6cb7a7d4d9..9916cbc6be 100644
--- a/video/out/vo_gpu_next.c
+++ b/video/out/vo_gpu_next.c
@@ -1453,7 +1453,7 @@ static int preinit(struct vo *vo)
p->hwdec_ctx = (struct ra_hwdec_ctx) {
.log = p->log,
.global = p->global,
- .ra = p->ra_ctx->ra,
+ .ra_ctx = p->ra_ctx,
};
vo->hwdec_devs = hwdec_devices_create();