diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-08-06 08:10:06 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 10:53:49 -0400 |
commit | 3702627899db1d6a818c6e0b4ba5205f94bfbef4 (patch) | |
tree | e572f177b0c75afd265a1db087b24ff4f15015f0 /drivers/media/video | |
parent | a202a5bfb6c1d7c778f67f28b5f2caac21beafce (diff) |
V4L/DVB (4474): On some cases, depth were not returned.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 8 | ||||
-rw-r--r-- | drivers/media/video/v4l1-compat.c | 12 |
2 files changed, 17 insertions, 3 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 20dff7c316eb..3d7b97c661b9 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2431,6 +2431,14 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2431 | fbuf->bytesperline = btv->fbuf.fmt.bytesperline; | 2431 | fbuf->bytesperline = btv->fbuf.fmt.bytesperline; |
2432 | if (fh->ovfmt) | 2432 | if (fh->ovfmt) |
2433 | fbuf->depth = fh->ovfmt->depth; | 2433 | fbuf->depth = fh->ovfmt->depth; |
2434 | else { | ||
2435 | if (fbuf->width) | ||
2436 | fbuf->depth = ((fbuf->bytesperline<<3) | ||
2437 | + (fbuf->width-1) ) | ||
2438 | /fbuf->width; | ||
2439 | else | ||
2440 | fbuf->depth = 0; | ||
2441 | } | ||
2434 | return 0; | 2442 | return 0; |
2435 | } | 2443 | } |
2436 | case VIDIOCSFBUF: | 2444 | case VIDIOCSFBUF: |
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index d7c3fcbc80f7..1d899e2db394 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c | |||
@@ -349,6 +349,8 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
349 | { | 349 | { |
350 | struct video_buffer *buffer = arg; | 350 | struct video_buffer *buffer = arg; |
351 | 351 | ||
352 | memset(buffer, 0, sizeof(*buffer)); | ||
353 | |||
352 | err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); | 354 | err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); |
353 | if (err < 0) { | 355 | if (err < 0) { |
354 | dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err); | 356 | dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err); |
@@ -361,7 +363,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
361 | switch (fbuf2.fmt.pixelformat) { | 363 | switch (fbuf2.fmt.pixelformat) { |
362 | case V4L2_PIX_FMT_RGB332: | 364 | case V4L2_PIX_FMT_RGB332: |
363 | buffer->depth = 8; | 365 | buffer->depth = 8; |
364 | break; | 366 | break; |
365 | case V4L2_PIX_FMT_RGB555: | 367 | case V4L2_PIX_FMT_RGB555: |
366 | buffer->depth = 15; | 368 | buffer->depth = 15; |
367 | break; | 369 | break; |
@@ -377,9 +379,13 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
377 | default: | 379 | default: |
378 | buffer->depth = 0; | 380 | buffer->depth = 0; |
379 | } | 381 | } |
380 | if (0 != fbuf2.fmt.bytesperline) | 382 | if (fbuf2.fmt.bytesperline) { |
381 | buffer->bytesperline = fbuf2.fmt.bytesperline; | 383 | buffer->bytesperline = fbuf2.fmt.bytesperline; |
382 | else { | 384 | if (!buffer->depth && buffer->width) |
385 | buffer->depth = ((fbuf2.fmt.bytesperline<<3) | ||
386 | + (buffer->width-1) ) | ||
387 | /buffer->width; | ||
388 | } else { | ||
383 | buffer->bytesperline = | 389 | buffer->bytesperline = |
384 | (buffer->width * buffer->depth + 7) & 7; | 390 | (buffer->width * buffer->depth + 7) & 7; |
385 | buffer->bytesperline >>= 3; | 391 | buffer->bytesperline >>= 3; |