diff options
author | wm4 <wm4@nowhere> | 2018-03-22 17:05:01 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-03-26 19:47:08 +0200 |
commit | 52dd38a48a4a94d1c477b62cebcd67b911eb27fa (patch) | |
tree | ff2449de78ae1a30af5fbb7c6e399172403549b4 /video/out/opengl/hwdec_drmprime_drm.c | |
parent | 0b4120919aa1e4e70b49dd3f93af0acddd7ea4d3 (diff) | |
download | mpv-52dd38a48a4a94d1c477b62cebcd67b911eb27fa.tar.bz2 mpv-52dd38a48a4a94d1c477b62cebcd67b911eb27fa.tar.xz |
client API: add a new way to pass X11 Display etc. to render API
Hardware decoding things often need access to additional handles from
the windowing system, such as the X11 or Wayland display when using
vaapi. The opengl-cb had nothing dedicated for this, and used the weird
GL_MP_MPGetNativeDisplay GL extension (which was mpv specific and not
officially registered with OpenGL).
This was awkward, and a pain due to having to emulate GL context
behavior (like needing a TLS variable to store context for the pseudo GL
extension function). In addition (and not inherently due to this), we
could pass only one resource from mpv builtin context backends to
hwdecs. It was also all GL specific.
Replace this with a newer mechanism. It works for all RA backends, not
just GL. the API user can explicitly pass the objects at init time via
mpv_render_context_create(). Multiple resources are naturally possible.
The API uses MPV_RENDER_PARAM_* defines, but internally we use strings.
This is done for 2 reasons: 1. trying to leave libmpv and internal
mechanisms decoupled, 2. not having to add public API for some of the
internal resource types (especially D3D/GL interop stuff).
To remain sane, drop support for obscure half-working opengl-cb things,
like the DRM interop (was missing necessary things), the RPI window
thing (nobody used it), and obscure D3D interop things (not needed with
ANGLE, others were undocumented). In order not to break ABI and the C
API, we don't remove the associated structs from opengl_cb.h.
The parts which are still needed (in particular DRM interop) needs to be
ported to the render API.
Diffstat (limited to 'video/out/opengl/hwdec_drmprime_drm.c')
-rw-r--r-- | video/out/opengl/hwdec_drmprime_drm.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/video/out/opengl/hwdec_drmprime_drm.c b/video/out/opengl/hwdec_drmprime_drm.c index b1d5e98c1f..422612287c 100644 --- a/video/out/opengl/hwdec_drmprime_drm.c +++ b/video/out/opengl/hwdec_drmprime_drm.c @@ -35,8 +35,6 @@ #include "video/out/gpu/hwdec.h" #include "video/mp_image.h" -#include "ra_gl.h" - extern const struct m_sub_options drm_conf; struct drm_frame { @@ -114,7 +112,6 @@ static int overlay_frame(struct ra_hwdec *hw, struct mp_image *hw_image, struct mp_rect *src, struct mp_rect *dst, bool newframe) { struct priv *p = hw->priv; - GL *gl = ra_gl_get(hw->ra); AVDRMFrameDescriptor *desc = NULL; drmModeAtomicReq *request = NULL; struct drm_frame next_frame = {0}; @@ -125,8 +122,7 @@ static int overlay_frame(struct ra_hwdec *hw, struct mp_image *hw_image, // grab opengl-cb windowing info to eventually upscale the overlay // as egl windows could be upscaled to primary plane. struct mpv_opengl_cb_window_pos *glparams = - gl ? (struct mpv_opengl_cb_window_pos *) - mpgl_get_native_display(gl, "opengl-cb-window-pos") : NULL; + ra_get_native_resource(hw->ra, "opengl-cb-window-pos"); if (glparams) { scale_dst_rect(hw, glparams->width, glparams->height, dst, &p->dst); } else { @@ -136,8 +132,7 @@ static int overlay_frame(struct ra_hwdec *hw, struct mp_image *hw_image, // grab drm interop info struct mpv_opengl_cb_drm_params *drmparams = - gl ? (struct mpv_opengl_cb_drm_params *) - mpgl_get_native_display(gl, "opengl-cb-drm-params") : NULL; + ra_get_native_resource(hw->ra, "opengl-cb-drm-params"); if (drmparams) request = (drmModeAtomicReq *)drmparams->atomic_request; @@ -208,9 +203,6 @@ static int init(struct ra_hwdec *hw) struct priv *p = hw->priv; int drm_overlay; - if (!ra_is_gl(hw->ra)) - return -1; - p->log = hw->log; void *tmp = talloc_new(NULL); @@ -218,10 +210,8 @@ static int init(struct ra_hwdec *hw) drm_overlay = opts->drm_overlay_id; talloc_free(tmp); - GL *gl = ra_gl_get(hw->ra); struct mpv_opengl_cb_drm_params *params = - gl ? (struct mpv_opengl_cb_drm_params *) - mpgl_get_native_display(gl, "opengl-cb-drm-params") : NULL; + ra_get_native_resource(hw->ra, "opengl-cb-drm-params"); if (!params) { MP_VERBOSE(hw, "Could not get drm interop info.\n"); goto err; |