Commit 37026278 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (4474): On some cases, depth were not returned.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent a202a5bf
...@@ -2431,6 +2431,14 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, ...@@ -2431,6 +2431,14 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
fbuf->bytesperline = btv->fbuf.fmt.bytesperline; fbuf->bytesperline = btv->fbuf.fmt.bytesperline;
if (fh->ovfmt) if (fh->ovfmt)
fbuf->depth = fh->ovfmt->depth; fbuf->depth = fh->ovfmt->depth;
else {
if (fbuf->width)
fbuf->depth = ((fbuf->bytesperline<<3)
+ (fbuf->width-1) )
/fbuf->width;
else
fbuf->depth = 0;
}
return 0; return 0;
} }
case VIDIOCSFBUF: case VIDIOCSFBUF:
......
...@@ -349,6 +349,8 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -349,6 +349,8 @@ v4l_compat_translate_ioctl(struct inode *inode,
{ {
struct video_buffer *buffer = arg; struct video_buffer *buffer = arg;
memset(buffer, 0, sizeof(*buffer));
err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2);
if (err < 0) { if (err < 0) {
dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err); dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err);
...@@ -377,9 +379,13 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -377,9 +379,13 @@ v4l_compat_translate_ioctl(struct inode *inode,
default: default:
buffer->depth = 0; buffer->depth = 0;
} }
if (0 != fbuf2.fmt.bytesperline) if (fbuf2.fmt.bytesperline) {
buffer->bytesperline = fbuf2.fmt.bytesperline; buffer->bytesperline = fbuf2.fmt.bytesperline;
else { if (!buffer->depth && buffer->width)
buffer->depth = ((fbuf2.fmt.bytesperline<<3)
+ (buffer->width-1) )
/buffer->width;
} else {
buffer->bytesperline = buffer->bytesperline =
(buffer->width * buffer->depth + 7) & 7; (buffer->width * buffer->depth + 7) & 7;
buffer->bytesperline >>= 3; buffer->bytesperline >>= 3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment