for (i = 0; i < sinfo.num_planes; i++) {
GST_VIDEO_INFO_PLANE_STRIDE (vinfo, i) = sinfo.planes[i].stride;
+#if 0
+ /* The offset from TBM surface is not matched to GST_VIDEO_INFO.
+ They are initialized as 0 when created and it's not needed to updated now,
+ and can be updated if needed in the future. */
GST_VIDEO_INFO_PLANE_OFFSET (vinfo, i) = sinfo.planes[i].offset;
- GST_DEBUG ("tbm surface plane[%d][%p]", i, sinfo.planes[i].ptr);
+#endif
+ GST_DEBUG ("tbm surface plane[%d][%p][stride:%u]",
+ i, sinfo.planes[i].ptr, sinfo.planes[i].stride);
}
GST_VIDEO_INFO_SIZE (vinfo) = sinfo.size;
int tbm_opt = 0;
gboolean mapped = FALSE;
GstBuffer *buffer = meta->buffer;
- GstTizenMemory *tmem = (GstTizenMemory *) gst_buffer_get_memory (buffer, 0);
+ GstTizenMemory *tmem = (GstTizenMemory *) gst_buffer_peek_memory (buffer, 0);
g_return_val_if_fail (GST_IS_TIZEN_ALLOCATOR (((GstMemory *) tmem)->allocator), FALSE);
g_mutex_lock (&tmem->lock);
if (tmem->video_memory_map[plane]) {
- GST_ERROR ("buf[%p] plane[%d] is already mapped", buffer, plane);
+ GST_ERROR ("buf[%p] plane[%u] is already mapped", buffer, plane);
goto _VIDEO_MEMORY_MAP_DONE;
}
}
if (plane >= tmem->surface_info.num_planes) {
- GST_ERROR ("buf[%p] invalid plane index[%d] (num plane[%d])",
+ GST_ERROR ("buf[%p] invalid plane[%u] (num_plane[%d])",
buffer, plane, tmem->surface_info.num_planes);
- if (tmem->video_memory_map_count == 0) {
- GST_ERROR ("buf[%p] unmap surface[%p]", buffer, tmem->surface);
+ if (tmem->video_memory_map_count == 0)
tbm_surface_unmap (tmem->surface);
- }
goto _VIDEO_MEMORY_MAP_DONE;
}
/* set map flags */
info->flags = flags;
- GST_DEBUG ("buf[%p] plane[%d], data[%p], stride[%d], flags[0x%x]",
- buffer, plane, *data, *stride, info->flags);
+ GST_DEBUG ("mapped: b[%p] p[%d], d[%p], s[%d], f[0x%x], map_count[%d]",
+ buffer, plane, *data, *stride, info->flags, tmem->video_memory_map_count);
mapped = TRUE;
int tbm_ret = TBM_SURFACE_ERROR_NONE;
gboolean unmapped = FALSE;
GstBuffer *buffer = meta->buffer;
- GstTizenMemory *tmem = (GstTizenMemory *) gst_buffer_get_memory (buffer, 0);
+ GstTizenMemory *tmem = (GstTizenMemory *) gst_buffer_peek_memory (buffer, 0);
g_return_val_if_fail (GST_IS_TIZEN_ALLOCATOR (((GstMemory *) tmem)->allocator), FALSE);
g_mutex_lock (&tmem->lock);
if (tmem->video_memory_map[plane] == FALSE) {
- GST_ERROR ("buf[%p] plane[%d] is already unmapped",
+ GST_ERROR ("buf[%p] plane[%u] is already unmapped",
buffer, plane);
goto _VIDEO_MEMORY_UNMAP_DONE;
}
if (tmem->video_memory_map_count > 1) {
- GST_DEBUG ("buf[%p] plane[%d] skip unmap surface[%p]",
+ GST_DEBUG ("buf[%p] plane[%u] skip unmap surface[%p]",
buffer, plane, tmem->surface);
unmapped = TRUE;
goto _VIDEO_MEMORY_UNMAP_DONE;
unmapped = TRUE;
- GST_DEBUG ("buf[%p] plane[%d] unmap surface[%p] done",
- buffer, plane, tmem->surface);
-
_VIDEO_MEMORY_UNMAP_DONE:
if (unmapped == TRUE) {
tmem->video_memory_map[plane] = FALSE;
tmem->video_memory_map_count--;
+
+ GST_DEBUG ("unmapped: b[%p] p[%d], map_count[%d]",
+ buffer, plane, tmem->video_memory_map_count);
}
g_mutex_unlock (&tmem->lock);