diff options
author | Simon Farnsworth <simon.farnsworth@onelan.co.uk> | 2011-05-03 07:57:40 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:30:22 -0400 |
commit | 1bf5842fe3b61d2dbbced96dbd27ad26fe93444a (patch) | |
tree | 26c19327c2668ca8690e3a47b0846f9825beb991 /drivers/media/video/cx18/cx18-mailbox.c | |
parent | 81dfea886c73ea36439672b90626a354354dadd2 (diff) |
[media] cx18: Clean up mmap() support for raw YUV
The initial version of this patch (commit
d5976931639176bb6777755d96b9f8d959f79e9e) had some issues:
* It didn't correctly calculate the size of the YUV buffer for 4:2:2,
resulting in capture sometimes being offset by 1/3rd of a picture.
* There were a lot of variables duplicating information the driver
already knew, which have been removed.
* There was an in-kernel format conversion - libv4l can do this one,
and is the right place to do format conversions anyway.
* Some magic numbers weren't properly explained.
Fix all these issues, leaving just the move from videobuf to videobuf2
to do.
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Acked-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-mailbox.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-mailbox.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c index d4d88738d893..5ecae931ac36 100644 --- a/drivers/media/video/cx18/cx18-mailbox.c +++ b/drivers/media/video/cx18/cx18-mailbox.c | |||
@@ -177,7 +177,7 @@ static void cx18_mdl_send_to_videobuf(struct cx18_stream *s, | |||
177 | if (list_empty(&s->vb_capture)) | 177 | if (list_empty(&s->vb_capture)) |
178 | goto out; | 178 | goto out; |
179 | 179 | ||
180 | vb_buf = list_entry(s->vb_capture.next, struct cx18_videobuf_buffer, | 180 | vb_buf = list_first_entry(&s->vb_capture, struct cx18_videobuf_buffer, |
181 | vb.queue); | 181 | vb.queue); |
182 | 182 | ||
183 | p = videobuf_to_vmalloc(&vb_buf->vb); | 183 | p = videobuf_to_vmalloc(&vb_buf->vb); |
@@ -202,25 +202,14 @@ static void cx18_mdl_send_to_videobuf(struct cx18_stream *s, | |||
202 | vb_buf->bytes_used = 0; | 202 | vb_buf->bytes_used = 0; |
203 | } | 203 | } |
204 | 204 | ||
205 | /* */ | ||
206 | if (dispatch) { | 205 | if (dispatch) { |
207 | 206 | ktime_get_ts(&vb_buf->vb.ts); | |
208 | if (s->pixelformat == V4L2_PIX_FMT_YUYV) { | ||
209 | /* UYVY to YUYV */ | ||
210 | for (i = 0; i < (720 * 480 * 2); i += 2) { | ||
211 | u = *(p + i); | ||
212 | *(p + i) = *(p + i + 1); | ||
213 | *(p + i + 1) = u; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | do_gettimeofday(&vb_buf->vb.ts); | ||
218 | list_del(&vb_buf->vb.queue); | 207 | list_del(&vb_buf->vb.queue); |
219 | vb_buf->vb.state = VIDEOBUF_DONE; | 208 | vb_buf->vb.state = VIDEOBUF_DONE; |
220 | wake_up(&vb_buf->vb.done); | 209 | wake_up(&vb_buf->vb.done); |
221 | } | 210 | } |
222 | 211 | ||
223 | mod_timer(&s->vb_timeout, jiffies + (HZ / 10)); | 212 | mod_timer(&s->vb_timeout, msecs_to_jiffies(2000) + jiffies); |
224 | 213 | ||
225 | out: | 214 | out: |
226 | spin_unlock(&s->vb_lock); | 215 | spin_unlock(&s->vb_lock); |