This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:
Subject: v4l2-tracer: remove buffers by type and index Author: Deborah Brouwer <deborah.brou...@collabora.com> Date: Mon Nov 13 12:06:14 2023 -0800 Currently duplicate buffers are identified for removal by file descriptor, but if the buffers were added by QUERYBUF then they will all have the same file descriptor and the wrong buffer might be removed. So, instead, identify duplicate buffers for removal by type and index. Signed-off-by: Deborah Brouwer <deborah.brou...@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl> utils/v4l2-tracer/retrace-helper.cpp | 4 ++-- utils/v4l2-tracer/retrace.cpp | 2 +- utils/v4l2-tracer/retrace.h | 2 +- utils/v4l2-tracer/trace-helper.cpp | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=69a9c6e2987ef9e91342663ec0c785c0e44b1f24 diff --git a/utils/v4l2-tracer/retrace-helper.cpp b/utils/v4l2-tracer/retrace-helper.cpp index 3c68986ffd75..db24c6674f98 100644 --- a/utils/v4l2-tracer/retrace-helper.cpp +++ b/utils/v4l2-tracer/retrace-helper.cpp @@ -41,10 +41,10 @@ void add_buffer_retrace(int fd, __u32 type, __u32 index, __u32 offset) ctx_retrace.buffers.push_front(buf); } -void remove_buffer_retrace(int fd) +void remove_buffer_retrace(__u32 type, __u32 index) { for (auto it = ctx_retrace.buffers.begin(); it != ctx_retrace.buffers.end(); ++it) { - if (it->fd == fd) { + if ((it->type == type) && (it->index == index)) { ctx_retrace.buffers.erase(it); break; } diff --git a/utils/v4l2-tracer/retrace.cpp b/utils/v4l2-tracer/retrace.cpp index 1bec635de760..b2b4afbf20cb 100644 --- a/utils/v4l2-tracer/retrace.cpp +++ b/utils/v4l2-tracer/retrace.cpp @@ -460,7 +460,7 @@ void retrace_vidioc_expbuf(int fd_retrace, json_object *ioctl_args_user, json_ob */ int fd_found_in_retrace_context = get_buffer_fd_retrace(ptr->type, ptr->index); if (fd_found_in_retrace_context != -1) - remove_buffer_retrace(fd_found_in_retrace_context); + remove_buffer_retrace(ptr->type, ptr->index); add_buffer_retrace(buf_fd_retrace, ptr->type, ptr->index); diff --git a/utils/v4l2-tracer/retrace.h b/utils/v4l2-tracer/retrace.h index 01157336f827..87a0417e183d 100644 --- a/utils/v4l2-tracer/retrace.h +++ b/utils/v4l2-tracer/retrace.h @@ -30,7 +30,7 @@ int retrace(std::string trace_filename); bool buffer_in_retrace_context(int fd, __u32 offset = 0); int get_buffer_fd_retrace(__u32 type, __u32 index); void add_buffer_retrace(int fd, __u32 type, __u32 index, __u32 offset = 0); -void remove_buffer_retrace(int fd); +void remove_buffer_retrace(__u32 type, __u32 index); void set_buffer_address_retrace(int fd, __u32 offset, long address_trace, long address_retrace); long get_retrace_address_from_trace_address(long address_trace); void add_fd(int fd_trace, int fd_retrace); diff --git a/utils/v4l2-tracer/trace-helper.cpp b/utils/v4l2-tracer/trace-helper.cpp index a1e83a44fac2..b63363137164 100644 --- a/utils/v4l2-tracer/trace-helper.cpp +++ b/utils/v4l2-tracer/trace-helper.cpp @@ -85,10 +85,10 @@ void add_buffer_trace(int fd, __u32 type, __u32 index, __u32 offset = 0) ctx_trace.buffers.push_front(buf); } -void remove_buffer_trace(int fd) +void remove_buffer_trace(__u32 type, __u32 index) { for (auto it = ctx_trace.buffers.begin(); it != ctx_trace.buffers.end(); ++it) { - if (it->fd == fd) { + if ((it->type == type) && (it->index == index)) { ctx_trace.buffers.erase(it); break; } @@ -420,7 +420,7 @@ void expbuf_setup(struct v4l2_exportbuffer *export_buffer) * file descriptor, replace the video fd with the more specific buffer fd from EXPBUF. */ if (fd_found_in_trace_context != 0) - remove_buffer_trace(fd_found_in_trace_context); + remove_buffer_trace(type, index); add_buffer_trace(export_buffer->fd, type, index); } _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits