static int create(struct gl_hwdec *hw) { GL *gl = hw->gl; if (hw->hwctx) return -1; 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, x11disp, true); if (!p->ctx) return -1; if (mp_vdpau_handle_preemption(p->ctx, &p->preemption_counter) < 1) return -1; p->vdp_surface = VDP_INVALID_HANDLE; p->mixer = mp_vdpau_mixer_create(p->ctx, hw->log); if (hw->probing && mp_vdpau_guess_if_emulated(p->ctx)) { destroy(hw); return -1; } hw->hwctx = &p->ctx->hwctx; hw->converted_imgfmt = IMGFMT_RGB0; return 0; }
static int create(struct gl_hwdec *hw) { GL *gl = hw->mpgl->gl; if (hw->info->vdpau_ctx) return -1; if (!hw->mpgl->vo->x11) 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); if (!p->ctx) return -1; p->preemption_counter = p->ctx->preemption_counter; p->vdp_surface = VDP_INVALID_HANDLE; p->mixer = mp_vdpau_mixer_create(p->ctx, hw->log); hw->info->vdpau_ctx = p->ctx; hw->converted_imgfmt = IMGFMT_RGB0; return 0; }