[vlc-devel] [PATCH 30/34] nvdec: don't keep the decoder_device_nvdec_t in the picture context
Steve Lhomme
robux4 at ycbcr.xyz
Fri Nov 8 15:40:34 CET 2019
We can always get it from the video context.
---
modules/hw/nvdec/chroma.c | 10 ++++------
modules/hw/nvdec/nvdec.c | 3 ---
modules/hw/nvdec/nvdec_fmt.h | 3 ---
3 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/modules/hw/nvdec/chroma.c b/modules/hw/nvdec/chroma.c
index d7d3749109f..ad52e4361d5 100644
--- a/modules/hw/nvdec/chroma.c
+++ b/modules/hw/nvdec/chroma.c
@@ -42,11 +42,6 @@ vlc_module_begin()
set_callbacks(OpenCUDAToCPU, NULL)
vlc_module_end()
-typedef struct
-{
- vlc_decoder_device *device;
-} nvdec_filter_sys_t;
-
#define CALL_CUDA(func, ...) CudaCheckErr(VLC_OBJECT(p_filter), devsys->cudaFunctions, devsys->cudaFunctions->func(__VA_ARGS__), #func)
@@ -60,7 +55,8 @@ static picture_t * FilterCUDAToCPU( filter_t *p_filter, picture_t *src )
}
pic_context_nvdec_t *srcpic = container_of(src->context, pic_context_nvdec_t, ctx);
- decoder_device_nvdec_t *devsys = &srcpic->nvdecDevice;
+ vlc_decoder_device *dec_dev = vlc_video_context_HoldDevice(p_filter->vctx_in);
+ decoder_device_nvdec_t *devsys = GetNVDECOpaqueDevice(dec_dev);
int result;
result = CALL_CUDA(cuCtxPushCurrent, devsys->cuCtx);
@@ -68,6 +64,7 @@ static picture_t * FilterCUDAToCPU( filter_t *p_filter, picture_t *src )
{
picture_Release(dst);
picture_Release(src);
+ vlc_decoder_device_Release(dec_dev);
return NULL;
}
@@ -99,6 +96,7 @@ static picture_t * FilterCUDAToCPU( filter_t *p_filter, picture_t *src )
done:
CALL_CUDA(cuCtxPopCurrent, NULL);
picture_Release(src);
+ vlc_decoder_device_Release(dec_dev);
return dst;
}
diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index 75bc54b06b1..df957b98dfb 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -331,7 +331,6 @@ static struct picture_context_t *NVDecCtxClone(struct picture_context_t *srcctx)
clonectx->devidePtr = srcpic->devidePtr;
clonectx->bufferPitch = srcpic->bufferPitch;
clonectx->bufferHeight = srcpic->bufferHeight;
- clonectx->nvdecDevice = srcpic->nvdecDevice;
return &clonectx->ctx;
}
@@ -381,8 +380,6 @@ static int CUDAAPI HandlePictureDisplay(void *p_opaque, CUVIDPARSERDISPINFO *p_d
picctx->devidePtr = p_sys->outputDevicePtr[pool_idx];
picctx->bufferPitch = p_sys->outputPitch;
picctx->bufferHeight = p_sys->decoderHeight;
- picctx->nvdecDevice.cuCtx = p_sys->cuCtx;
- picctx->nvdecDevice.cudaFunctions = p_sys->cudaFunctions;
size_t srcY = 0;
size_t dstY = 0;
diff --git a/modules/hw/nvdec/nvdec_fmt.h b/modules/hw/nvdec/nvdec_fmt.h
index 1668ad3696b..f1e471c7790 100644
--- a/modules/hw/nvdec/nvdec_fmt.h
+++ b/modules/hw/nvdec/nvdec_fmt.h
@@ -65,9 +65,6 @@ typedef struct
CUdeviceptr devidePtr;
unsigned int bufferPitch;
unsigned int bufferHeight;
-
- // temporary until the filters get it from their environment/video context
- decoder_device_nvdec_t nvdecDevice;
} pic_context_nvdec_t;
#endif /* include-guard */
--
2.17.1
More information about the vlc-devel
mailing list