[vlc-devel] [PATCH 32/36] nvdec: don't keep the decoder_device_nvdec_t in the picture context
Steve Lhomme
robux4 at ycbcr.xyz
Thu Nov 21 15:14:23 CET 2019
We can always get it from the video context which we now have on input of the filter.
---
modules/hw/nvdec/chroma.c | 10 ++++------
modules/hw/nvdec/nvdec.c | 2 --
modules/hw/nvdec/nvdec_fmt.h | 3 ---
3 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/modules/hw/nvdec/chroma.c b/modules/hw/nvdec/chroma.c
index eddc91098f6..422afae31ef 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 e2741416ff6..a97e6a506a4 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -379,8 +379,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