mirror of
git://nv-tegra.nvidia.com/tegra/gst-src/libgstnvvideosinks.git
synced 2025-12-22 09:22:49 +03:00
Compare commits
3 Commits
jetson_35.
...
l4t/l4t-r3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca40e5f95b | ||
|
|
3a195c8306 | ||
|
|
43b7ad2992 |
@@ -1,25 +1,25 @@
|
||||
Updating prebuilts and/or headers
|
||||
|
||||
ed8273ff6102bb0b4fa7975a401b12b3e95a7187 - nvbufsurface.h
|
||||
44b0e909f18f7e2f457ba501fc47d80ecedd150b - nvbufsurface.h
|
||||
9a172f748a2b8f4d6d15648ea353989ccc7aeba6 - gst-plugins-nv-video-sinks/Makefile
|
||||
9825d8a113dbf7dd16f791ff1ca66f2de3047b22 - gst-plugins-nv-video-sinks/LICENSE.libgstnvvideosinks
|
||||
7ef56486c9e6b3e354473a2959d274517dd709da - gst-plugins-nv-video-sinks/gstnvvideosinks.c
|
||||
4f86ed5c7d6dfa6e6e4df4fd2945993655fc3409 - gst-plugins-nv-video-sinks/common/context.c
|
||||
a0debde9b0fd5bc6ac9c5fac7f1a14745a2b0617 - gst-plugins-nv-video-sinks/common/display.c
|
||||
fcb1b73054a1c8ff8ce614878ee46880273656f4 - gst-plugins-nv-video-sinks/common/renderer.c
|
||||
15221adcd6193b5e2c1b38cba595d48e2da6a43f - gst-plugins-nv-video-sinks/nv3dsink/gstnv3dsink.c
|
||||
9b7125a2d7ebe2ea647c43d2eb43e8d04cd16c47 - gst-plugins-nv-video-sinks/nv3dsink/gstnv3dsink.h
|
||||
835dc89a20f2a95bea9c4033e40bf6787148ab08 - gst-plugins-nv-video-sinks/common/window.c
|
||||
a52c6765b04d69f754e5aeaa8c17f83747124150 - gst-plugins-nv-video-sinks/common/display.c
|
||||
96b0b4d38692a0aecf70944749684ac938ff192f - gst-plugins-nv-video-sinks/common/display.h
|
||||
718a740b0d05eeaf159bc13b6734485fd065da8e - gst-plugins-nv-video-sinks/common/renderer.c
|
||||
6e77d54ffc5d1a49d5bad768cdf5cfadf458f1f7 - gst-plugins-nv-video-sinks/common/window.h
|
||||
9509626b9f2d25a07ceb91b524c604089812cebb - gst-plugins-nv-video-sinks/common/context.c
|
||||
9d31e8f421736ac5bd8e166db190965bf3a5e472 - gst-plugins-nv-video-sinks/common/renderer.h
|
||||
d48e1dae85e3c6a0ba7623be7ee306b8e1ef6695 - gst-plugins-nv-video-sinks/common/gstnvvideofwd.h
|
||||
ad360a668f0f494ebd2bb630c3faaf93078c6e0d - gst-plugins-nv-video-sinks/common/window.c
|
||||
72f9a4b823c4162c9f22cedb7c1cb1764d06fcb6 - gst-plugins-nv-video-sinks/common/renderer.h
|
||||
5e13200e9cba5f45d74cf6899dd3356d5f5d1c8e - gst-plugins-nv-video-sinks/common/context.h
|
||||
638b0da4ea65d02818289e89bc1d635ddbcdaec5 - gst-plugins-nv-video-sinks/common/x11/window_x11.h
|
||||
bcce8e13c6a9efb1ee2d2a8ec24e8f7acc7c6581 - gst-plugins-nv-video-sinks/common/context.h
|
||||
1e8544869e1b3720d712cc655b602f1a7559eff7 - gst-plugins-nv-video-sinks/common/renderer/renderer_gl.c
|
||||
f528404a796de5a23dab281588feb72f42343e59 - gst-plugins-nv-video-sinks/common/renderer/renderer_gl.h
|
||||
1e324349b3704719f411b2da8f201ffb30e89c88 - gst-plugins-nv-video-sinks/common/egl/context_egl.c
|
||||
536a072a8ef84b3c91307777f88121fb88df2c4f - gst-plugins-nv-video-sinks/common/egl/context_egl.h
|
||||
b3f1b67cae0b4643f6a676b362ceaa61abc9c40f - gst-plugins-nv-video-sinks/common/x11/display_x11.c
|
||||
d692399c6d94dbc7814770b08baf9271ed97f8e0 - gst-plugins-nv-video-sinks/common/x11/display_x11.h
|
||||
c98945083e215dff26507c1e10b0ebf62a2c6fb7 - gst-plugins-nv-video-sinks/common/x11/window_x11.c
|
||||
536a072a8ef84b3c91307777f88121fb88df2c4f - gst-plugins-nv-video-sinks/common/egl/context_egl.h
|
||||
35b1e9d33b1f8bb8fc7065ab57696696128e042d - gst-plugins-nv-video-sinks/common/egl/context_egl.c
|
||||
707a36267f329bb22afdd19b947be5a99478ec7a - gst-plugins-nv-video-sinks/common/renderer/renderer_gl.c
|
||||
f528404a796de5a23dab281588feb72f42343e59 - gst-plugins-nv-video-sinks/common/renderer/renderer_gl.h
|
||||
9b7125a2d7ebe2ea647c43d2eb43e8d04cd16c47 - gst-plugins-nv-video-sinks/nv3dsink/gstnv3dsink.h
|
||||
a02ed68d624ec0fc13349cbf5c4e675dfdfec1b9 - gst-plugins-nv-video-sinks/nv3dsink/gstnv3dsink.c
|
||||
638b0da4ea65d02818289e89bc1d635ddbcdaec5 - gst-plugins-nv-video-sinks/common/x11/window_x11.h
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) <2018-2025> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -90,13 +91,34 @@ gst_nv_video_context_render_thread_func (GstNvVideoContext * context)
|
||||
|
||||
ret = GST_FLOW_ERROR;
|
||||
|
||||
if (GST_IS_BUFFER (object)) {
|
||||
buf = GST_BUFFER_CAST (item->object);
|
||||
if (GST_IS_CAPS (object)) {
|
||||
GstCaps *caps = GST_CAPS_CAST (object);
|
||||
|
||||
if (context_class->show_frame (context, buf)) {
|
||||
/* Check if caps have changed */
|
||||
if (context->configured_caps) {
|
||||
if (!gst_caps_is_equal (caps, context->configured_caps)) {
|
||||
/* Reset CUDA initialization for re-initialization with new caps */
|
||||
if (context->is_cuda_init) {
|
||||
GstNvVideoContextClass *ctx_class = GST_NV_VIDEO_CONTEXT_GET_CLASS (context);
|
||||
if (ctx_class->cuda_reset_resources) {
|
||||
ctx_class->cuda_reset_resources (context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* NOW update configured caps and info (AFTER comparison) */
|
||||
gst_caps_replace (&context->configured_caps, caps);
|
||||
|
||||
if (!gst_video_info_from_caps (&context->configured_info, caps)) {
|
||||
GST_ERROR_OBJECT (context, "Invalid caps %" GST_PTR_FORMAT, caps);
|
||||
ret = GST_FLOW_ERROR;
|
||||
} else {
|
||||
ret = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
} else if (!object) {
|
||||
/* EOS signal */
|
||||
GST_TRACE_OBJECT (context, "render thread: handle EOS");
|
||||
|
||||
context_class->handle_eos (context);
|
||||
@@ -107,6 +129,14 @@ gst_nv_video_context_render_thread_func (GstNvVideoContext * context)
|
||||
g_mutex_unlock (&context->priv->render_lock);
|
||||
|
||||
GST_TRACE_OBJECT (context, "render thread: handled EOS");
|
||||
ret = GST_FLOW_OK;
|
||||
} else if (GST_IS_BUFFER (object)) {
|
||||
buf = GST_BUFFER_CAST (item->object);
|
||||
|
||||
if (context_class->show_frame (context, buf)) {
|
||||
ret = GST_FLOW_OK;
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
@@ -214,6 +244,11 @@ gst_nv_video_context_finalize (GObject * object)
|
||||
context->display = NULL;
|
||||
}
|
||||
|
||||
if (context->configured_caps) {
|
||||
gst_caps_unref (context->configured_caps);
|
||||
context->configured_caps = NULL;
|
||||
}
|
||||
|
||||
g_mutex_clear (&context->priv->render_lock);
|
||||
g_cond_clear (&context->priv->create_cond);
|
||||
g_cond_clear (&context->priv->quit_cond);
|
||||
@@ -241,12 +276,20 @@ gst_nv_video_context_init (GstNvVideoContext * context)
|
||||
context->priv->eos_handled = FALSE;
|
||||
|
||||
context->using_NVMM = 0;
|
||||
#if defined(NVOS_IS_L4T)
|
||||
// Use this to avoid extra copy for cuda buffer.
|
||||
context->cuda_optimized = 1;
|
||||
#else
|
||||
context->cuda_optimized = 0;
|
||||
#endif
|
||||
context->cuContext = NULL;
|
||||
context->cuResource[0] = NULL;
|
||||
context->cuResource[1] = NULL;
|
||||
context->cuResource[2] = NULL;
|
||||
context->gpu_id = 0;
|
||||
|
||||
context->configured_caps = NULL;
|
||||
|
||||
GST_DEBUG_OBJECT (context, "init done");
|
||||
}
|
||||
|
||||
@@ -260,7 +303,7 @@ GstNvVideoContext *
|
||||
gst_nv_video_context_new (GstNvVideoDisplay * display)
|
||||
{
|
||||
GstNvVideoContext *context = NULL;
|
||||
static volatile gsize debug_init = 0;
|
||||
static gsize debug_init = 0;
|
||||
const gchar *context_name = NULL;
|
||||
|
||||
if (g_once_init_enter (&debug_init)) {
|
||||
@@ -468,3 +511,34 @@ gst_nv_video_context_create (GstNvVideoContext * context)
|
||||
|
||||
return context_class->create (context);
|
||||
}
|
||||
|
||||
void
|
||||
gst_nv_video_context_set_configured_caps (GstNvVideoContext * context, GstCaps * caps)
|
||||
{
|
||||
g_return_if_fail (GST_IS_NV_VIDEO_CONTEXT (context));
|
||||
|
||||
/* Send caps to render thread for comparison and processing */
|
||||
g_mutex_lock (&context->priv->render_lock);
|
||||
if (context->priv->render_thread_active && context->priv->queue) {
|
||||
GstDataQueueItem *item = g_slice_new (GstDataQueueItem);
|
||||
item->destroy = (GDestroyNotify) gst_nv_video_context_queue_free_item;
|
||||
item->object = gst_mini_object_ref (GST_MINI_OBJECT_CAST (caps));
|
||||
item->size = 0;
|
||||
item->duration = GST_CLOCK_TIME_NONE;
|
||||
item->visible = TRUE;
|
||||
|
||||
if (!gst_data_queue_push (context->priv->queue, item)) {
|
||||
item->destroy (item);
|
||||
}
|
||||
} else {
|
||||
/* If no render thread, update directly */
|
||||
gst_caps_replace (&context->configured_caps, caps);
|
||||
|
||||
if (!gst_video_info_from_caps (&context->configured_info, caps)) {
|
||||
GST_ERROR_OBJECT (context, "Invalid caps %" GST_PTR_FORMAT, caps);
|
||||
}
|
||||
}
|
||||
g_mutex_unlock (&context->priv->render_lock);
|
||||
|
||||
GST_DEBUG_OBJECT (context, "set configured caps %" GST_PTR_FORMAT, caps);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) <2018-2025> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -68,6 +69,7 @@ struct _GstNvVideoContextClass
|
||||
void (*handle_eos) (GstNvVideoContext * context);
|
||||
void (*handle_drc) (GstNvVideoContext * context);
|
||||
void (*handle_tearing) (GstNvVideoContext * context);
|
||||
void (*cuda_reset_resources) (GstNvVideoContext * context);
|
||||
};
|
||||
|
||||
struct _GstNvVideoContext
|
||||
@@ -82,6 +84,7 @@ struct _GstNvVideoContext
|
||||
GstNvVideoContextPrivate *priv;
|
||||
|
||||
guint using_NVMM;
|
||||
guint cuda_optimized;
|
||||
GstVideoInfo configured_info;
|
||||
|
||||
gboolean is_cuda_init;
|
||||
@@ -89,6 +92,8 @@ struct _GstNvVideoContext
|
||||
CUgraphicsResource cuResource[3];
|
||||
unsigned int gpu_id;
|
||||
|
||||
GstCaps *configured_caps;
|
||||
|
||||
};
|
||||
|
||||
GST_EXPORT
|
||||
@@ -113,6 +118,8 @@ gboolean gst_nv_video_context_create_render_thread (GstNvVideoContext * context)
|
||||
GST_EXPORT
|
||||
void gst_nv_video_context_destroy_render_thread (GstNvVideoContext * context);
|
||||
GST_EXPORT
|
||||
void gst_nv_video_context_set_configured_caps (GstNvVideoContext * context, GstCaps * caps);
|
||||
GST_EXPORT
|
||||
GstNvVideoContextType gst_nv_video_context_get_handle_type (GstNvVideoContext * context);
|
||||
|
||||
GType gst_nv_video_context_get_type (void);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) <2018-2025> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -59,10 +60,6 @@ gst_nv_video_display_create_context (GstNvVideoDisplay * display,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_nv_video_context_create (context)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*ptr_context = context;
|
||||
|
||||
GST_DEBUG_OBJECT (display, "created context %" GST_PTR_FORMAT, context);
|
||||
@@ -84,7 +81,7 @@ gst_nv_video_display_class_init (GstNvVideoDisplayClass * klass)
|
||||
gboolean
|
||||
gst_nv_video_display_new (GstNvVideoDisplay ** display)
|
||||
{
|
||||
static volatile gsize debug_init = 0;
|
||||
static gsize debug_init = 0;
|
||||
const gchar *winsys_name = NULL;
|
||||
|
||||
if (g_once_init_enter (&debug_init)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) <2018-2025> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -104,7 +105,7 @@ gst_nv_video_context_egl_show_frame (GstNvVideoContext * context,
|
||||
}
|
||||
}
|
||||
|
||||
if (context->using_NVMM) {
|
||||
if (context->using_NVMM && !context->cuda_optimized) {
|
||||
if (!context->is_cuda_init) {
|
||||
if (!gst_nv_video_renderer_cuda_init (context, context_egl->renderer)) {
|
||||
GST_ERROR_OBJECT (context, "cuda init failed");
|
||||
@@ -160,7 +161,7 @@ gst_nv_video_context_egl_show_frame (GstNvVideoContext * context,
|
||||
is_cuda_mem = FALSE;
|
||||
}
|
||||
|
||||
if (is_cuda_mem == FALSE) {
|
||||
if (is_cuda_mem == FALSE || context->cuda_optimized) {
|
||||
/* NvBufSurface - NVMM buffer type are handled here */
|
||||
if (in_surface->batchSize != 1) {
|
||||
GST_ERROR_OBJECT (context,"ERROR: Batch size not 1\n");
|
||||
@@ -298,7 +299,7 @@ gst_nv_video_context_egl_cleanup (GstNvVideoContext * context)
|
||||
context_egl->display, context_egl->surface, context_egl->context);
|
||||
|
||||
if (context_egl->renderer) {
|
||||
if (context->using_NVMM) {
|
||||
if (context->using_NVMM && !context->cuda_optimized) {
|
||||
gst_nv_video_renderer_cuda_cleanup (context, context_egl->renderer);
|
||||
}
|
||||
gst_nv_video_renderer_cleanup (context_egl->renderer);
|
||||
@@ -329,6 +330,17 @@ gst_nv_video_context_egl_cleanup (GstNvVideoContext * context)
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_nv_video_context_egl_cuda_reset_resources (GstNvVideoContext * context)
|
||||
{
|
||||
GstNvVideoContextEgl *context_egl = GST_NV_VIDEO_CONTEXT_EGL (context);
|
||||
|
||||
if (context_egl->renderer && context->is_cuda_init) {
|
||||
gst_nv_video_renderer_cuda_reset_resources (context, context_egl->renderer);
|
||||
context->is_cuda_init = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_nv_video_context_egl_getcaps (GstNvVideoContext * context)
|
||||
{
|
||||
@@ -382,6 +394,8 @@ gst_nv_video_context_egl_class_init (GstNvVideoContextEglClass * klass)
|
||||
GST_DEBUG_FUNCPTR (gst_nv_video_context_egl_handle_drc);
|
||||
context_class->handle_tearing =
|
||||
GST_DEBUG_FUNCPTR (gst_nv_video_context_egl_handle_tearing);
|
||||
context_class->cuda_reset_resources =
|
||||
GST_DEBUG_FUNCPTR (gst_nv_video_context_egl_cuda_reset_resources);
|
||||
context_class->cleanup = GST_DEBUG_FUNCPTR (gst_nv_video_context_egl_cleanup);
|
||||
|
||||
G_OBJECT_CLASS (klass)->finalize = gst_nv_video_context_egl_finalize;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -44,7 +44,7 @@ GstNvVideoRenderer *
|
||||
gst_nv_video_renderer_new (GstNvVideoContext * context, const char *name)
|
||||
{
|
||||
GstNvVideoRenderer *renderer = NULL;
|
||||
static volatile gsize debug_init = 0;
|
||||
static gsize debug_init = 0;
|
||||
|
||||
if (g_once_init_enter (&debug_init)) {
|
||||
GST_DEBUG_CATEGORY_INIT (gst_debug_nv_video_renderer, "nvvideorenderer", 0,
|
||||
@@ -94,6 +94,18 @@ gst_nv_video_renderer_cuda_cleanup (GstNvVideoContext * context, GstNvVideoRende
|
||||
renderer_class->cuda_cleanup (context, renderer);
|
||||
}
|
||||
|
||||
void
|
||||
gst_nv_video_renderer_cuda_reset_resources (GstNvVideoContext * context, GstNvVideoRenderer * renderer)
|
||||
{
|
||||
GstNvVideoRendererClass *renderer_class;
|
||||
|
||||
renderer_class = GST_NV_VIDEO_RENDERER_GET_CLASS (renderer);
|
||||
|
||||
if (renderer_class->cuda_reset_resources) {
|
||||
renderer_class->cuda_reset_resources (context, renderer);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_nv_video_renderer_cleanup (GstNvVideoRenderer * renderer)
|
||||
{
|
||||
|
||||
@@ -44,6 +44,7 @@ struct _GstNvVideoRendererClass
|
||||
|
||||
gboolean (*cuda_init) (GstNvVideoContext *context, GstNvVideoRenderer * renderer);
|
||||
void (*cuda_cleanup) (GstNvVideoContext *context, GstNvVideoRenderer * renderer);
|
||||
void (*cuda_reset_resources) (GstNvVideoContext *context, GstNvVideoRenderer * renderer);
|
||||
gboolean (*setup) (GstNvVideoRenderer * renderer);
|
||||
void (*cleanup) (GstNvVideoRenderer * renderer);
|
||||
void (*update_viewport) (GstNvVideoRenderer * renderer, int width, int height);
|
||||
@@ -71,6 +72,9 @@ gboolean gst_nv_video_renderer_cuda_init (GstNvVideoContext * context, GstNvVide
|
||||
GST_EXPORT
|
||||
void gst_nv_video_renderer_cuda_cleanup (GstNvVideoContext * context, GstNvVideoRenderer * renderer);
|
||||
|
||||
GST_EXPORT
|
||||
void gst_nv_video_renderer_cuda_reset_resources (GstNvVideoContext * context, GstNvVideoRenderer * renderer);
|
||||
|
||||
GST_EXPORT
|
||||
gboolean gst_nv_video_renderer_setup (GstNvVideoRenderer * renderer);
|
||||
|
||||
|
||||
@@ -648,7 +648,11 @@ gst_nv_video_renderer_gl_cuda_init (GstNvVideoContext * context, GstNvVideoRende
|
||||
GstVideoFormat videoFormat;
|
||||
|
||||
cuInit(0);
|
||||
#if CUDA_VERSION >= 13000
|
||||
result = cuCtxCreate(&pctx, NULL, 0, 0);
|
||||
#else
|
||||
result = cuCtxCreate(&pctx, 0, 0);
|
||||
#endif
|
||||
if (result != CUDA_SUCCESS) {
|
||||
g_print ("cuCtxCreate failed with error(%d) %s\n", result, __func__);
|
||||
return FALSE;
|
||||
@@ -760,6 +764,23 @@ gst_nv_video_renderer_gl_cuda_init (GstNvVideoContext * context, GstNvVideoRende
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_nv_video_renderer_gl_cuda_reset_resources (GstNvVideoContext * context, GstNvVideoRenderer * renderer)
|
||||
{
|
||||
CUresult result;
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (context->cuResource[i]) {
|
||||
result = cuGraphicsUnregisterResource (context->cuResource[i]);
|
||||
if (result != CUDA_SUCCESS) {
|
||||
GST_ERROR_OBJECT (context, "cuGraphicsUnregisterResource failed with error(%d)", result);
|
||||
}
|
||||
context->cuResource[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_nv_video_renderer_gl_cuda_cleanup (GstNvVideoContext * context, GstNvVideoRenderer * renderer)
|
||||
{
|
||||
@@ -1515,6 +1536,8 @@ gst_nv_video_renderer_gl_class_init (GstNvVideoRendererGlClass * klass)
|
||||
GST_DEBUG_FUNCPTR (gst_nv_video_renderer_gl_cuda_init);
|
||||
renderer_class->cuda_cleanup =
|
||||
GST_DEBUG_FUNCPTR (gst_nv_video_renderer_gl_cuda_cleanup);
|
||||
renderer_class->cuda_reset_resources =
|
||||
GST_DEBUG_FUNCPTR (gst_nv_video_renderer_gl_cuda_reset_resources);
|
||||
renderer_class->setup = GST_DEBUG_FUNCPTR (gst_nv_video_renderer_gl_setup);
|
||||
renderer_class->cleanup =
|
||||
GST_DEBUG_FUNCPTR (gst_nv_video_renderer_gl_cleanup);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -54,7 +54,7 @@ GstNvVideoWindow *
|
||||
gst_nv_video_window_new (GstNvVideoDisplay * display)
|
||||
{
|
||||
GstNvVideoWindow *window = NULL;
|
||||
static volatile gsize debug_init = 0;
|
||||
static gsize debug_init = 0;
|
||||
const gchar *winsys_name = NULL;
|
||||
|
||||
if (g_once_init_enter (&debug_init)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) <2018-2025> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -331,8 +332,10 @@ gst_nv3dsink_get_caps (GstBaseSink * bsink, GstCaps * filter)
|
||||
|
||||
caps = gst_nv_video_context_get_caps (nv3dsink->context);
|
||||
if (caps) {
|
||||
tmp = result;
|
||||
result = gst_caps_intersect (result, caps);
|
||||
gst_caps_unref (caps);
|
||||
gst_caps_unref (tmp);
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (bsink, "returning caps: %" GST_PTR_FORMAT, result);
|
||||
@@ -352,17 +355,24 @@ gst_nv3dsink_set_caps (GstBaseSink * bsink, GstCaps * caps)
|
||||
nv3dsink = GST_NV3DSINK (bsink);
|
||||
|
||||
if (!nv3dsink->context || !nv3dsink->display) {
|
||||
GST_ERROR_OBJECT (nv3dsink, "context or display not ready");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (bsink, "set caps with %" GST_PTR_FORMAT, caps);
|
||||
|
||||
if (nv3dsink->configured_caps) {
|
||||
if (gst_caps_can_intersect (caps, nv3dsink->configured_caps)) {
|
||||
if (gst_caps_is_equal (caps, nv3dsink->configured_caps)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure render thread is active before setting caps
|
||||
if (!gst_nv_video_context_create (nv3dsink->context)) {
|
||||
GST_ERROR_OBJECT (nv3dsink, "failed to create render thread during caps negotiation");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
features = gst_caps_get_features (caps, 0);
|
||||
if (gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_NVMM)) {
|
||||
nv3dsink->context->using_NVMM = 1;
|
||||
@@ -422,6 +432,8 @@ gst_nv3dsink_set_caps (GstBaseSink * bsink, GstCaps * caps)
|
||||
|
||||
gst_caps_replace (&nv3dsink->configured_caps, caps);
|
||||
|
||||
gst_nv_video_context_set_configured_caps (nv3dsink->context, caps);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -447,7 +459,15 @@ gst_nv3dsink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
||||
GST_TRACE_OBJECT (nv3dsink, "show buffer %p, window size:%ux%u", buf,
|
||||
GST_VIDEO_SINK_WIDTH (nv3dsink), GST_VIDEO_SINK_HEIGHT (nv3dsink));
|
||||
|
||||
// Try to create render thread if not already created
|
||||
// This ensures render thread is ready even if caps negotiation hasn't completed
|
||||
if (!gst_nv_video_context_create (nv3dsink->context)) {
|
||||
GST_DEBUG_OBJECT (nv3dsink, "failed to create render thread, dropping frame");
|
||||
return GST_FLOW_FLUSHING;
|
||||
}
|
||||
|
||||
if (!gst_nv_video_context_show_frame (nv3dsink->context, buf)) {
|
||||
GST_DEBUG_OBJECT (nv3dsink, "render thread not ready, dropping frame");
|
||||
return GST_FLOW_FLUSHING;
|
||||
}
|
||||
|
||||
|
||||
267
nvbufsurface.h
267
nvbufsurface.h
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: LicenseRef-NvidiaProprietary
|
||||
*
|
||||
* NVIDIA Corporation and its licensors retain all intellectual property
|
||||
* and proprietary rights in and to this software, related documentation
|
||||
* and any modifications thereto. Any use, reproduction, disclosure or
|
||||
* distribution of this software and related documentation without an express
|
||||
* license agreement from NVIDIA Corporation is strictly prohibited.
|
||||
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
|
||||
* property and proprietary rights in and to this material, related
|
||||
* documentation and any modifications thereto. Any use, reproduction,
|
||||
* disclosure or distribution of this material and related documentation
|
||||
* without an express license agreement from NVIDIA CORPORATION or
|
||||
* its affiliates is strictly prohibited.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -278,6 +280,38 @@ typedef enum
|
||||
NVBUF_COLOR_FORMAT_NV12_12LE_709,
|
||||
/** Specifies BT.709 colorspace - Y/CbCr ER 4:2:0 12-bit multi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV12_12LE_709_ER,
|
||||
/** Specifies 8 bit GRAY scale ER - single plane */
|
||||
NVBUF_COLOR_FORMAT_GRAY8_ER,
|
||||
/** Specifies BT.709 colorspace - Y/CbCr 4:2:2 planar */
|
||||
NVBUF_COLOR_FORMAT_UYVY_709,
|
||||
/** Specifies BT.709 colorspace - Y/CbCr ER 4:2:2 planar */
|
||||
NVBUF_COLOR_FORMAT_UYVY_709_ER,
|
||||
/** Specifies BT.2020 colorspace - Y/CbCr 4:2:2 planar */
|
||||
NVBUF_COLOR_FORMAT_UYVY_2020,
|
||||
/** Specifies 16 bit GRAY scale - single plane */
|
||||
NVBUF_COLOR_FORMAT_GRAY16_LE,
|
||||
/** Specifies 64 bit BGRA (B16 G16 R16 A16) interleaved */
|
||||
NVBUF_COLOR_FORMAT_BGRA64_LE,
|
||||
/** Specifies BT.2020 colorspace - Y/CbCr 4:2:2 multi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_2020,
|
||||
/** Specifies BT.601_ER colorspace - Y/CbCr 4:2:2 10-bit semi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_10LE_ER,
|
||||
/** Specifies BT.709 colorspace - Y/CbCr 4:2:2 10-bit semi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_10LE_709,
|
||||
/** Specifies BT.709_ER colorspace - Y/CbCr 4:2:2 10-bit semi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_10LE_709_ER,
|
||||
/** Specifies BT.2020 colorspace - Y/CbCr 4:2:2 10-bit semi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_10LE_2020,
|
||||
/** Specifies BT.601 colorspace - Y/CbCr 4:2:2 12-bit semi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_12LE,
|
||||
/** Specifies BT.601_ER colorspace - Y/CbCr 4:2:2 12-bit semi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_12LE_ER,
|
||||
/** Specifies BT.709 colorspace - Y/CbCr 4:2:2 12-bit semi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_12LE_709,
|
||||
/** Specifies BT.709_ER colorspace - Y/CbCr 4:2:2 12-bit semi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_12LE_709_ER,
|
||||
/** Specifies BT.2020 colorspace - Y/CbCr 4:2:2 12-bit semi-planar. */
|
||||
NVBUF_COLOR_FORMAT_NV16_12LE_2020,
|
||||
NVBUF_COLOR_FORMAT_LAST
|
||||
} NvBufSurfaceColorFormat;
|
||||
|
||||
@@ -341,7 +375,9 @@ typedef struct NvBufSurfacePlaneParamsEx
|
||||
uint32_t physicaladdress[NVBUF_MAX_PLANES];
|
||||
/** flags associated with planes */
|
||||
uint64_t flags[NVBUF_MAX_PLANES];
|
||||
|
||||
/** DRM modifier for plane */
|
||||
uint64_t drmModifier[NVBUF_MAX_PLANES];
|
||||
/** Holds the reserved space for future use. */
|
||||
void * _reserved[STRUCTURE_PADDING * NVBUF_MAX_PLANES];
|
||||
} NvBufSurfacePlaneParamsEx;
|
||||
|
||||
@@ -364,19 +400,25 @@ typedef struct NvBufSurfacePlaneParams
|
||||
uint32_t psize[NVBUF_MAX_PLANES];
|
||||
/** Holds the number of bytes occupied by a pixel in each plane. */
|
||||
uint32_t bytesPerPix[NVBUF_MAX_PLANES];
|
||||
|
||||
/** Holds the reserved space for future use. */
|
||||
void * _reserved[STRUCTURE_PADDING * NVBUF_MAX_PLANES];
|
||||
} NvBufSurfacePlaneParams;
|
||||
|
||||
|
||||
/**
|
||||
* Holds Chroma Subsampling parameters for NvBufSurface allocation.
|
||||
* The members chromaLocHoriz and chromaLocVert accept these values:
|
||||
* 0: Left horizontal or top vertical position
|
||||
* 1: Center horizontal or center vertical position
|
||||
* 2: Right horizontal or bottom vertical position
|
||||
*/
|
||||
typedef struct NvBufSurfaceChromaSubsamplingParams
|
||||
{
|
||||
/** location settings */
|
||||
uint8_t chromaLocHoriz;
|
||||
uint8_t chromaLocVert;
|
||||
/** Reserved for alignment */
|
||||
uint8_t _reserved[6];
|
||||
} NvBufSurfaceChromaSubsamplingParams;
|
||||
|
||||
/**
|
||||
@@ -402,6 +444,8 @@ typedef struct NvBufSurfaceCreateParams {
|
||||
NvBufSurfaceLayout layout;
|
||||
/** Holds the type of memory to be allocated. */
|
||||
NvBufSurfaceMemType memType;
|
||||
/** Holds the reserved space for future use. */
|
||||
void * _reserved[STRUCTURE_PADDING];
|
||||
} NvBufSurfaceCreateParams;
|
||||
|
||||
/**
|
||||
@@ -409,24 +453,24 @@ typedef struct NvBufSurfaceCreateParams {
|
||||
* (Applicable for NvBufSurfaceAllocate API)
|
||||
*/
|
||||
typedef struct NvBufSurfaceAllocateParams {
|
||||
/** Hold legacy NvBufSurface creation parameters */
|
||||
/** Hold legacy NvBufSurface creation parameters */
|
||||
NvBufSurfaceCreateParams params;
|
||||
/** Display scan format */
|
||||
/** Display scan format */
|
||||
NvBufSurfaceDisplayScanFormat displayscanformat;
|
||||
/** Chroma Subsampling parameters */
|
||||
/** Chroma Subsampling parameters */
|
||||
NvBufSurfaceChromaSubsamplingParams chromaSubsampling;
|
||||
/** components tag to be used for memory allocation */
|
||||
/** components tag to be used for memory allocation */
|
||||
NvBufSurfaceTag memtag;
|
||||
/** disable pitch padding allocation only applicable for cuda and system memory allocation
|
||||
/** disable pitch padding allocation only applicable for cuda and system memory allocation
|
||||
pitch would be width times bytes per pixel for the plane, for odd width it would be
|
||||
multiple of 2, also note for some non standard video resolution cuda kernels may fail
|
||||
due to unaligned pitch
|
||||
*/
|
||||
*/
|
||||
bool disablePitchPadding;
|
||||
/** Used void* from custom param for 64 bit machine, using other uint32_t param */
|
||||
/** Used void* from custom param for 64 bit machine, using other uint32_t param */
|
||||
uint32_t _reservedParam;
|
||||
|
||||
void * _reserved[STRUCTURE_PADDING-1];
|
||||
/** Holds the reserved space for future use. */
|
||||
void * _reserved[STRUCTURE_PADDING];
|
||||
} NvBufSurfaceAllocateParams;
|
||||
|
||||
/**
|
||||
@@ -437,7 +481,11 @@ typedef struct NvBufSurfaceMappedAddr {
|
||||
void * addr[NVBUF_MAX_PLANES];
|
||||
/** Holds a pointer to a mapped EGLImage. */
|
||||
void *eglImage;
|
||||
|
||||
/** Holds a pointer to a mapped NVRM memory */
|
||||
void *nvmmPtr;
|
||||
/** Holds a pointer to a mapped CUDA memory */
|
||||
void *cudaPtr;
|
||||
/** Holds the reserved space for future use. */
|
||||
void * _reserved[STRUCTURE_PADDING];
|
||||
} NvBufSurfaceMappedAddr;
|
||||
|
||||
@@ -462,6 +510,32 @@ typedef struct NvBufSurfaceParamsEx {
|
||||
void * _reserved[STRUCTURE_PADDING];
|
||||
} NvBufSurfaceParamsEx;
|
||||
|
||||
/**
|
||||
* Holds information of CUDA buffer.
|
||||
* Applicable for tegra OpenRM only.
|
||||
*/
|
||||
typedef struct NvBufSurfaceCudaBuffer {
|
||||
/**
|
||||
* Holds a base pointer to allocated CUDA memory.
|
||||
* It is different from dataPtr when CUDA allocated
|
||||
* address is not page aligned for image buffers.
|
||||
* It is same as dataPtr for other buffers.
|
||||
*/
|
||||
void *basePtr;
|
||||
/**
|
||||
* Holds a page aligned data pointer to CUDA memory for image buffers
|
||||
* if CUDA allocated address is not page aligned.
|
||||
* It is same as basePtr for other buffers.
|
||||
*/
|
||||
void *dataPtr;
|
||||
/** Holds a pointer to external CUDA memory for imported CUDA buffers */
|
||||
void *extMem;
|
||||
/** Holds a pointer to external CUDA mipmaped array for imported CUDA buffers */
|
||||
void *mipmap;
|
||||
/** Reserved */
|
||||
uint8_t reserved[64];
|
||||
} NvBufSurfaceCudaBuffer;
|
||||
|
||||
/**
|
||||
* Hold the information of single buffer in the batch.
|
||||
*/
|
||||
@@ -491,8 +565,10 @@ typedef struct NvBufSurfaceParams {
|
||||
NvBufSurfaceMappedAddr mappedAddr;
|
||||
/** pointers of extended parameters of single buffer in the batch.*/
|
||||
NvBufSurfaceParamsEx *paramex;
|
||||
/** Holds a pointer to CUDA buffer. Applicable for only CUDA Device and CUDA Host memory on tegra OpenRM.*/
|
||||
NvBufSurfaceCudaBuffer *cudaBuffer;
|
||||
|
||||
void * _reserved[STRUCTURE_PADDING - 1];
|
||||
void * _reserved[STRUCTURE_PADDING];
|
||||
} NvBufSurfaceParams;
|
||||
|
||||
/**
|
||||
@@ -513,6 +589,8 @@ typedef struct NvBufSurface {
|
||||
NvBufSurfaceMemType memType;
|
||||
/** Holds a pointer to an array of batched buffers. */
|
||||
NvBufSurfaceParams *surfaceList;
|
||||
/** Holds a flag for Imported buffer. */
|
||||
bool isImportedBuf;
|
||||
|
||||
void * _reserved[STRUCTURE_PADDING];
|
||||
} NvBufSurface;
|
||||
@@ -542,6 +620,23 @@ typedef struct NvBufSurfaceMapPlaneParams
|
||||
uint8_t reserved[64];
|
||||
} NvBufSurfaceMapPlaneParams;
|
||||
|
||||
/**
|
||||
* CUDA IPC memory handle for NvBufSurface
|
||||
*/
|
||||
typedef struct NvBufSurfaceCudaIpcMemHandle_t
|
||||
{
|
||||
char reserved[64];
|
||||
} NvBufSurfaceCudaIpcMemHandle;
|
||||
|
||||
/**
|
||||
* The extended map parameters NvBufSurface
|
||||
*/
|
||||
typedef struct NvBufSurfaceExtendedMapParams_t
|
||||
{
|
||||
NvBufSurfaceCudaIpcMemHandle memHandle;
|
||||
void *reserved[64];
|
||||
} NvBufSurfaceExtendedMapParams;
|
||||
|
||||
/**
|
||||
* Holds buffer parameters to map the buffer received from another process.
|
||||
*/
|
||||
@@ -566,9 +661,44 @@ typedef struct NvBufSurfaceMapParams {
|
||||
NvBufSurfaceChromaSubsamplingParams chromaSubsampling;
|
||||
/** Holds plane parameters */
|
||||
NvBufSurfaceMapPlaneParams planes[NVBUF_MAX_PLANES];
|
||||
/** Holds the extended Map parameters */
|
||||
void *extendedMapParams;
|
||||
/** Holds the reserved space for future use. */
|
||||
void *_reserved[STRUCTURE_PADDING];
|
||||
} NvBufSurfaceMapParams;
|
||||
|
||||
/**
|
||||
* Holds information about mapped CUDA buffer
|
||||
*/
|
||||
typedef struct NvBufSurfaceNvmmBuffer {
|
||||
/** Holds a pointer to mapped nvmm memory */
|
||||
void *dataPtr;
|
||||
/** Holds a DMABUF FD */
|
||||
uint64_t bufferDesc;
|
||||
/** Reserved */
|
||||
uint8_t reserved[64];
|
||||
} NvBufSurfaceMapParams;
|
||||
} NvBufSurfaceNvmmBuffer;
|
||||
|
||||
/**
|
||||
* Defines the type of underlying kernel driver detected for GPU access.
|
||||
*/
|
||||
typedef enum {
|
||||
NVBUF_DRIVER_TYPE_UNKNOWN = 0,
|
||||
NVBUF_DRIVER_TYPE_NVGPU,
|
||||
NVBUF_DRIVER_TYPE_RM
|
||||
} NvBufSurfaceDriverType;
|
||||
|
||||
/**
|
||||
* Holds information about the underlying device.
|
||||
*/
|
||||
typedef struct NvBufSurfaceDeviceInfo {
|
||||
/** The detected device type (nvgpu, OpenRM, etc.). */
|
||||
NvBufSurfaceDriverType driverType;
|
||||
/** Indicates if VIC is present on the platform. */
|
||||
bool isVicPresent;
|
||||
/** Reserved for future use. */
|
||||
uint8_t reserved[64];
|
||||
} NvBufSurfaceDeviceInfo;
|
||||
|
||||
/**
|
||||
* \brief Allocates a batch of buffers.
|
||||
@@ -699,7 +829,7 @@ int NvBufSurfaceCopy (NvBufSurface *srcSurf, NvBufSurface *dstSurf);
|
||||
* This function can be used to copy plane memory content from source raw buffer pointer
|
||||
* to specific destination batch buffer of supported memory type.
|
||||
*
|
||||
* @param[in] surf pointer to NvBufSurface structure.
|
||||
* @param[in] Surf pointer to NvBufSurface structure.
|
||||
* @param[in] index index of buffer in the batch.
|
||||
* @param[in] plane index of plane in buffer.
|
||||
* @param[in] out_width aligned width of the raw data plane.
|
||||
@@ -708,7 +838,7 @@ int NvBufSurfaceCopy (NvBufSurface *srcSurf, NvBufSurface *dstSurf);
|
||||
*
|
||||
* @return 0 for success, -1 for failure.
|
||||
*/
|
||||
int NvBufSurface2Raw (NvBufSurface *Surf, unsigned int index, unsigned int plane, unsigned int outwidth, unsigned int outheight, unsigned char *ptr);
|
||||
int NvBufSurface2Raw (NvBufSurface *Surf, unsigned int index, unsigned int plane, unsigned int out_width, unsigned int out_height, unsigned char *ptr);
|
||||
|
||||
/**
|
||||
* \brief Copies the raw buffer plane memory content to the NvBufSurface plane memory of a specific
|
||||
@@ -722,11 +852,11 @@ int NvBufSurface2Raw (NvBufSurface *Surf, unsigned int index, unsigned int plane
|
||||
* @param[in] plane index of plane in buffer.
|
||||
* @param[in] in_width aligned width of the raw data plane.
|
||||
* @param[in] in_height aligned height of the raw data plane.
|
||||
* @param[in] surf pointer to NvBufSurface structure.
|
||||
* @param[in] Surf pointer to NvBufSurface structure.
|
||||
*
|
||||
* @return 0 for success, -1 for failure.
|
||||
*/
|
||||
int Raw2NvBufSurface (unsigned char *ptr, unsigned int index, unsigned int plane, unsigned int inwidth, unsigned int inheight, NvBufSurface *Surf);
|
||||
int Raw2NvBufSurface (unsigned char *ptr, unsigned int index, unsigned int plane, unsigned int in_width, unsigned int in_height, NvBufSurface *Surf);
|
||||
|
||||
/**
|
||||
* Syncs the HW memory cache for the CPU.
|
||||
@@ -850,7 +980,94 @@ int NvBufSurfaceImport (NvBufSurface **out_nvbuf_surf, const NvBufSurfaceMapPara
|
||||
*/
|
||||
int NvBufSurfaceGetMapParams (const NvBufSurface *surf, int index, NvBufSurfaceMapParams *params);
|
||||
|
||||
/** @} */
|
||||
/**
|
||||
* \brief Creates an CUDA buffer from the memory of one or more
|
||||
* \ref NvBufSurface buffers.
|
||||
*
|
||||
* Only memory type \ref NVBUF_MEM_SURFACE_ARRAY is supported.
|
||||
*
|
||||
* This function returns the created CUDA buffer by storing its address at
|
||||
* \a surf->surfaceList->mappedAddr->cudaPtr. (\a surf is a pointer to
|
||||
* an NvBufSurface. \a surfaceList is a pointer to an \ref NvBufSurfaceParams.
|
||||
* \a mappedAddr is a pointer to an \ref NvBufSurfaceMappedAddr.
|
||||
* \a cudaPtr is a pointer to an \ref NvBufSurfaceCudaBuffer.
|
||||
*
|
||||
* You can use this function in scenarios where a CUDA operation on Jetson
|
||||
* hardware memory (identified by \ref NVBUF_MEM_SURFACE_ARRAY) is required.
|
||||
* The NvBufSurfaceCudaBuffer struct provided by this function can be used
|
||||
* to get dataPtr of CUDA memory.
|
||||
*
|
||||
* @param[in,out] surf A pointer to an NvBufSurface structure. The function
|
||||
* stores a pointer to the created CUDA buffer in
|
||||
* a descendant of this structure; see the notes above.
|
||||
* @param[in] index Index of a buffer in the batch. -1 specifies all buffers
|
||||
* in the batch.
|
||||
*
|
||||
* @return 0 for success, or -1 otherwise.
|
||||
*/
|
||||
int NvBufSurfaceMapCudaBuffer (NvBufSurface *surf, int index);
|
||||
|
||||
/**
|
||||
* \brief Destroys the previously created CUDA buffer.
|
||||
*
|
||||
* @param[in] surf A pointer to an \ref NvBufSurface structure.
|
||||
* @param[in] index The index of a buffer in the batch. -1 specifies all
|
||||
* buffers in the batch.
|
||||
*
|
||||
* @return 0 if successful, or -1 otherwise.
|
||||
*/
|
||||
int NvBufSurfaceUnMapCudaBuffer (NvBufSurface *surf, int index);
|
||||
|
||||
/**
|
||||
* \brief Creates an NVMM buffer from the memory of one or more
|
||||
* \ref NvBufSurface buffers.
|
||||
*
|
||||
* Only memory type \ref NVBUF_MEM_CUDA_DEVICE and \ref NVBUF_MEM_CUDA_PINNED
|
||||
* are supported.
|
||||
*
|
||||
* This function returns the created NVMM buffer by storing its address at
|
||||
* \a surf->surfaceList->mappedAddr->nvmmPtr. (\a surf is a pointer to
|
||||
* an NvBufSurface. \a surfaceList is a pointer to an \ref NvBufSurfaceParams.
|
||||
* \a mappedAddr is a pointer to an \ref NvBufSurfaceMappedAddr.
|
||||
* \a nvmmPtr is a pointer to NVMM buffer of memory type \ref NVBUF_MEM_SURFACE_ARRAY.
|
||||
*
|
||||
* You can use this function in scenarios where a NVBUF_MEM_SURFACE_ARRAY operation
|
||||
* on Jetson hardware memory identified by \ref NVBUF_MEM_CUDA_DEVICE and
|
||||
* \ref NVBUF_MEM_CUDA_PINNED are required.
|
||||
*
|
||||
* @param[in,out] surf A pointer to an NvBufSurface structure. The function
|
||||
* stores a pointer to the created NVMM buffer in
|
||||
* a descendant of this structure; see the notes above.
|
||||
* @param[in] index Index of a buffer in the batch. -1 specifies all buffers
|
||||
* in the batch.
|
||||
*
|
||||
* @return 0 for success, or -1 otherwise.
|
||||
*/
|
||||
int NvBufSurfaceMapNvmmBuffer (NvBufSurface *surf, int index);
|
||||
|
||||
/**
|
||||
* \brief Destroys the previously created NVMM buffer.
|
||||
*
|
||||
* @param[in] surf A pointer to an \ref NvBufSurface structure.
|
||||
* @param[in] index The index of a buffer in the batch. -1 specifies all
|
||||
* buffers in the batch.
|
||||
*
|
||||
* @return 0 if successful, or -1 otherwise.
|
||||
*/
|
||||
int NvBufSurfaceUnMapNvmmBuffer (NvBufSurface *surf, int index);
|
||||
|
||||
/**
|
||||
* \brief Retrieves information about the underlying GPU device driver.
|
||||
*
|
||||
* @param[out] info Pointer to NvBufSurfaceDeviceInfo structure.
|
||||
*
|
||||
* @return 0 if successful, or -1 otherwise.
|
||||
*
|
||||
* This function attempts to determine if the system is using 'nvgpu' or
|
||||
* an OpenRM-based driver by checking loaded kernel modules. Also it checks
|
||||
* if VIC is present on the platform.
|
||||
*/
|
||||
int NvBufSurfaceGetDeviceInfo (NvBufSurfaceDeviceInfo *info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
jetson_35.5_APT1
|
||||
daily-2025.08.25.1_l4t/l4t-r38.2
|
||||
|
||||
Reference in New Issue
Block a user