Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320151
b: refs/heads/master
c: c5a8614
h: refs/heads/master
i:
  320149: 6fbaf68
  320147: 9419c1a
  320143: 867913d
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jul 6, 2012
1 parent 76b2b02 commit 286b615
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 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: edbd138ed0cae5abe469b61e368d2629815d4c37
refs/heads/master: c5a861449fcd4f50d30376986ebdb0692f0bf1f1
49 changes: 27 additions & 22 deletions trunk/drivers/media/video/cx88/cx88-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,9 @@ static int
buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{
struct cx8800_fh *fh = q->priv_data;
struct cx8800_dev *dev = fh->dev;

*size = fh->fmt->depth*fh->width*fh->height >> 3;
*size = dev->fmt->depth * dev->width * dev->height >> 3;
if (0 == *count)
*count = 32;
if (*size * *count > vid_limit * 1024 * 1024)
Expand All @@ -539,21 +540,21 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
int rc, init_buffer = 0;

BUG_ON(NULL == fh->fmt);
if (fh->width < 48 || fh->width > norm_maxw(core->tvnorm) ||
fh->height < 32 || fh->height > norm_maxh(core->tvnorm))
BUG_ON(NULL == dev->fmt);
if (dev->width < 48 || dev->width > norm_maxw(core->tvnorm) ||
dev->height < 32 || dev->height > norm_maxh(core->tvnorm))
return -EINVAL;
buf->vb.size = (fh->width * fh->height * fh->fmt->depth) >> 3;
buf->vb.size = (dev->width * dev->height * dev->fmt->depth) >> 3;
if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size)
return -EINVAL;

if (buf->fmt != fh->fmt ||
buf->vb.width != fh->width ||
buf->vb.height != fh->height ||
if (buf->fmt != dev->fmt ||
buf->vb.width != dev->width ||
buf->vb.height != dev->height ||
buf->vb.field != field) {
buf->fmt = fh->fmt;
buf->vb.width = fh->width;
buf->vb.height = fh->height;
buf->fmt = dev->fmt;
buf->vb.width = dev->width;
buf->vb.height = dev->height;
buf->vb.field = field;
init_buffer = 1;
}
Expand Down Expand Up @@ -603,7 +604,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
}
dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
buf, buf->vb.i,
fh->width, fh->height, fh->fmt->depth, fh->fmt->name,
dev->width, dev->height, dev->fmt->depth, dev->fmt->name,
(unsigned long)buf->risc.dma);

buf->vb.state = VIDEOBUF_PREPARED;
Expand Down Expand Up @@ -745,9 +746,6 @@ static int video_open(struct file *file)

file->private_data = fh;
fh->dev = dev;
fh->width = 320;
fh->height = 240;
fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);

mutex_lock(&core->lock);

Expand Down Expand Up @@ -1005,15 +1003,17 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
struct cx8800_fh *fh = priv;
struct cx8800_dev *dev = fh->dev;

f->fmt.pix.width = fh->width;
f->fmt.pix.height = fh->height;
f->fmt.pix.width = dev->width;
f->fmt.pix.height = dev->height;
f->fmt.pix.field = fh->vidq.field;
f->fmt.pix.pixelformat = fh->fmt->fourcc;
f->fmt.pix.pixelformat = dev->fmt->fourcc;
f->fmt.pix.bytesperline =
(f->fmt.pix.width * fh->fmt->depth) >> 3;
(f->fmt.pix.width * dev->fmt->depth) >> 3;
f->fmt.pix.sizeimage =
f->fmt.pix.height * f->fmt.pix.bytesperline;
f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
return 0;
}

Expand Down Expand Up @@ -1065,13 +1065,14 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
struct cx8800_fh *fh = priv;
struct cx8800_dev *dev = fh->dev;
int err = vidioc_try_fmt_vid_cap (file,priv,f);

if (0 != err)
return err;
fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat);
fh->width = f->fmt.pix.width;
fh->height = f->fmt.pix.height;
dev->fmt = format_by_fourcc(f->fmt.pix.pixelformat);
dev->width = f->fmt.pix.width;
dev->height = f->fmt.pix.height;
fh->vidq.field = f->fmt.pix.field;
return 0;
}
Expand Down Expand Up @@ -1787,6 +1788,10 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
/* Sets device info at pci_dev */
pci_set_drvdata(pci_dev, dev);

dev->width = 320;
dev->height = 240;
dev->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);

/* initial device configuration */
mutex_lock(&core->lock);
cx88_set_tvnorm(core, core->tvnorm);
Expand Down
9 changes: 2 additions & 7 deletions trunk/drivers/media/video/cx88/cx88.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,7 @@ struct cx8800_fh {
struct cx8800_dev *dev;
unsigned int resources;

/* video overlay */
struct v4l2_window win;
struct v4l2_clip *clips;
unsigned int nclips;

/* video capture */
const struct cx8800_fmt *fmt;
unsigned int width,height;
struct videobuf_queue vidq;

/* vbi capture */
Expand All @@ -489,6 +482,8 @@ struct cx8800_dev {
struct pci_dev *pci;
unsigned char pci_rev,pci_lat;

const struct cx8800_fmt *fmt;
unsigned int width, height;

/* capture queues */
struct cx88_dmaqueue vidq;
Expand Down

0 comments on commit 286b615

Please sign in to comment.