mirror of https://github.com/mpv-player/mpv
vdpau/GLX: don't access VO backend
Same as with the previous commits. In theory, vdpau/x11 GL interop doesn't assume GLX. It could use EGL as well. But since it's always GLX in practice, so we're fine with this. Remove the gl_hwdec.mpgl field - it's unused now.
This commit is contained in:
parent
031aef9be9
commit
63377744f3
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue