nvdec: Don't use default CUDA stream
authorSeungha Yang <seungha@centricular.com>
Mon, 19 Dec 2022 09:41:46 +0000 (18:41 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 19 Dec 2022 20:27:35 +0000 (20:27 +0000)
commit9914ff9b4c14343856e25e7b2b341551c6c22ec8
tree7210fa38046dcf304c8cdbcee9a997de52d9a29c
parent74a503c1970af98fdf3207b2537e30ec77459e3e
nvdec: Don't use default CUDA stream

NVDEC launches CUDA kernel function (ConvertNV12BLtoNV12 or so)
when CuvidMapVideoFrame() is called. Which seems to be
NVDEC's internal post-processing kernel function, maybe
to convert tiled YUV to linear YUV format or something similar.

A problem if we don't pass CUDA stream to the CuvidMapVideoFrame()
call is that the NVDEC's internel kernel function will use default CUDA stream.
Then lots of the other CUDA API calls will be blocked/serialized.

To avoid the unnecessary blocking, we should pass our own
CUDA stream object to the CuvidMapVideoFrame() call

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3605>
subprojects/gst-plugins-bad/sys/nvcodec/gstnvdec.c
subprojects/gst-plugins-bad/sys/nvcodec/gstnvdecoder.c