diff options
author | Matthew Waters <matthew@centricular.com> | 2015-12-14 18:18:20 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2015-12-14 18:22:07 +1100 |
commit | b12f2be4b17ecaad169532d1e85713308025bf3b (patch) | |
tree | b03f39ae0a0fcb78e29e5fae6589337cd19ac6b2 | |
parent | a07a3501835e17b573d8a8255c3bc30cbc5aff8e (diff) | |
download | gstreamer-plugins-bad-b12f2be4b17ecaad169532d1e85713308025bf3b.tar.gz |
glmemorypbo: map/unmap pbo memory correctly for state tracking
Otherwise some downloads will fail to occur from the PBO.
-rw-r--r-- | gst-libs/gst/gl/gstglmemorypbo.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gst-libs/gst/gl/gstglmemorypbo.c b/gst-libs/gst/gl/gstglmemorypbo.c index 6ef0e3968..f30a8fd3c 100644 --- a/gst-libs/gst/gl/gstglmemorypbo.c +++ b/gst-libs/gst/gl/gstglmemorypbo.c @@ -317,22 +317,32 @@ _pbo_download_transfer (GstGLMemoryPBO * gl_mem, GstMapInfo * info, gsize size) { GstMapInfo *pbo_info; + gl_mem->pbo->target = GL_PIXEL_PACK_BUFFER; /* texture -> pbo */ if (info->flags & GST_MAP_READ && GST_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD)) { + GstMapInfo info; + GST_CAT_TRACE (GST_CAT_GL_MEMORY, "attempting download of texture %u " "using pbo %u", gl_mem->mem.tex_id, gl_mem->pbo->id); + if (!gst_memory_map (GST_MEMORY_CAST (gl_mem->pbo), &info, + GST_MAP_WRITE | GST_MAP_GL)) { + GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Failed to write to PBO"); + return NULL; + } + if (!_read_pixels_to_pbo (gl_mem)) return NULL; + + gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo), &info); } pbo_info = g_new0 (GstMapInfo, 1); /* pbo -> data */ - gl_mem->pbo->target = GL_PIXEL_PACK_BUFFER; /* get a cpu accessible mapping from the pbo */ if (!gst_memory_map (GST_MEMORY_CAST (gl_mem->pbo), pbo_info, info->flags)) { GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Failed to map pbo"); |