[vlc-commits] nvdec: don't keep the decoder_device_nvdec_t in the picture context

Steve Lhomme git at videolan.org
Mon Dec 2 13:43:07 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 17 13:53:03 2019 +0200| [a37f08409ceed0bf6ffc6d696c4517b5ca7047f7] | committer: Steve Lhomme

nvdec: don't keep the decoder_device_nvdec_t in the picture context

We can always get it from the video context which we now have on input of the filter.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a37f08409ceed0bf6ffc6d696c4517b5ca7047f7
---

 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 eddc91098f..422afae31e 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 e2741416ff..a97e6a506a 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 1668ad3696..f1e471c779 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 */



More information about the vlc-commits mailing list