Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357150
b: refs/heads/master
c: 8732533
h: refs/heads/master
v: v3
  • Loading branch information
Frank Schaefer authored and Mauro Carvalho Chehab committed Dec 22, 2012
1 parent 4849a6b commit f905f78
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 33 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: cbe7f8a030f2056d5cee8c2729d5edd23ae61589
refs/heads/master: 8732533b3284ca078e3ea4a4721e43627ff7fa8e
53 changes: 24 additions & 29 deletions trunk/drivers/media/usb/em28xx/em28xx-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ static inline void finish_buffer(struct em28xx *dev,
* Identify the buffer header type and properly handles
*/
static void em28xx_copy_video(struct em28xx *dev,
struct em28xx_dmaqueue *dma_q,
struct em28xx_buffer *buf,
unsigned char *p,
unsigned char *outp, unsigned long len)
Expand All @@ -180,8 +179,8 @@ static void em28xx_copy_video(struct em28xx *dev,
int linesdone, currlinedone, offset, lencopy, remain;
int bytesperline = dev->width << 1;

if (dma_q->pos + len > buf->vb.size)
len = buf->vb.size - dma_q->pos;
if (buf->pos + len > buf->vb.size)
len = buf->vb.size - buf->pos;

startread = p;
remain = len;
Expand All @@ -191,8 +190,8 @@ static void em28xx_copy_video(struct em28xx *dev,
else /* interlaced mode, even nr. of lines */
fieldstart = outp + bytesperline;

linesdone = dma_q->pos / bytesperline;
currlinedone = dma_q->pos % bytesperline;
linesdone = buf->pos / bytesperline;
currlinedone = buf->pos % bytesperline;

if (dev->progressive)
offset = linesdone * bytesperline + currlinedone;
Expand Down Expand Up @@ -244,14 +243,13 @@ static void em28xx_copy_video(struct em28xx *dev,
remain -= lencopy;
}

dma_q->pos += len;
buf->pos += len;
}

static void em28xx_copy_vbi(struct em28xx *dev,
struct em28xx_dmaqueue *dma_q,
struct em28xx_buffer *buf,
unsigned char *p,
unsigned char *outp, unsigned long len)
struct em28xx_buffer *buf,
unsigned char *p,
unsigned char *outp, unsigned long len)
{
void *startwrite, *startread;
int offset;
Expand All @@ -263,10 +261,6 @@ static void em28xx_copy_vbi(struct em28xx *dev,
}
bytesperline = dev->vbi_width;

if (dma_q == NULL) {
em28xx_isocdbg("dma_q is null\n");
return;
}
if (buf == NULL) {
return;
}
Expand All @@ -279,13 +273,13 @@ static void em28xx_copy_vbi(struct em28xx *dev,
return;
}

if (dma_q->pos + len > buf->vb.size)
len = buf->vb.size - dma_q->pos;
if (buf->pos + len > buf->vb.size)
len = buf->vb.size - buf->pos;

startread = p;

startwrite = outp + dma_q->pos;
offset = dma_q->pos;
startwrite = outp + buf->pos;
offset = buf->pos;

/* Make sure the bottom field populates the second half of the frame */
if (buf->top_field == 0) {
Expand All @@ -294,7 +288,7 @@ static void em28xx_copy_vbi(struct em28xx *dev,
}

memcpy(startwrite, startread, len);
dma_q->pos += len;
buf->pos += len;
}

static inline void print_err_status(struct em28xx *dev,
Expand Down Expand Up @@ -355,6 +349,7 @@ static inline struct em28xx_buffer *get_next_buf(struct em28xx *dev,
/* Cleans up buffer - Useful for testing for frame/URB loss */
outp = videobuf_to_vmalloc(&buf->vb);
memset(outp, 0, buf->vb.size);
buf->pos = 0;

return buf;
}
Expand Down Expand Up @@ -474,22 +469,22 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
}

if (dev->vbi_read == 0) {
vbi_dma_q->pos = 0;
if (vbi_buf != NULL)
if (vbi_buf != NULL) {
vbi_buf->top_field
= dev->top_field;
vbi_buf->pos = 0;
}
}

dev->vbi_read += len;
em28xx_copy_vbi(dev, vbi_dma_q, vbi_buf, p,
vbioutp, len);
em28xx_copy_vbi(dev, vbi_buf, p, vbioutp, len);
} else {
/* Some of this frame is VBI data and some is
video data */
int vbi_data_len = vbi_size - dev->vbi_read;
dev->vbi_read += vbi_data_len;
em28xx_copy_vbi(dev, vbi_dma_q, vbi_buf, p,
vbioutp, vbi_data_len);
em28xx_copy_vbi(dev, vbi_buf, p, vbioutp,
vbi_data_len);
dev->capture_type = 1;
p += vbi_data_len;
len -= vbi_data_len;
Expand All @@ -508,14 +503,14 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
else
outp = videobuf_to_vmalloc(&buf->vb);
}
if (buf != NULL)
if (buf != NULL) {
buf->top_field = dev->top_field;

dma_q->pos = 0;
buf->pos = 0;
}
}

if (buf != NULL && dev->capture_type == 2 && len > 0)
em28xx_copy_video(dev, dma_q, buf, p, outp, len);
em28xx_copy_video(dev, buf, p, outp, len);
}
return rc;
}
Expand Down
8 changes: 5 additions & 3 deletions trunk/drivers/media/usb/em28xx/em28xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,17 @@ struct em28xx_buffer {
struct videobuf_buffer vb;

int top_field;

/* counter to control buffer fill */
unsigned int pos;
/* NOTE; in interlaced mode, this value is reset to zero at
* the start of each new field (not frame !) */
};

struct em28xx_dmaqueue {
struct list_head active;

wait_queue_head_t wq;

/* Counters to control buffer fill */
int pos;
};

/* inputs */
Expand Down

0 comments on commit f905f78

Please sign in to comment.