diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-31 07:35:57 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-31 07:35:57 -0500 |
commit | 2ca1a615835d9f4990f42102ab1f2ef434e7e89c (patch) | |
tree | 726cf3d5f29a6c66c44e4bd68e7ebed2fd83d059 /drivers/media/video/cx18/cx18-fileops.c | |
parent | e12f0102ac81d660c9f801d0a0e10ccf4537a9de (diff) | |
parent | 6a94cb73064c952255336cc57731904174b2c58f (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
arch/x86/kernel/io_apic.c
Diffstat (limited to 'drivers/media/video/cx18/cx18-fileops.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-fileops.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c index 5f9089907544..425271a29517 100644 --- a/drivers/media/video/cx18/cx18-fileops.c +++ b/drivers/media/video/cx18/cx18-fileops.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Derived from ivtv-fileops.c | 4 | * Derived from ivtv-fileops.c |
5 | * | 5 | * |
6 | * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> | 6 | * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> |
7 | * Copyright (C) 2008 Andy Walls <awalls@radix.net> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
@@ -66,12 +67,11 @@ static int cx18_claim_stream(struct cx18_open_id *id, int type) | |||
66 | } | 67 | } |
67 | s->id = id->open_id; | 68 | s->id = id->open_id; |
68 | 69 | ||
69 | /* CX18_DEC_STREAM_TYPE_MPG needs to claim CX18_DEC_STREAM_TYPE_VBI, | 70 | /* CX18_ENC_STREAM_TYPE_MPG needs to claim CX18_ENC_STREAM_TYPE_VBI |
70 | CX18_ENC_STREAM_TYPE_MPG needs to claim CX18_ENC_STREAM_TYPE_VBI | ||
71 | (provided VBI insertion is on and sliced VBI is selected), for all | 71 | (provided VBI insertion is on and sliced VBI is selected), for all |
72 | other streams we're done */ | 72 | other streams we're done */ |
73 | if (type == CX18_ENC_STREAM_TYPE_MPG && | 73 | if (type == CX18_ENC_STREAM_TYPE_MPG && |
74 | cx->vbi.insert_mpeg && cx->vbi.sliced_in->service_set) { | 74 | cx->vbi.insert_mpeg && !cx18_raw_vbi(cx)) { |
75 | vbi_type = CX18_ENC_STREAM_TYPE_VBI; | 75 | vbi_type = CX18_ENC_STREAM_TYPE_VBI; |
76 | } else { | 76 | } else { |
77 | return 0; | 77 | return 0; |
@@ -185,8 +185,10 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block, | |||
185 | !test_bit(CX18_F_S_APPL_IO, &s_vbi->s_flags)) { | 185 | !test_bit(CX18_F_S_APPL_IO, &s_vbi->s_flags)) { |
186 | while ((buf = cx18_dequeue(s_vbi, &s_vbi->q_full))) { | 186 | while ((buf = cx18_dequeue(s_vbi, &s_vbi->q_full))) { |
187 | /* byteswap and process VBI data */ | 187 | /* byteswap and process VBI data */ |
188 | /* cx18_process_vbi_data(cx, buf, s_vbi->dma_pts, s_vbi->type); */ | 188 | cx18_process_vbi_data(cx, buf, |
189 | cx18_enqueue(s_vbi, buf, &s_vbi->q_free); | 189 | s_vbi->dma_pts, |
190 | s_vbi->type); | ||
191 | cx18_stream_put_buf_fw(s_vbi, buf); | ||
190 | } | 192 | } |
191 | } | 193 | } |
192 | buf = &cx->vbi.sliced_mpeg_buf; | 194 | buf = &cx->vbi.sliced_mpeg_buf; |
@@ -194,11 +196,6 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block, | |||
194 | return buf; | 196 | return buf; |
195 | } | 197 | } |
196 | 198 | ||
197 | /* do we have leftover data? */ | ||
198 | buf = cx18_dequeue(s, &s->q_io); | ||
199 | if (buf) | ||
200 | return buf; | ||
201 | |||
202 | /* do we have new data? */ | 199 | /* do we have new data? */ |
203 | buf = cx18_dequeue(s, &s->q_full); | 200 | buf = cx18_dequeue(s, &s->q_full); |
204 | if (buf) { | 201 | if (buf) { |
@@ -262,7 +259,7 @@ static size_t cx18_copy_buf_to_user(struct cx18_stream *s, | |||
262 | if (len > ucount) | 259 | if (len > ucount) |
263 | len = ucount; | 260 | len = ucount; |
264 | if (cx->vbi.insert_mpeg && s->type == CX18_ENC_STREAM_TYPE_MPG && | 261 | if (cx->vbi.insert_mpeg && s->type == CX18_ENC_STREAM_TYPE_MPG && |
265 | cx->vbi.sliced_in->service_set && buf != &cx->vbi.sliced_mpeg_buf) { | 262 | !cx18_raw_vbi(cx) && buf != &cx->vbi.sliced_mpeg_buf) { |
266 | const char *start = buf->buf + buf->readpos; | 263 | const char *start = buf->buf + buf->readpos; |
267 | const char *p = start + 1; | 264 | const char *p = start + 1; |
268 | const u8 *q; | 265 | const u8 *q; |
@@ -337,8 +334,7 @@ static ssize_t cx18_read(struct cx18_stream *s, char __user *ubuf, | |||
337 | /* Each VBI buffer is one frame, the v4l2 API says that for VBI the | 334 | /* Each VBI buffer is one frame, the v4l2 API says that for VBI the |
338 | frames should arrive one-by-one, so make sure we never output more | 335 | frames should arrive one-by-one, so make sure we never output more |
339 | than one VBI frame at a time */ | 336 | than one VBI frame at a time */ |
340 | if (s->type == CX18_ENC_STREAM_TYPE_VBI && | 337 | if (s->type == CX18_ENC_STREAM_TYPE_VBI && !cx18_raw_vbi(cx)) |
341 | cx->vbi.sliced_in->service_set) | ||
342 | single_frame = 1; | 338 | single_frame = 1; |
343 | 339 | ||
344 | for (;;) { | 340 | for (;;) { |
@@ -365,16 +361,10 @@ static ssize_t cx18_read(struct cx18_stream *s, char __user *ubuf, | |||
365 | tot_count - tot_written); | 361 | tot_count - tot_written); |
366 | 362 | ||
367 | if (buf != &cx->vbi.sliced_mpeg_buf) { | 363 | if (buf != &cx->vbi.sliced_mpeg_buf) { |
368 | if (buf->readpos == buf->bytesused) { | 364 | if (buf->readpos == buf->bytesused) |
369 | cx18_buf_sync_for_device(s, buf); | 365 | cx18_stream_put_buf_fw(s, buf); |
370 | cx18_enqueue(s, buf, &s->q_free); | 366 | else |
371 | cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, | 367 | cx18_push(s, buf, &s->q_full); |
372 | s->handle, | ||
373 | (void __iomem *)&cx->scb->cpu_mdl[buf->id] - | ||
374 | cx->enc_mem, | ||
375 | 1, buf->id, s->buf_size); | ||
376 | } else | ||
377 | cx18_enqueue(s, buf, &s->q_io); | ||
378 | } else if (buf->readpos == buf->bytesused) { | 368 | } else if (buf->readpos == buf->bytesused) { |
379 | int idx = cx->vbi.inserted_frame % CX18_VBI_FRAMES; | 369 | int idx = cx->vbi.inserted_frame % CX18_VBI_FRAMES; |
380 | 370 | ||
@@ -518,7 +508,7 @@ unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait) | |||
518 | CX18_DEBUG_HI_FILE("Encoder poll\n"); | 508 | CX18_DEBUG_HI_FILE("Encoder poll\n"); |
519 | poll_wait(filp, &s->waitq, wait); | 509 | poll_wait(filp, &s->waitq, wait); |
520 | 510 | ||
521 | if (atomic_read(&s->q_full.buffers) || atomic_read(&s->q_io.buffers)) | 511 | if (atomic_read(&s->q_full.buffers)) |
522 | return POLLIN | POLLRDNORM; | 512 | return POLLIN | POLLRDNORM; |
523 | if (eof) | 513 | if (eof) |
524 | return POLLHUP; | 514 | return POLLHUP; |