mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
gl: Add/Update more debug statements
Where possible, use the _OBJECT variants in order to track better from which object the debug statement is coming from Define (and use) GST_CAT_DEFAULT where applicable Use GST_PTR_FORMAT where applicable
This commit is contained in:
parent
6d6c7f1f19
commit
f56c4c541a
8 changed files with 96 additions and 61 deletions
|
@ -336,7 +336,8 @@ gst_gl_buffer_pool_new (GstGLContext * context)
|
|||
pool = g_object_new (GST_TYPE_GL_BUFFER_POOL, NULL);
|
||||
pool->context = gst_object_ref (context);
|
||||
|
||||
GST_LOG_OBJECT (pool, "new GL buffer pool %p", pool);
|
||||
GST_LOG_OBJECT (pool, "new GL buffer pool for context %" GST_PTR_FORMAT,
|
||||
context);
|
||||
|
||||
return GST_BUFFER_POOL_CAST (pool);
|
||||
}
|
||||
|
|
|
@ -494,6 +494,9 @@ gst_gl_color_convert_new (GstGLContext * context)
|
|||
gst_video_info_set_format (&convert->out_info, GST_VIDEO_FORMAT_ENCODED, 0,
|
||||
0);
|
||||
|
||||
GST_DEBUG_OBJECT (convert,
|
||||
"Created new colorconvert for context %" GST_PTR_FORMAT, context);
|
||||
|
||||
return convert;
|
||||
}
|
||||
|
||||
|
|
|
@ -274,7 +274,8 @@ gst_gl_context_new (GstGLDisplay * display)
|
|||
_init_debug ();
|
||||
|
||||
user_choice = g_getenv ("GST_GL_PLATFORM");
|
||||
GST_INFO ("creating a context, user choice:%s", user_choice);
|
||||
GST_INFO ("creating a context for display %" GST_PTR_FORMAT
|
||||
", user choice:%s", display, user_choice);
|
||||
#if GST_GL_HAVE_PLATFORM_CGL
|
||||
if (!context && (!user_choice || g_strstr_len (user_choice, 5, "cgl")))
|
||||
context = GST_GL_CONTEXT (gst_gl_context_cocoa_new ());
|
||||
|
@ -307,6 +308,10 @@ gst_gl_context_new (GstGLDisplay * display)
|
|||
|
||||
context->priv->display = gst_object_ref (display);
|
||||
|
||||
GST_DEBUG_OBJECT (context,
|
||||
"Done creating context for display %" GST_PTR_FORMAT " (user_choice:%s)",
|
||||
display, user_choice);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
|
@ -556,7 +561,7 @@ gst_gl_context_finalize (GObject * object)
|
|||
|
||||
if (context->priv->alive) {
|
||||
g_mutex_lock (&context->priv->render_lock);
|
||||
GST_INFO ("send quit gl window loop");
|
||||
GST_INFO_OBJECT (context, "send quit gl window loop");
|
||||
gst_gl_window_quit (context->window);
|
||||
while (context->priv->alive) {
|
||||
g_cond_wait (&context->priv->destroy_cond, &context->priv->render_lock);
|
||||
|
@ -568,9 +573,9 @@ gst_gl_context_finalize (GObject * object)
|
|||
|
||||
if (context->priv->gl_thread) {
|
||||
gpointer ret = g_thread_join (context->priv->gl_thread);
|
||||
GST_INFO ("gl thread joined");
|
||||
GST_INFO_OBJECT (context, "gl thread joined");
|
||||
if (ret != NULL)
|
||||
GST_ERROR ("gl thread returned a non-null pointer");
|
||||
GST_ERROR_OBJECT (context, "gl thread returned a non-null pointer");
|
||||
context->priv->gl_thread = NULL;
|
||||
}
|
||||
|
||||
|
@ -592,6 +597,7 @@ gst_gl_context_finalize (GObject * object)
|
|||
g_free (context->priv->gl_exts);
|
||||
g_weak_ref_clear (&context->priv->other_context_ref);
|
||||
|
||||
GST_DEBUG_OBJECT (context, "End of finalize");
|
||||
G_OBJECT_CLASS (gst_gl_context_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -619,6 +625,8 @@ gst_gl_context_activate (GstGLContext * context, gboolean activate)
|
|||
context_class = GST_GL_CONTEXT_GET_CLASS (context);
|
||||
g_return_val_if_fail (context_class->activate != NULL, FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (context, "activate:%d", activate);
|
||||
|
||||
GST_OBJECT_LOCK (context);
|
||||
result = context_class->activate (context, activate);
|
||||
|
||||
|
@ -762,6 +770,8 @@ gst_gl_context_set_window (GstGLContext * context, GstGLWindow * window)
|
|||
{
|
||||
g_return_val_if_fail (!GST_GL_IS_WRAPPED_CONTEXT (context), FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (context, "window:%" GST_PTR_FORMAT, window);
|
||||
|
||||
/* we can't change the window while we are running */
|
||||
if (context->priv->alive)
|
||||
return FALSE;
|
||||
|
@ -794,8 +804,10 @@ gst_gl_context_get_window (GstGLContext * context)
|
|||
{
|
||||
g_return_val_if_fail (GST_GL_IS_CONTEXT (context), NULL);
|
||||
|
||||
if (GST_GL_IS_WRAPPED_CONTEXT (context))
|
||||
if (GST_GL_IS_WRAPPED_CONTEXT (context)) {
|
||||
GST_WARNING_OBJECT (context, "context is not toplevel, returning NULL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_ensure_window (context);
|
||||
|
||||
|
@ -896,6 +908,9 @@ gst_gl_context_create (GstGLContext * context,
|
|||
|
||||
g_return_val_if_fail (GST_GL_IS_CONTEXT (context), FALSE);
|
||||
g_return_val_if_fail (!GST_GL_IS_WRAPPED_CONTEXT (context), FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (context, " other_context:%" GST_PTR_FORMAT, other_context);
|
||||
|
||||
_ensure_window (context);
|
||||
|
||||
g_mutex_lock (&context->priv->render_lock);
|
||||
|
@ -911,7 +926,7 @@ gst_gl_context_create (GstGLContext * context,
|
|||
|
||||
context->priv->created = TRUE;
|
||||
|
||||
GST_INFO ("gl thread created");
|
||||
GST_INFO_OBJECT (context, "gl thread created");
|
||||
}
|
||||
|
||||
alive = context->priv->alive;
|
||||
|
@ -1086,13 +1101,14 @@ _create_context_info (GstGLContext * context, GstGLAPI gl_api, gint * gl_major,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
GST_INFO ("GL_VERSION: %s",
|
||||
GST_INFO_OBJECT (context, "GL_VERSION: %s",
|
||||
GST_STR_NULL ((const gchar *) gl->GetString (GL_VERSION)));
|
||||
GST_INFO ("GL_SHADING_LANGUAGE_VERSION: %s", GST_STR_NULL ((const gchar *)
|
||||
GST_INFO_OBJECT (context, "GL_SHADING_LANGUAGE_VERSION: %s",
|
||||
GST_STR_NULL ((const gchar *)
|
||||
gl->GetString (GL_SHADING_LANGUAGE_VERSION)));
|
||||
GST_INFO ("GL_VENDOR: %s",
|
||||
GST_INFO_OBJECT (context, "GL_VENDOR: %s",
|
||||
GST_STR_NULL ((const gchar *) gl->GetString (GL_VENDOR)));
|
||||
GST_INFO ("GL_RENDERER: %s",
|
||||
GST_INFO_OBJECT (context, "GL_RENDERER: %s",
|
||||
GST_STR_NULL ((const gchar *) gl->GetString (GL_RENDERER)));
|
||||
|
||||
gl_err = gl->GetError ();
|
||||
|
@ -1186,6 +1202,8 @@ gst_gl_context_create_thread (GstGLContext * context)
|
|||
|
||||
g_mutex_lock (&context->priv->render_lock);
|
||||
|
||||
GST_DEBUG_OBJECT (context, "Creating thread");
|
||||
|
||||
error = context->priv->error;
|
||||
other_context = g_weak_ref_get (&context->priv->other_context_ref);
|
||||
|
||||
|
@ -1202,6 +1220,7 @@ gst_gl_context_create_thread (GstGLContext * context)
|
|||
|
||||
if (window_class->open) {
|
||||
if (!window_class->open (context->window, error)) {
|
||||
GST_WARNING_OBJECT (context, "Failed to open window");
|
||||
g_assert (error == NULL || *error != NULL);
|
||||
goto failure;
|
||||
}
|
||||
|
@ -1230,6 +1249,7 @@ gst_gl_context_create_thread (GstGLContext * context)
|
|||
|
||||
if (context_class->choose_format &&
|
||||
!context_class->choose_format (context, error)) {
|
||||
GST_WARNING ("Failed to choose format");
|
||||
g_assert (error == NULL || *error != NULL);
|
||||
g_free (compiled_api_s);
|
||||
g_free (user_api_s);
|
||||
|
@ -1237,19 +1257,21 @@ gst_gl_context_create_thread (GstGLContext * context)
|
|||
goto failure;
|
||||
}
|
||||
|
||||
GST_INFO ("Attempting to create opengl context. user chosen api(s) (%s), "
|
||||
"compiled api support (%s) display api (%s)", user_api_s,
|
||||
compiled_api_s, display_api_s);
|
||||
GST_INFO_OBJECT (context,
|
||||
"Attempting to create opengl context. user chosen api(s) (%s), "
|
||||
"compiled api support (%s) display api (%s)", user_api_s, compiled_api_s,
|
||||
display_api_s);
|
||||
|
||||
if (!context_class->create_context (context,
|
||||
compiled_api & user_api & display_api, other_context, error)) {
|
||||
GST_WARNING_OBJECT (context, "Failed to create context");
|
||||
g_assert (error == NULL || *error != NULL);
|
||||
g_free (compiled_api_s);
|
||||
g_free (user_api_s);
|
||||
g_free (display_api_s);
|
||||
goto failure;
|
||||
}
|
||||
GST_INFO ("created context");
|
||||
GST_INFO_OBJECT (context, "created context");
|
||||
|
||||
if (!gst_gl_context_activate (context, TRUE)) {
|
||||
g_set_error (error, GST_GL_CONTEXT_ERROR,
|
||||
|
@ -1265,7 +1287,7 @@ gst_gl_context_create_thread (GstGLContext * context)
|
|||
g_assert (gl_api != GST_GL_API_NONE && gl_api != GST_GL_API_ANY);
|
||||
|
||||
api_string = gst_gl_api_to_string (gl_api);
|
||||
GST_INFO ("available GL APIs: %s", api_string);
|
||||
GST_INFO_OBJECT (context, "available GL APIs: %s", api_string);
|
||||
|
||||
if (((compiled_api & gl_api & display_api) & user_api) == GST_GL_API_NONE) {
|
||||
g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
|
||||
|
@ -1284,13 +1306,14 @@ gst_gl_context_create_thread (GstGLContext * context)
|
|||
g_free (user_api_s);
|
||||
g_free (display_api_s);
|
||||
|
||||
GST_DEBUG_OBJECT (context, "Filling info");
|
||||
gst_gl_context_fill_info (context, error);
|
||||
|
||||
context->priv->alive = TRUE;
|
||||
|
||||
if (gl->DebugMessageCallback) {
|
||||
#if !defined(GST_DISABLE_GST_DEBUG)
|
||||
GST_INFO ("Enabling GL context debugging");
|
||||
GST_INFO_OBJECT (context, "Enabling GL context debugging");
|
||||
/* enable them all */
|
||||
gl->DebugMessageControl (GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0,
|
||||
GL_TRUE);
|
||||
|
@ -1298,8 +1321,11 @@ gst_gl_context_create_thread (GstGLContext * context)
|
|||
#endif
|
||||
}
|
||||
|
||||
if (other_context)
|
||||
if (other_context) {
|
||||
GST_DEBUG_OBJECT (context, "Unreffing other_context %" GST_PTR_FORMAT,
|
||||
other_context);
|
||||
gst_object_unref (other_context);
|
||||
}
|
||||
|
||||
g_cond_signal (&context->priv->create_cond);
|
||||
|
||||
|
@ -1309,7 +1335,7 @@ gst_gl_context_create_thread (GstGLContext * context)
|
|||
|
||||
gst_gl_window_run (context->window);
|
||||
|
||||
GST_INFO ("loop exited\n");
|
||||
GST_INFO_OBJECT (context, "loop exited");
|
||||
|
||||
g_mutex_lock (&context->priv->render_lock);
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ gst_gl_display_init (GstGLDisplay * display)
|
|||
static void
|
||||
gst_gl_display_finalize (GObject * object)
|
||||
{
|
||||
GST_TRACE ("finalize %p", object);
|
||||
GST_TRACE_OBJECT (object, "finalizing");
|
||||
|
||||
G_OBJECT_CLASS (gst_gl_display_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -272,8 +272,9 @@ gst_context_set_gl_display (GstContext * context, GstGLDisplay * display)
|
|||
|
||||
g_return_if_fail (context != NULL);
|
||||
|
||||
GST_CAT_LOG (gst_context, "setting GstGLDisplay(%p) on context(%p)", display,
|
||||
context);
|
||||
GST_CAT_LOG (gst_context,
|
||||
"setting GstGLDisplay(%" GST_PTR_FORMAT ") on context(%" GST_PTR_FORMAT
|
||||
")", display, context);
|
||||
|
||||
s = gst_context_writable_structure (context);
|
||||
gst_structure_set (s, GST_GL_DISPLAY_CONTEXT_TYPE, GST_TYPE_GL_DISPLAY,
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2, 3, 0))
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
|
||||
#define GST_CAT_DEFUALT GST_CAT_GL_MEMORY
|
||||
#define GST_CAT_DEFAULT GST_CAT_GL_MEMORY
|
||||
|
||||
static GstAllocator *_gl_allocator;
|
||||
|
||||
|
@ -385,9 +385,8 @@ _generate_texture (GstGLContext * context, GenTexture * data)
|
|||
const GstGLFuncs *gl = context->gl_vtable;
|
||||
GLenum internal_format;
|
||||
|
||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY,
|
||||
"Generating texture format:%u type:%u dimensions:%ux%u", data->gl_format,
|
||||
data->gl_type, data->width, data->height);
|
||||
GST_TRACE ("Generating texture format:%u type:%u dimensions:%ux%u",
|
||||
data->gl_format, data->gl_type, data->width, data->height);
|
||||
|
||||
internal_format =
|
||||
_sized_gl_format_from_gl_format_type (data->gl_format, data->gl_type);
|
||||
|
@ -402,7 +401,7 @@ _generate_texture (GstGLContext * context, GenTexture * data)
|
|||
gl->TexParameteri (data->gl_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
gl->TexParameteri (data->gl_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
GST_CAT_LOG (GST_CAT_GL_MEMORY, "generated texture id:%d", data->result);
|
||||
GST_LOG ("generated texture id:%d", data->result);
|
||||
}
|
||||
|
||||
/* find the difference between the start of the plane and where the video
|
||||
|
@ -453,7 +452,7 @@ _upload_memory (GstGLContext * context, GstGLMemory * gl_mem)
|
|||
gl->PixelStorei (GL_UNPACK_ALIGNMENT, gl_mem->unpack_length);
|
||||
}
|
||||
|
||||
GST_CAT_LOG (GST_CAT_GL_MEMORY, "upload for texture id:%u, with pbo %u %ux%u",
|
||||
GST_LOG ("upload for texture id:%u, with pbo %u %ux%u",
|
||||
gl_mem->tex_id, gl_mem->transfer_pbo, gl_mem->tex_width,
|
||||
GL_MEM_HEIGHT (gl_mem));
|
||||
|
||||
|
@ -501,7 +500,7 @@ _transfer_upload (GstGLContext * context, GstGLMemory * gl_mem)
|
|||
if (!gl_mem->transfer_pbo)
|
||||
gl->GenBuffers (1, &gl_mem->transfer_pbo);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "uploading texture %u using pbo %u",
|
||||
GST_DEBUG ("uploading texture %u using pbo %u",
|
||||
gl_mem->tex_id, gl_mem->transfer_pbo);
|
||||
|
||||
size = ((GstMemory *) gl_mem)->maxsize;
|
||||
|
@ -537,8 +536,7 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
|
|||
|
||||
n_gl_bytes = _gl_texture_type_n_bytes (gl_mem->tex_type);
|
||||
if (n_gl_bytes == 0) {
|
||||
GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Unsupported texture type %d",
|
||||
gl_mem->tex_type);
|
||||
GST_ERROR ("Unsupported texture type %d", gl_mem->tex_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -554,7 +552,7 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
|
|||
((GL_MEM_WIDTH (gl_mem) * n_gl_bytes) + j - 1) & ~(j - 1);
|
||||
|
||||
if (round_up_j == GL_MEM_STRIDE (gl_mem)) {
|
||||
GST_CAT_LOG (GST_CAT_GL_MEMORY, "Found alignment of %u based on width "
|
||||
GST_LOG ("Found alignment of %u based on width "
|
||||
"(with plane width:%u, plane stride:%u and pixel stride:%u. "
|
||||
"RU%u(%u*%u) = %u)", j, GL_MEM_WIDTH (gl_mem),
|
||||
GL_MEM_STRIDE (gl_mem), n_gl_bytes, j, GL_MEM_WIDTH (gl_mem),
|
||||
|
@ -577,7 +575,7 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
|
|||
guint round_up_j = ((GL_MEM_STRIDE (gl_mem)) + j - 1) & ~(j - 1);
|
||||
|
||||
if (round_up_j == (GL_MEM_STRIDE (gl_mem))) {
|
||||
GST_CAT_LOG (GST_CAT_GL_MEMORY, "Found alignment of %u based on "
|
||||
GST_LOG ("Found alignment of %u based on "
|
||||
"stride (with plane stride:%u and pixel stride:%u. "
|
||||
"RU%u(%u) = %u)", j, GL_MEM_STRIDE (gl_mem), n_gl_bytes, j,
|
||||
GL_MEM_STRIDE (gl_mem), round_up_j);
|
||||
|
@ -593,8 +591,8 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
|
|||
}
|
||||
|
||||
if (j < n_gl_bytes) {
|
||||
GST_CAT_ERROR
|
||||
(GST_CAT_GL_MEMORY, "Failed to find matching alignment. Image may "
|
||||
GST_ERROR
|
||||
("Failed to find matching alignment. Image may "
|
||||
"look corrupted. plane width:%u, plane stride:%u and pixel "
|
||||
"stride:%u", GL_MEM_WIDTH (gl_mem), GL_MEM_STRIDE (gl_mem),
|
||||
n_gl_bytes);
|
||||
|
@ -623,7 +621,7 @@ _transfer_download (GstGLContext * context, GstGLMemory * gl_mem)
|
|||
if (!gl_mem->transfer_pbo)
|
||||
gl->GenBuffers (1, &gl_mem->transfer_pbo);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "downloading texture %u using pbo %u",
|
||||
GST_DEBUG ("downloading texture %u using pbo %u",
|
||||
gl_mem->tex_id, gl_mem->transfer_pbo);
|
||||
|
||||
size = ((GstMemory *) gl_mem)->maxsize;
|
||||
|
@ -645,7 +643,7 @@ _transfer_download (GstGLContext * context, GstGLMemory * gl_mem)
|
|||
GL_TEXTURE_2D, gl_mem->tex_id, 0);
|
||||
|
||||
if (!gst_gl_context_check_framebuffer_status (context)) {
|
||||
GST_CAT_ERROR (GST_CAT_GL_MEMORY, "failed to download texture");
|
||||
GST_ERROR ("failed to download texture");
|
||||
goto fbo_error;
|
||||
}
|
||||
|
||||
|
@ -686,7 +684,7 @@ _download_memory (GstGLContext * context, GstGLMemory * gl_mem)
|
|||
goto error;
|
||||
}
|
||||
|
||||
GST_CAT_LOG (GST_CAT_GL_MEMORY, "downloading memory %p, tex %u into %p",
|
||||
GST_LOG ("downloading memory %p, tex %u into %p",
|
||||
gl_mem, gl_mem->tex_id, gl_mem->data);
|
||||
|
||||
if (gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|
||||
|
@ -702,7 +700,7 @@ _download_memory (GstGLContext * context, GstGLMemory * gl_mem)
|
|||
map_data =
|
||||
gl->MapBufferRange (GL_PIXEL_PACK_BUFFER, 0, size, GL_MAP_READ_BIT);
|
||||
if (!map_data) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "error mapping buffer for download");
|
||||
GST_WARNING ("error mapping buffer for download");
|
||||
gl->BindBuffer (GL_PIXEL_PACK_BUFFER, 0);
|
||||
goto read_pixels;
|
||||
}
|
||||
|
@ -774,9 +772,10 @@ _gl_mem_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent,
|
|||
|
||||
_calculate_unpack_length (mem);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "new GL texture memory:%p format:%u "
|
||||
"dimensions:%ux%u stride:%u size:%" G_GSIZE_FORMAT, mem, mem->tex_type,
|
||||
mem->tex_width, GL_MEM_HEIGHT (mem), GL_MEM_STRIDE (mem), maxsize);
|
||||
GST_DEBUG ("new GL texture context:%" GST_PTR_FORMAT " memory:%p format:%u "
|
||||
"dimensions:%ux%u stride:%u size:%" G_GSIZE_FORMAT, context, mem,
|
||||
mem->tex_type, mem->tex_width, GL_MEM_HEIGHT (mem), GL_MEM_STRIDE (mem),
|
||||
maxsize);
|
||||
}
|
||||
|
||||
static GstGLMemory *
|
||||
|
@ -801,11 +800,11 @@ _gl_mem_new (GstAllocator * allocator, GstMemory * parent,
|
|||
gst_gl_context_thread_add (context,
|
||||
(GstGLContextThreadFunc) _generate_texture, &data);
|
||||
if (!data.result) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY,
|
||||
"Could not create GL texture with context:%p", context);
|
||||
GST_WARNING ("Could not create GL texture with context:%" GST_PTR_FORMAT,
|
||||
context);
|
||||
}
|
||||
|
||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "created texture %u", data.result);
|
||||
GST_TRACE ("created texture %u", data.result);
|
||||
|
||||
mem->tex_id = data.result;
|
||||
mem->tex_target = data.gl_target;
|
||||
|
@ -824,8 +823,7 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
|
|||
|
||||
if ((flags & GST_MAP_GL) == GST_MAP_GL) {
|
||||
if ((flags & GST_MAP_READ) == GST_MAP_READ) {
|
||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "mapping GL texture:%u for reading",
|
||||
gl_mem->tex_id);
|
||||
GST_TRACE ("mapping GL texture:%u for reading", gl_mem->tex_id);
|
||||
if (GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
|
||||
gst_gl_context_thread_add (gl_mem->context,
|
||||
(GstGLContextThreadFunc) _upload_memory, gl_mem);
|
||||
|
@ -834,8 +832,7 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
|
|||
}
|
||||
|
||||
if ((flags & GST_MAP_WRITE) == GST_MAP_WRITE) {
|
||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "mapping GL texture:%u for writing",
|
||||
gl_mem->tex_id);
|
||||
GST_TRACE ("mapping GL texture:%u for writing", gl_mem->tex_id);
|
||||
GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
|
||||
GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
|
||||
}
|
||||
|
@ -843,8 +840,7 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
|
|||
data = &gl_mem->tex_id;
|
||||
} else { /* not GL */
|
||||
if ((flags & GST_MAP_READ) == GST_MAP_READ) {
|
||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY,
|
||||
"mapping GL texture:%u for reading from system memory",
|
||||
GST_TRACE ("mapping GL texture:%u for reading from system memory",
|
||||
gl_mem->tex_id);
|
||||
if (GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD)) {
|
||||
gst_gl_context_thread_add (gl_mem->context,
|
||||
|
@ -854,8 +850,8 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
|
|||
}
|
||||
|
||||
if ((flags & GST_MAP_WRITE) == GST_MAP_WRITE) {
|
||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY,
|
||||
"mapping GL texture:%u for writing to system memory", gl_mem->tex_id);
|
||||
GST_TRACE ("mapping GL texture:%u for writing to system memory",
|
||||
gl_mem->tex_id);
|
||||
GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
|
||||
GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
|
||||
}
|
||||
|
@ -962,11 +958,10 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
|
|||
}
|
||||
|
||||
if (!tex_id) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY,
|
||||
"Could not create GL texture with context:%p", src->context);
|
||||
GST_WARNING ("Could not create GL texture with context:%p", src->context);
|
||||
}
|
||||
|
||||
GST_CAT_LOG (GST_CAT_GL_MEMORY, "copying memory %p, tex %u into texture %i",
|
||||
GST_LOG ("copying memory %p, tex %u into texture %i",
|
||||
src, src->tex_id, tex_id);
|
||||
|
||||
/* FIXME: try and avoid creating and destroying fbo's every copy... */
|
||||
|
@ -1060,7 +1055,7 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
&src->valign, src->plane, NULL, NULL);
|
||||
dest->data = g_try_malloc (src->mem.maxsize);
|
||||
if (dest->data == NULL) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
GST_WARNING ("Could not copy GL Memory");
|
||||
gst_memory_unref ((GstMemory *) dest);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1085,7 +1080,7 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
&src->valign, src->plane, NULL, NULL);
|
||||
|
||||
if (!copy_params.result) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
GST_WARNING ("Could not copy GL Memory");
|
||||
gst_memory_unref ((GstMemory *) dest);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1093,7 +1088,7 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
dest->tex_id = copy_params.tex_id;
|
||||
dest->data = g_try_malloc (src->mem.maxsize);
|
||||
if (dest->data == NULL) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
GST_WARNING ("Could not copy GL Memory");
|
||||
gst_memory_unref ((GstMemory *) dest);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1144,7 +1139,7 @@ _gl_mem_free (GstAllocator * allocator, GstMemory * mem)
|
|||
{
|
||||
GstGLMemory *gl_mem = (GstGLMemory *) mem;
|
||||
|
||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "freeing texture %u", gl_mem->tex_id);
|
||||
GST_TRACE ("freeing texture %u", gl_mem->tex_id);
|
||||
|
||||
gst_gl_context_thread_add (gl_mem->context,
|
||||
(GstGLContextThreadFunc) _destroy_gl_objects, gl_mem);
|
||||
|
|
|
@ -170,7 +170,7 @@ gst_gl_shader_finalize (GObject * object)
|
|||
shader = GST_GL_SHADER (object);
|
||||
priv = shader->priv;
|
||||
|
||||
GST_TRACE ("finalizing shader %u", priv->program_handle);
|
||||
GST_TRACE_OBJECT (shader, "finalizing shader %u", priv->program_handle);
|
||||
|
||||
g_free (priv->vertex_src);
|
||||
g_free (priv->fragment_src);
|
||||
|
@ -402,6 +402,9 @@ gst_gl_shader_new (GstGLContext * context)
|
|||
shader = g_object_new (GST_GL_TYPE_SHADER, NULL);
|
||||
shader->context = gst_object_ref (context);
|
||||
|
||||
GST_DEBUG_OBJECT (shader, "Created new GLShader for context %" GST_PTR_FORMAT,
|
||||
context);
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
|
|
|
@ -777,6 +777,9 @@ gst_gl_upload_new (GstGLContext * context)
|
|||
upload->priv->upload_impl[i] = upload_methods[i]->new (upload);
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (upload, "Created new GLUpload for context %" GST_PTR_FORMAT,
|
||||
context);
|
||||
|
||||
return upload;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@ gst_gl_upload_meta_new (GstGLContext * context)
|
|||
|
||||
upload->context = gst_object_ref (context);
|
||||
|
||||
GST_DEBUG_OBJECT (upload, "Created upload for context %"GST_PTR_FORMAT, upload->context);
|
||||
|
||||
return upload;
|
||||
}
|
||||
|
||||
|
@ -108,6 +110,7 @@ gst_gl_upload_meta_finalize (GObject * object)
|
|||
{
|
||||
GstGLUploadMeta *upload;
|
||||
|
||||
GST_DEBUG_OBJECT (object, "Finalizing");
|
||||
upload = GST_GL_UPLOAD_META (object);
|
||||
|
||||
gst_gl_upload_meta_reset (upload);
|
||||
|
|
Loading…
Reference in a new issue