diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-01-29 09:53:25 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-11 05:56:37 -0400 |
commit | b5b4541eef8eac83f5c0d166d8e494f7c9fff202 (patch) | |
tree | f4bc458dfff48a3bd2236f235fa3249c356e2db8 /include | |
parent | 952c9ee2900de152c4999d94da5c4bd846ae52e8 (diff) |
[media] vb2: add debugging code to check for unbalanced ops
When a vb2_queue is freed check if all the mem_ops and queue ops were balanced.
So the number of calls to e.g. buf_finish has to match the number of calls to
buf_prepare, etc.
This code is only enabled if CONFIG_VIDEO_ADV_DEBUG is set.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/media/videobuf2-core.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index bf6859ee46c3..2fdb08a78b95 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
@@ -203,6 +203,37 @@ struct vb2_buffer { | |||
203 | struct list_head done_entry; | 203 | struct list_head done_entry; |
204 | 204 | ||
205 | struct vb2_plane planes[VIDEO_MAX_PLANES]; | 205 | struct vb2_plane planes[VIDEO_MAX_PLANES]; |
206 | |||
207 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
208 | /* | ||
209 | * Counters for how often these buffer-related ops are | ||
210 | * called. Used to check for unbalanced ops. | ||
211 | */ | ||
212 | u32 cnt_mem_alloc; | ||
213 | u32 cnt_mem_put; | ||
214 | u32 cnt_mem_get_dmabuf; | ||
215 | u32 cnt_mem_get_userptr; | ||
216 | u32 cnt_mem_put_userptr; | ||
217 | u32 cnt_mem_prepare; | ||
218 | u32 cnt_mem_finish; | ||
219 | u32 cnt_mem_attach_dmabuf; | ||
220 | u32 cnt_mem_detach_dmabuf; | ||
221 | u32 cnt_mem_map_dmabuf; | ||
222 | u32 cnt_mem_unmap_dmabuf; | ||
223 | u32 cnt_mem_vaddr; | ||
224 | u32 cnt_mem_cookie; | ||
225 | u32 cnt_mem_num_users; | ||
226 | u32 cnt_mem_mmap; | ||
227 | |||
228 | u32 cnt_buf_init; | ||
229 | u32 cnt_buf_prepare; | ||
230 | u32 cnt_buf_finish; | ||
231 | u32 cnt_buf_cleanup; | ||
232 | u32 cnt_buf_queue; | ||
233 | |||
234 | /* This counts the number of calls to vb2_buffer_done() */ | ||
235 | u32 cnt_buf_done; | ||
236 | #endif | ||
206 | }; | 237 | }; |
207 | 238 | ||
208 | /** | 239 | /** |
@@ -366,6 +397,18 @@ struct vb2_queue { | |||
366 | unsigned int retry_start_streaming:1; | 397 | unsigned int retry_start_streaming:1; |
367 | 398 | ||
368 | struct vb2_fileio_data *fileio; | 399 | struct vb2_fileio_data *fileio; |
400 | |||
401 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
402 | /* | ||
403 | * Counters for how often these queue-related ops are | ||
404 | * called. Used to check for unbalanced ops. | ||
405 | */ | ||
406 | u32 cnt_queue_setup; | ||
407 | u32 cnt_wait_prepare; | ||
408 | u32 cnt_wait_finish; | ||
409 | u32 cnt_start_streaming; | ||
410 | u32 cnt_stop_streaming; | ||
411 | #endif | ||
369 | }; | 412 | }; |
370 | 413 | ||
371 | void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no); | 414 | void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no); |