mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
cuda: Move cuda debug helper function to .cpp
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4729>
This commit is contained in:
parent
c40f6dac57
commit
58b166453d
2 changed files with 42 additions and 35 deletions
|
@ -1671,3 +1671,34 @@ gst_cuda_create_user_token (void)
|
|||
|
||||
return user_token.fetch_add (1);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gst_cuda_debug:
|
||||
* @result: CUDA result code
|
||||
* @cat: a #GstDebugCategory
|
||||
* @file: the file that checking the result code
|
||||
* @function: the function that checking the result code
|
||||
* @line: the line that checking the result code
|
||||
*
|
||||
* Returns: %TRUE if CUDA device API call result is CUDA_SUCCESS
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
gboolean
|
||||
_gst_cuda_debug (CUresult result, GstDebugCategory * cat,
|
||||
const gchar * file, const gchar * function, gint line)
|
||||
{
|
||||
if (result != CUDA_SUCCESS) {
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
const gchar *_error_name, *_error_text;
|
||||
CuGetErrorName (result, &_error_name);
|
||||
CuGetErrorString (result, &_error_text);
|
||||
gst_debug_log (cat, GST_LEVEL_WARNING, file, function, line,
|
||||
NULL, "CUDA call failed: %s, %s", _error_name, _error_text);
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -27,41 +27,14 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GST_CUDA_API
|
||||
gboolean _gst_cuda_debug (CUresult result,
|
||||
GstDebugCategory * cat,
|
||||
const gchar * file,
|
||||
const gchar * function,
|
||||
gint line);
|
||||
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
static inline gboolean
|
||||
_gst_cuda_debug(CUresult result, GstDebugCategory * category,
|
||||
const gchar * file, const gchar * function, gint line)
|
||||
{
|
||||
const gchar *_error_name, *_error_text;
|
||||
if (result != CUDA_SUCCESS) {
|
||||
CuGetErrorName (result, &_error_name);
|
||||
CuGetErrorString (result, &_error_text);
|
||||
gst_debug_log (category, GST_LEVEL_WARNING, file, function, line,
|
||||
NULL, "CUDA call failed: %s, %s", _error_name, _error_text);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_cuda_result:
|
||||
* @result: CUDA device API return code `CUresult`
|
||||
*
|
||||
* Returns: %TRUE if CUDA device API call result is CUDA_SUCCESS
|
||||
*/
|
||||
#define gst_cuda_result(result) \
|
||||
_gst_cuda_debug(result, GST_CAT_DEFAULT, __FILE__, GST_FUNCTION, __LINE__)
|
||||
#else
|
||||
|
||||
static inline gboolean
|
||||
_gst_cuda_debug(CUresult result, GstDebugCategory * category,
|
||||
const gchar * file, const gchar * function, gint line)
|
||||
{
|
||||
return result == CUDA_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_cuda_result:
|
||||
* @result: CUDA device API return code `CUresult`
|
||||
|
@ -70,9 +43,12 @@ _gst_cuda_debug(CUresult result, GstDebugCategory * category,
|
|||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
#define gst_cuda_result(result) \
|
||||
_gst_cuda_debug(result, GST_CAT_DEFAULT, __FILE__, GST_FUNCTION, __LINE__)
|
||||
#else
|
||||
#define gst_cuda_result(result) \
|
||||
_gst_cuda_debug(result, NULL, __FILE__, GST_FUNCTION, __LINE__)
|
||||
#endif
|
||||
#endif /* GST_DISABLE_GST_DEBUG */
|
||||
|
||||
/**
|
||||
* GstCudaQuarkId:
|
||||
|
|
Loading…
Reference in a new issue