[vlc-commits] vdpau/display: get the vdp/device directly from the decoder device
Steve Lhomme
git at videolan.org
Mon Dec 2 13:43:19 CET 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jan 1 01:00:00 1970 +0100| [79905eabf9928565ea7fe3d4f12109d8a4d15b97] | committer: Steve Lhomme
vdpau/display: get the vdp/device directly from the decoder device
The connection we'll use with this vdp/device will match the window configuration
as it comes from the decoder device which uses the same window configuration as
the window this display is tied to.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=79905eabf9928565ea7fe3d4f12109d8a4d15b97
---
modules/hw/vdpau/display.c | 43 +++++++++++++++++--------------------------
1 file changed, 17 insertions(+), 26 deletions(-)
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index 63dcc2291b..c91633a205 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -285,21 +285,6 @@ static int Control(vout_display_t *vd, int query, va_list ap)
return VLC_SUCCESS;
}
-static int xcb_screen_num(xcb_connection_t *conn, const xcb_screen_t *screen)
-{
- const xcb_setup_t *setup = xcb_get_setup(conn);
- unsigned snum = 0;
-
- for (xcb_screen_iterator_t i = xcb_setup_roots_iterator(setup);
- i.rem > 0; xcb_screen_next(&i))
- {
- if (i.data->root == screen->root)
- return snum;
- snum++;
- }
- return -1;
-}
-
static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
video_format_t *fmtp, vlc_video_context *context)
{
@@ -317,18 +302,25 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
return VLC_EGENERIC;
}
- /* Load the VDPAU back-end and create a device instance */
- VdpStatus err = vdp_get_x11(cfg->window->display.x11,
- xcb_screen_num(sys->conn, screen),
- &sys->vdp, &sys->device);
- if (err != VDP_STATUS_OK)
+ vlc_decoder_device *dec_device = context ? vlc_video_context_HoldDevice(context) : NULL;
+ if (dec_device == NULL)
+ goto error;
+
+ vdpau_decoder_device_t *vdpau_decoder = GetVDPAUOpaqueDevice(dec_device);
+ if (vdpau_decoder == NULL)
{
- msg_Dbg(vd, "device creation failure: error %d", (int)err);
- xcb_disconnect(sys->conn);
- free(sys);
- return VLC_EGENERIC;
+ vlc_decoder_device_Release(dec_device);
+ goto error;
}
+ // get the vdp/device from the decoder device, it is always matching the same
+ // window configuration use to create the XCB connection that was used to
+ // create the decoder device
+ sys->vdp = vdpau_decoder->vdp;
+ sys->device = vdpau_decoder->device;
+
+ vlc_decoder_device_Release(dec_device);
+
const char *info;
if (vdp_get_information_string(sys->vdp, &info) == VDP_STATUS_OK)
msg_Dbg(vd, "using back-end %s", info);
@@ -337,6 +329,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
video_format_t fmt;
VdpChromaType chroma;
VdpYCbCrFormat format;
+ VdpStatus err;
video_format_ApplyRotation(&fmt, fmtp);
@@ -509,7 +502,6 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
return VLC_SUCCESS;
error:
- vdp_release_x11(sys->vdp);
xcb_disconnect(sys->conn);
free(sys);
return VLC_EGENERIC;
@@ -525,7 +517,6 @@ static void Close(vout_display_t *vd)
if (sys->current != NULL)
picture_Release(sys->current);
- vdp_release_x11(sys->vdp);
xcb_disconnect(sys->conn);
free(sys);
}
More information about the vlc-commits
mailing list