Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 76513
b: refs/heads/master
c: c240ad0
h: refs/heads/master
i:
  76511: 6d2d451
v: v3
  • Loading branch information
Ian Armstrong authored and Mauro Carvalho Chehab committed Jan 25, 2008
1 parent 0f9fb50 commit 7de8c5b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9de982d3117a3f83e4e7b14016a1df25b4a693d6
refs/heads/master: c240ad00af78228726e6301ad6ffc54d3adce2a0
8 changes: 2 additions & 6 deletions trunk/drivers/media/video/ivtv/ivtv-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
const struct pci_device_id *pci_id)
{
int retval = 0;
int yuv_buf_size;
int vbi_buf_size;
struct ivtv *itv;

Expand Down Expand Up @@ -1122,11 +1121,8 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
itv->stream_buf_size[IVTV_ENC_STREAM_TYPE_MPG] = 0x08000;
itv->stream_buf_size[IVTV_ENC_STREAM_TYPE_PCM] = 0x01200;
itv->stream_buf_size[IVTV_DEC_STREAM_TYPE_MPG] = 0x10000;

/* 0x15180 == 720 * 480 / 4, 0x19500 == 720 * 576 / 4 */
yuv_buf_size = itv->is_60hz ? 0x15180 : 0x19500;
itv->stream_buf_size[IVTV_DEC_STREAM_TYPE_YUV] = yuv_buf_size / 2;
itv->stream_buf_size[IVTV_ENC_STREAM_TYPE_YUV] = yuv_buf_size / 8;
itv->stream_buf_size[IVTV_DEC_STREAM_TYPE_YUV] = 0x10000;
itv->stream_buf_size[IVTV_ENC_STREAM_TYPE_YUV] = 0x08000;

/* Setup VBI Raw Size. Should be big enough to hold PAL.
It is possible to switch between PAL and NTSC, so we need to
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/media/video/ivtv/ivtv-driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ struct yuv_playback_info

void *blanking_ptr;
dma_addr_t blanking_dmaptr;

int stream_size;
};

#define IVTV_VBI_FRAMES 32
Expand Down
31 changes: 27 additions & 4 deletions trunk/drivers/media/video/ivtv/ivtv-fileops.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c
struct ivtv_open_id *id = filp->private_data;
struct ivtv *itv = id->itv;
struct ivtv_stream *s = &itv->streams[id->type];
struct yuv_playback_info *yi = &itv->yuv_info;
struct ivtv_buffer *buf;
struct ivtv_queue q;
int bytes_written = 0;
Expand Down Expand Up @@ -604,9 +605,16 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c

/* copy user data into buffers */
while ((buf = ivtv_dequeue(s, &q))) {
/* Make sure we really got all the user data */
rc = ivtv_buf_copy_from_user(s, buf, user_buf, count);
/* yuv is a pain. Don't copy more data than needed for a single
frame, otherwise we lose sync with the incoming stream */
if (s->type == IVTV_DEC_STREAM_TYPE_YUV &&
yi->stream_size + count > itv->dma_data_req_size)
rc = ivtv_buf_copy_from_user(s, buf, user_buf,
itv->dma_data_req_size - yi->stream_size);
else
rc = ivtv_buf_copy_from_user(s, buf, user_buf, count);

/* Make sure we really got all the user data */
if (rc < 0) {
ivtv_queue_move(s, &q, NULL, &s->q_free, 0);
return rc;
Expand All @@ -615,6 +623,16 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c
count -= rc;
bytes_written += rc;

if (s->type == IVTV_DEC_STREAM_TYPE_YUV) {
yi->stream_size += rc;
/* If we have a complete yuv frame, break loop now */
if (yi->stream_size == itv->dma_data_req_size) {
ivtv_enqueue(s, buf, &s->q_full);
yi->stream_size = 0;
break;
}
}

if (buf->bytesused != s->buf_size) {
/* incomplete, leave in q_io for next time */
ivtv_enqueue(s, buf, &s->q_io);
Expand Down Expand Up @@ -922,10 +940,15 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp)
}

/* YUV or MPG Decoding Mode? */
if (s->type == IVTV_DEC_STREAM_TYPE_MPG)
if (s->type == IVTV_DEC_STREAM_TYPE_MPG) {
clear_bit(IVTV_F_I_DEC_YUV, &itv->i_flags);
else if (s->type == IVTV_DEC_STREAM_TYPE_YUV)
} else if (s->type == IVTV_DEC_STREAM_TYPE_YUV) {
set_bit(IVTV_F_I_DEC_YUV, &itv->i_flags);
/* For yuv, we need to know the dma size before we start */
itv->dma_data_req_size =
itv->params.width * itv->params.height * 3 / 2;
itv->yuv_info.stream_size = 0;
}
return 0;
}

Expand Down
25 changes: 19 additions & 6 deletions trunk/drivers/media/video/ivtv/ivtv-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,28 @@ void ivtv_dma_stream_dec_prepare(struct ivtv_stream *s, u32 offset, int lock)
IVTV_DEBUG_HI_DMA("DEC PREPARE DMA %s: %08x %08x\n", s->name, s->q_predma.bytesused, offset);
list_for_each_entry(buf, &s->q_predma.list, list) {
/* YUV UV Offset from Y Buffer */
if (s->type == IVTV_DEC_STREAM_TYPE_YUV && !y_done && bytes_written >= y_size) {
if (s->type == IVTV_DEC_STREAM_TYPE_YUV && !y_done &&
(bytes_written + buf->bytesused) >= y_size) {
s->sg_pending[idx].src = buf->dma_handle;
s->sg_pending[idx].dst = offset;
s->sg_pending[idx].size = y_size - bytes_written;
offset = uv_offset;
if (s->sg_pending[idx].size != buf->bytesused) {
idx++;
s->sg_pending[idx].src =
buf->dma_handle + s->sg_pending[idx - 1].size;
s->sg_pending[idx].dst = offset;
s->sg_pending[idx].size =
buf->bytesused - s->sg_pending[idx - 1].size;
offset += s->sg_pending[idx].size;
}
y_done = 1;
} else {
s->sg_pending[idx].src = buf->dma_handle;
s->sg_pending[idx].dst = offset;
s->sg_pending[idx].size = buf->bytesused;
offset += buf->bytesused;
}
s->sg_pending[idx].src = buf->dma_handle;
s->sg_pending[idx].dst = offset;
s->sg_pending[idx].size = buf->bytesused;

offset += buf->bytesused;
bytes_written += buf->bytesused;

/* Sync SG buffers */
Expand Down

0 comments on commit 7de8c5b

Please sign in to comment.