mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-17 22:06:41 +00:00
vaapivideomemory: log in perf category when copy
Log in performance category when the derive image handling fails, falling back to memory copy.
This commit is contained in:
parent
7e90ae4c2e
commit
1bc5f00dfe
1 changed files with 24 additions and 3 deletions
|
@ -28,6 +28,7 @@
|
|||
#include "gstvaapivideomemory.h"
|
||||
#include "gstvaapipluginutil.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (CAT_PERFORMANCE);
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_debug_vaapivideomemory);
|
||||
#define GST_CAT_DEFAULT gst_debug_vaapivideomemory
|
||||
|
||||
|
@ -45,6 +46,27 @@ GST_DEBUG_CATEGORY_STATIC (gst_debug_vaapivideomemory);
|
|||
|
||||
static void gst_vaapi_video_memory_reset_image (GstVaapiVideoMemory * mem);
|
||||
|
||||
static void
|
||||
_init_performance_debug (void)
|
||||
{
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
static volatile gsize _init = 0;
|
||||
|
||||
if (g_once_init_enter (&_init)) {
|
||||
GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE");
|
||||
g_once_init_leave (&_init, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
reset_image_usage (gboolean * flag)
|
||||
{
|
||||
_init_performance_debug ();
|
||||
GST_CAT_INFO (CAT_PERFORMANCE, "derive image failed, fallbacking to copy");
|
||||
*flag = FALSE;
|
||||
}
|
||||
|
||||
static guchar *
|
||||
get_image_data (GstVaapiImage * image)
|
||||
{
|
||||
|
@ -74,12 +96,11 @@ ensure_image (GstVaapiVideoMemory * mem)
|
|||
if (!mem->image && mem->use_direct_rendering) {
|
||||
mem->image = gst_vaapi_surface_derive_image (mem->surface);
|
||||
if (!mem->image) {
|
||||
GST_WARNING ("failed to derive image, fallbacking to copy");
|
||||
mem->use_direct_rendering = FALSE;
|
||||
reset_image_usage (&mem->use_direct_rendering);
|
||||
} else if (gst_vaapi_surface_get_format (mem->surface) !=
|
||||
GST_VIDEO_INFO_FORMAT (mem->image_info)) {
|
||||
gst_vaapi_object_replace (&mem->image, NULL);
|
||||
mem->use_direct_rendering = FALSE;
|
||||
reset_image_usage (&mem->use_direct_rendering);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue