mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 02:30:35 +00:00
glmemory: Handle upload/download flags from map
Problem was that if buffer was mapped READWRITE (state of buffers from libav right now), mapping it READ/GL will not upload. This is because the flag is only set when the buffer is unmapped. We can fix this by setting the flags in map. This result in already mapped buffer that get mapped to be read in GL will be uploaded. The problem is that if the write mapper makes modification afterward, the modification will never get uploaded. https://bugzilla.gnome.org/show_bug.cgi?id=740900
This commit is contained in:
parent
4f3c33af3a
commit
da3ae06cd1
2 changed files with 11 additions and 16 deletions
gst-libs/gst/gl
|
@ -653,9 +653,13 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
|
||||||
(GstGLContextThreadFunc) _upload_memory, gl_mem);
|
(GstGLContextThreadFunc) _upload_memory, gl_mem);
|
||||||
GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
|
GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if ((flags & GST_MAP_WRITE) == GST_MAP_WRITE) {
|
||||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "mapping GL texture:%u for writing",
|
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "mapping GL texture:%u for writing",
|
||||||
gl_mem->tex_id);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
data = &gl_mem->tex_id;
|
data = &gl_mem->tex_id;
|
||||||
|
@ -669,33 +673,25 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
|
||||||
(GstGLContextThreadFunc) _download_memory, gl_mem);
|
(GstGLContextThreadFunc) _download_memory, gl_mem);
|
||||||
GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
|
GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if ((flags & GST_MAP_WRITE) == GST_MAP_WRITE) {
|
||||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY,
|
GST_CAT_TRACE (GST_CAT_GL_MEMORY,
|
||||||
"mapping GL texture:%u for writing to system memory", gl_mem->tex_id);
|
"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);
|
||||||
}
|
}
|
||||||
|
|
||||||
data = gl_mem->data;
|
data = gl_mem->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_mem->map_flags = flags;
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gl_mem_unmap (GstGLMemory * gl_mem)
|
_gl_mem_unmap (GstGLMemory * gl_mem)
|
||||||
{
|
{
|
||||||
if ((gl_mem->map_flags & GST_MAP_WRITE) == GST_MAP_WRITE) {
|
/* nothing to do here */
|
||||||
if ((gl_mem->map_flags & GST_MAP_GL) == GST_MAP_GL) {
|
|
||||||
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);
|
|
||||||
} else {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_mem->map_flags = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -90,7 +90,6 @@ struct _GstGLMemory
|
||||||
gfloat tex_scaling[2];
|
gfloat tex_scaling[2];
|
||||||
|
|
||||||
/* <private> */
|
/* <private> */
|
||||||
GstMapFlags map_flags;
|
|
||||||
gpointer data;
|
gpointer data;
|
||||||
|
|
||||||
gboolean data_wrapped;
|
gboolean data_wrapped;
|
||||||
|
|
Loading…
Reference in a new issue