summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/out/gl_common.h1
-rw-r--r--video/out/gl_hwdec_vdpau.c17
-rw-r--r--video/out/vo_opengl.c1
-rw-r--r--video/out/vo_vdpau.c2
-rw-r--r--video/vdpau.c7
-rw-r--r--video/vdpau.h5
6 files changed, 16 insertions, 17 deletions
diff --git a/video/out/gl_common.h b/video/out/gl_common.h
index d7ba888a93..fa1566b0fb 100644
--- a/video/out/gl_common.h
+++ b/video/out/gl_common.h
@@ -172,7 +172,6 @@ struct gl_hwdec {
const struct gl_hwdec_driver *driver;
struct mp_log *log;
GL *gl;
- struct MPGLContext *mpgl;
struct mp_hwdec_info *info;
// For free use by hwdec driver
void *priv;
diff --git a/video/out/gl_hwdec_vdpau.c b/video/out/gl_hwdec_vdpau.c
index db67679e4e..2fa262348f 100644
--- a/video/out/gl_hwdec_vdpau.c
+++ b/video/out/gl_hwdec_vdpau.c
@@ -18,6 +18,8 @@
#include <stddef.h>
#include <assert.h>
+#include <GL/glx.h>
+
#include "gl_common.h"
#include "video/vdpau.h"
#include "video/hwdec.h"
@@ -51,7 +53,7 @@ static void mark_vdpau_objects_uninitialized(struct gl_hwdec *hw)
static void destroy_objects(struct gl_hwdec *hw)
{
struct priv *p = hw->priv;
- GL *gl = hw->mpgl->gl;
+ GL *gl = hw->gl;
struct vdp_functions *vdp = &p->ctx->vdp;
VdpStatus vdp_st;
@@ -90,17 +92,18 @@ static void destroy(struct gl_hwdec *hw)
static int create(struct gl_hwdec *hw)
{
- GL *gl = hw->mpgl->gl;
+ GL *gl = hw->gl;
if (hw->info->vdpau_ctx)
return -1;
- if (!hw->mpgl->vo->x11)
+ Display *x11disp = glXGetCurrentDisplay();
+ if (!x11disp)
return -1;
if (!(gl->mpgl_caps & MPGL_CAP_VDPAU))
return -1;
struct priv *p = talloc_zero(hw, struct priv);
hw->priv = p;
p->log = hw->log;
- p->ctx = mp_vdpau_create_device_x11(hw->log, hw->mpgl->vo->x11);
+ p->ctx = mp_vdpau_create_device_x11(hw->log, x11disp);
if (!p->ctx)
return -1;
if (mp_vdpau_handle_preemption(p->ctx, &p->preemption_counter) < 1)
@@ -115,7 +118,7 @@ static int create(struct gl_hwdec *hw)
static int reinit(struct gl_hwdec *hw, const struct mp_image_params *params)
{
struct priv *p = hw->priv;
- GL *gl = hw->mpgl->gl;
+ GL *gl = hw->gl;
struct vdp_functions *vdp = &p->ctx->vdp;
VdpStatus vdp_st;
@@ -158,7 +161,7 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image,
GLuint *out_textures)
{
struct priv *p = hw->priv;
- GL *gl = hw->mpgl->gl;
+ GL *gl = hw->gl;
assert(hw_image && hw_image->imgfmt == IMGFMT_VDPAU);
@@ -184,7 +187,7 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image,
static void unmap_image(struct gl_hwdec *hw)
{
struct priv *p = hw->priv;
- GL *gl = hw->mpgl->gl;
+ GL *gl = hw->gl;
gl->VDPAUUnmapSurfacesNV(1, &p->vdpgl_surface);
}
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 482eed1b79..2499106355 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -227,7 +227,6 @@ static void load_hwdec_driver(struct gl_priv *p,
*hwdec = (struct gl_hwdec) {
.driver = drv,
.log = mp_log_new(hwdec, p->vo->log, drv->api_name),
- .mpgl = p->glctx,
.gl = p->glctx->gl,
.info = &p->hwdec_info,
.gl_texture_target = GL_TEXTURE_2D,
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 46190fd032..aa2cd910a0 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -985,7 +985,7 @@ static int preinit(struct vo *vo)
if (!vo_x11_init(vo))
return -1;
- vc->mpvdp = mp_vdpau_create_device_x11(vo->log, vo->x11);
+ vc->mpvdp = mp_vdpau_create_device_x11(vo->log, vo->x11->display);
if (!vc->mpvdp) {
vo_x11_uninit(vo);
return -1;
diff --git a/video/vdpau.c b/video/vdpau.c
index 754b6d300c..650f181907 100644
--- a/video/vdpau.c
+++ b/video/vdpau.c
@@ -47,7 +47,7 @@ static void preemption_callback(VdpDevice device, void *context)
static int win_x11_init_vdpau_procs(struct mp_vdpau_ctx *ctx)
{
- struct vo_x11_state *x11 = ctx->x11;
+ Display *x11 = ctx->x11;
VdpStatus vdp_st;
// Don't operate on ctx->vdp directly, so that even if init fails, ctx->vdp
@@ -71,7 +71,7 @@ static int win_x11_init_vdpau_procs(struct mp_vdpau_ctx *ctx)
};
VdpGetProcAddress *get_proc_address;
- vdp_st = vdp_device_create_x11(x11->display, x11->screen, &ctx->vdp_device,
+ vdp_st = vdp_device_create_x11(x11, DefaultScreen(x11), &ctx->vdp_device,
&get_proc_address);
if (vdp_st != VDP_STATUS_OK) {
if (ctx->is_preempted)
@@ -295,8 +295,7 @@ struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx,
return mp_vdpau_get_surface(ctx, chroma, 0, false, w, h);
}
-struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log,
- struct vo_x11_state *x11)
+struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log, Display *x11)
{
struct mp_vdpau_ctx *ctx = talloc_ptrtype(NULL, ctx);
*ctx = (struct mp_vdpau_ctx) {
diff --git a/video/vdpau.h b/video/vdpau.h
index 6f60165ed1..f1c29fd50d 100644
--- a/video/vdpau.h
+++ b/video/vdpau.h
@@ -38,7 +38,7 @@ struct vdp_functions {
// incompatible to each other, so all code must use a shared VdpDevice.
struct mp_vdpau_ctx {
struct mp_log *log;
- struct vo_x11_state *x11;
+ Display *x11;
// These are mostly immutable, except on preemption. We don't really care
// to synchronize the preemption case fully correctly, because it's an
@@ -70,8 +70,7 @@ struct mp_vdpau_ctx {
} video_surfaces[MAX_VIDEO_SURFACES];
};
-struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log,
- struct vo_x11_state *x11);
+struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log, Display *x11);
void mp_vdpau_destroy(struct mp_vdpau_ctx *ctx);
int mp_vdpau_handle_preemption(struct mp_vdpau_ctx *ctx, uint64_t *counter);