[vlc-devel] [PATCH 2/4] opengl/vdpau: keep a reference to the decoder device
Rémi Denis-Courmont
remi at remlab.net
Mon Oct 21 14:21:46 CEST 2019
Hi,
Currently, the converter module is inside the dGL VD, and since the context is fixed for the lifetime of a VD, it can't exactly not outlive the VD. Regardless of whether its lifecycle is shorter than that of the device, I don't really follow the rationale here.
Le 21 octobre 2019 09:45:37 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>It's not going to change during the lifetime of the converter module,
>unlike
>the video context.
>---
> modules/video_output/opengl/converter_vdpau.c | 26 +++++++++++++------
> 1 file changed, 18 insertions(+), 8 deletions(-)
>
>diff --git a/modules/video_output/opengl/converter_vdpau.c
>b/modules/video_output/opengl/converter_vdpau.c
>index 5220699128f..874f8f5307e 100644
>--- a/modules/video_output/opengl/converter_vdpau.c
>+++ b/modules/video_output/opengl/converter_vdpau.c
>@@ -58,17 +58,19 @@ static PFNGLVDPAUSURFACEACCESSNVPROC
>_glVDPAUSurfaceAccessNV;
> static PFNGLVDPAUMAPSURFACESNVPROC _glVDPAUMapSurfacesNV;
>static PFNGLVDPAUUNMAPSURFACESNVPROC
>_glVDPAUUnmapSurfacesNV;
>
>+typedef struct {
>+ vlc_decoder_device *dec_device;
>+} converter_sys_t;
>+
> static picture_pool_t *
> tc_vdpau_gl_get_pool(opengl_tex_converter_t const *tc,
> unsigned int requested_count)
> {
>- vlc_decoder_device *dec_device =
>vlc_video_context_HoldDevice(tc->vctx);
>- picture_pool_t *pool;
>- pool = vlc_vdp_output_pool_create(dec_device->opaque,
>+ converter_sys_t *sys = tc->priv;
>+ vlc_decoder_device *dec_device = sys->dec_device;
>+ return vlc_vdp_output_pool_create(dec_device->opaque,
> VDP_RGBA_FORMAT_B8G8R8A8,
> &tc->fmt, requested_count);
>- vlc_decoder_device_Release(dec_device);
>- return pool;
> }
>
> static int
>@@ -116,7 +118,8 @@ Close(vlc_object_t *obj)
> {
> opengl_tex_converter_t *tc = (void *)obj;
> _glVDPAUFiniNV(); assert(tc->vt->GetError() == GL_NO_ERROR);
>- vlc_decoder_device *dec_device =
>vlc_video_context_HoldDevice(tc->vctx);
>+ converter_sys_t *sys = tc->priv;
>+ vlc_decoder_device *dec_device = sys->dec_device;
> vdp_release_x11(dec_device->opaque);
> vlc_decoder_device_Release(dec_device);
> }
>@@ -139,6 +142,14 @@ Open(vlc_object_t *obj)
> return VLC_EGENERIC;
> }
>
>+ converter_sys_t *sys = vlc_obj_malloc(VLC_OBJECT(tc),
>sizeof(*sys));
>+ if (unlikely(sys == NULL))
>+ {
>+ vlc_decoder_device_Release(dec_device);
>+ return VLC_ENOMEM;
>+ }
>+ sys->dec_device = dec_device;
>+
> tc->fmt.i_chroma = VLC_CODEC_VDPAU_OUTPUT;
>
> VdpDevice device;
>@@ -176,8 +187,6 @@ Open(vlc_object_t *obj)
>
> INTEROP_CALL(glVDPAUInitNV, (void *)(uintptr_t)device, vdp_gpa);
>
>- vlc_decoder_device_Release(dec_device);
>-
> tc->fshader = opengl_fragment_shader_init(tc, GL_TEXTURE_2D,
> VLC_CODEC_RGB32,
> COLOR_SPACE_UNDEF);
>@@ -189,6 +198,7 @@ Open(vlc_object_t *obj)
>
> tc->pf_get_pool = tc_vdpau_gl_get_pool;
> tc->pf_update = tc_vdpau_gl_update;
>+ tc->priv = sys;
>
> return VLC_SUCCESS;
> }
>--
>2.17.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20191021/c64e7d98/attachment.html>
More information about the vlc-devel
mailing list