diff options
author | Hans Verkuil <hansverk@cisco.com> | 2013-12-04 09:14:05 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-12-10 02:40:57 -0500 |
commit | a5e3d743cb6ed2d73546eaf070138202c0c64a6f (patch) | |
tree | 1d6618189bd6824d56e8eb8bdd76ff62863511ec /drivers/media | |
parent | 3d8b24d27808e6ab95eae70cb15315051a7f90eb (diff) |
[media] vb2: regression fix: always set length field.
Commit dc77523c5da5513df1bbc74db2a522a94f4cec0e ensured that m.offset is
only set for the MMAP memory mode by calling __setup_offsets only for that
mode.
However, __setup_offsets also initializes the length fields, and that should
be done regardless of the memory mode. Because of that change the v4l2-ctl
test application fails for the USERPTR mode.
This fix creates a __setup_lengths function that sets the length, and
__setup_offsets just sets the offset and no longer touches the length.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-core.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 57ba131f08ad..0edc165f418d 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -145,6 +145,25 @@ static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb) | |||
145 | } | 145 | } |
146 | 146 | ||
147 | /** | 147 | /** |
148 | * __setup_lengths() - setup initial lengths for every plane in | ||
149 | * every buffer on the queue | ||
150 | */ | ||
151 | static void __setup_lengths(struct vb2_queue *q, unsigned int n) | ||
152 | { | ||
153 | unsigned int buffer, plane; | ||
154 | struct vb2_buffer *vb; | ||
155 | |||
156 | for (buffer = q->num_buffers; buffer < q->num_buffers + n; ++buffer) { | ||
157 | vb = q->bufs[buffer]; | ||
158 | if (!vb) | ||
159 | continue; | ||
160 | |||
161 | for (plane = 0; plane < vb->num_planes; ++plane) | ||
162 | vb->v4l2_planes[plane].length = q->plane_sizes[plane]; | ||
163 | } | ||
164 | } | ||
165 | |||
166 | /** | ||
148 | * __setup_offsets() - setup unique offsets ("cookies") for every plane in | 167 | * __setup_offsets() - setup unique offsets ("cookies") for every plane in |
149 | * every buffer on the queue | 168 | * every buffer on the queue |
150 | */ | 169 | */ |
@@ -169,7 +188,6 @@ static void __setup_offsets(struct vb2_queue *q, unsigned int n) | |||
169 | continue; | 188 | continue; |
170 | 189 | ||
171 | for (plane = 0; plane < vb->num_planes; ++plane) { | 190 | for (plane = 0; plane < vb->num_planes; ++plane) { |
172 | vb->v4l2_planes[plane].length = q->plane_sizes[plane]; | ||
173 | vb->v4l2_planes[plane].m.mem_offset = off; | 191 | vb->v4l2_planes[plane].m.mem_offset = off; |
174 | 192 | ||
175 | dprintk(3, "Buffer %d, plane %d offset 0x%08lx\n", | 193 | dprintk(3, "Buffer %d, plane %d offset 0x%08lx\n", |
@@ -241,6 +259,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum v4l2_memory memory, | |||
241 | q->bufs[q->num_buffers + buffer] = vb; | 259 | q->bufs[q->num_buffers + buffer] = vb; |
242 | } | 260 | } |
243 | 261 | ||
262 | __setup_lengths(q, buffer); | ||
244 | if (memory == V4L2_MEMORY_MMAP) | 263 | if (memory == V4L2_MEMORY_MMAP) |
245 | __setup_offsets(q, buffer); | 264 | __setup_offsets(q, buffer); |
246 | 265 | ||