From f72a775d0356703e5ba5618b393f63f46c003f01 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 29 Aug 2024 20:24:56 +0900 Subject: [PATCH] cudaipcsink: Disable stream ordered allocation Legacy CUDA IPC does not support default CUDA memory pool Part-of: --- .../gst-plugins-bad/sys/nvcodec/gstcudaipcsink.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudaipcsink.cpp b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudaipcsink.cpp index 2b3e4c8671..f4ea185331 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudaipcsink.cpp +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudaipcsink.cpp @@ -459,6 +459,9 @@ gst_cuda_ipc_sink_set_caps (GstBaseSink * sink, GstCaps * caps) if (priv->configured_ipc_mode == GST_CUDA_IPC_MMAP) { gst_buffer_pool_config_set_cuda_alloc_method (config, GST_CUDA_MEMORY_ALLOC_MMAP); + } else { + /* legacy CUDA ipc requires default cuda allocation */ + gst_buffer_pool_config_set_cuda_stream_ordered_alloc (config, FALSE); } if (!gst_buffer_pool_set_config (priv->fallback_pool, config)) { @@ -514,6 +517,9 @@ gst_cuda_ipc_sink_propose_allocation (GstBaseSink * sink, GstQuery * query) if (priv->configured_ipc_mode == GST_CUDA_IPC_MMAP) { gst_buffer_pool_config_set_cuda_alloc_method (config, GST_CUDA_MEMORY_ALLOC_MMAP); + } else { + /* legacy CUDA ipc requires default cuda allocation */ + gst_buffer_pool_config_set_cuda_stream_ordered_alloc (config, FALSE); } size = GST_VIDEO_INFO_SIZE (&info); @@ -613,7 +619,10 @@ gst_cuda_ipc_sink_prepare (GstBaseSink * sink, GstBuffer * buf) (priv->configured_ipc_mode == GST_CUDA_IPC_MMAP && alloc_method != GST_CUDA_MEMORY_ALLOC_MMAP) || (priv->configured_ipc_mode == GST_CUDA_IPC_LEGACY && - alloc_method != GST_CUDA_MEMORY_ALLOC_MALLOC)) { + alloc_method != GST_CUDA_MEMORY_ALLOC_MALLOC) || + (priv->configured_ipc_mode == GST_CUDA_IPC_LEGACY && + alloc_method == GST_CUDA_MEMORY_ALLOC_MALLOC && + gst_cuda_memory_is_stream_ordered (mem))) { if (gst_buffer_pool_acquire_buffer (priv->fallback_pool, &cuda_buf, nullptr) != GST_FLOW_OK) { GST_ERROR_OBJECT (self, "Couldn't acquire fallback buffer");