aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/pci/ivtv/ivtv-ioctl.c36
-rw-r--r--drivers/media/pci/ivtv/ivtv-streams.c6
2 files changed, 30 insertions, 12 deletions
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 683beb4f1951..6fe6c4a0e858 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -448,9 +448,12 @@ static int ivtv_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f
448static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt) 448static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt)
449{ 449{
450 struct ivtv *itv = fh2id(fh)->itv; 450 struct ivtv *itv = fh2id(fh)->itv;
451 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
451 struct v4l2_window *winfmt = &fmt->fmt.win; 452 struct v4l2_window *winfmt = &fmt->fmt.win;
452 453
453 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) 454 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
455 return -EINVAL;
456 if (!itv->osd_video_pbase)
454 return -EINVAL; 457 return -EINVAL;
455 winfmt->chromakey = itv->osd_chroma_key; 458 winfmt->chromakey = itv->osd_chroma_key;
456 winfmt->global_alpha = itv->osd_global_alpha; 459 winfmt->global_alpha = itv->osd_global_alpha;
@@ -555,10 +558,13 @@ static int ivtv_try_fmt_vid_out(struct file *file, void *fh, struct v4l2_format
555static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt) 558static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt)
556{ 559{
557 struct ivtv *itv = fh2id(fh)->itv; 560 struct ivtv *itv = fh2id(fh)->itv;
561 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
558 u32 chromakey = fmt->fmt.win.chromakey; 562 u32 chromakey = fmt->fmt.win.chromakey;
559 u8 global_alpha = fmt->fmt.win.global_alpha; 563 u8 global_alpha = fmt->fmt.win.global_alpha;
560 564
561 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) 565 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
566 return -EINVAL;
567 if (!itv->osd_video_pbase)
562 return -EINVAL; 568 return -EINVAL;
563 ivtv_g_fmt_vid_out_overlay(file, fh, fmt); 569 ivtv_g_fmt_vid_out_overlay(file, fh, fmt);
564 fmt->fmt.win.chromakey = chromakey; 570 fmt->fmt.win.chromakey = chromakey;
@@ -741,6 +747,11 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc
741 snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev)); 747 snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev));
742 vcap->capabilities = itv->v4l2_cap | V4L2_CAP_DEVICE_CAPS; 748 vcap->capabilities = itv->v4l2_cap | V4L2_CAP_DEVICE_CAPS;
743 vcap->device_caps = s->caps; 749 vcap->device_caps = s->caps;
750 if ((s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY) &&
751 !itv->osd_video_pbase) {
752 vcap->capabilities &= ~V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
753 vcap->device_caps &= ~V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
754 }
744 return 0; 755 return 0;
745} 756}
746 757
@@ -1363,6 +1374,7 @@ static int ivtv_try_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder
1363static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) 1374static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
1364{ 1375{
1365 struct ivtv *itv = fh2id(fh)->itv; 1376 struct ivtv *itv = fh2id(fh)->itv;
1377 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1366 u32 data[CX2341X_MBOX_MAX_DATA]; 1378 u32 data[CX2341X_MBOX_MAX_DATA];
1367 struct yuv_playback_info *yi = &itv->yuv_info; 1379 struct yuv_playback_info *yi = &itv->yuv_info;
1368 1380
@@ -1386,10 +1398,10 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
1386 0, 1398 0,
1387 }; 1399 };
1388 1400
1389 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) 1401 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1390 return -EINVAL; 1402 return -ENOTTY;
1391 if (!itv->osd_video_pbase) 1403 if (!itv->osd_video_pbase)
1392 return -EINVAL; 1404 return -ENOTTY;
1393 1405
1394 fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY | 1406 fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY |
1395 V4L2_FBUF_CAP_GLOBAL_ALPHA; 1407 V4L2_FBUF_CAP_GLOBAL_ALPHA;
@@ -1450,12 +1462,13 @@ static int ivtv_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffe
1450{ 1462{
1451 struct ivtv_open_id *id = fh2id(fh); 1463 struct ivtv_open_id *id = fh2id(fh);
1452 struct ivtv *itv = id->itv; 1464 struct ivtv *itv = id->itv;
1465 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1453 struct yuv_playback_info *yi = &itv->yuv_info; 1466 struct yuv_playback_info *yi = &itv->yuv_info;
1454 1467
1455 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) 1468 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1456 return -EINVAL; 1469 return -ENOTTY;
1457 if (!itv->osd_video_pbase) 1470 if (!itv->osd_video_pbase)
1458 return -EINVAL; 1471 return -ENOTTY;
1459 1472
1460 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; 1473 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
1461 itv->osd_local_alpha_state = 1474 itv->osd_local_alpha_state =
@@ -1470,9 +1483,12 @@ static int ivtv_overlay(struct file *file, void *fh, unsigned int on)
1470{ 1483{
1471 struct ivtv_open_id *id = fh2id(fh); 1484 struct ivtv_open_id *id = fh2id(fh);
1472 struct ivtv *itv = id->itv; 1485 struct ivtv *itv = id->itv;
1486 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
1473 1487
1474 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) 1488 if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
1475 return -EINVAL; 1489 return -ENOTTY;
1490 if (!itv->osd_video_pbase)
1491 return -ENOTTY;
1476 1492
1477 ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, on != 0); 1493 ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, on != 0);
1478 1494
diff --git a/drivers/media/pci/ivtv/ivtv-streams.c b/drivers/media/pci/ivtv/ivtv-streams.c
index cfb61f23d8ed..d27c6df97566 100644
--- a/drivers/media/pci/ivtv/ivtv-streams.c
+++ b/drivers/media/pci/ivtv/ivtv-streams.c
@@ -130,7 +130,8 @@ static struct {
130 "decoder MPG", 130 "decoder MPG",
131 VFL_TYPE_GRABBER, IVTV_V4L2_DEC_MPG_OFFSET, 131 VFL_TYPE_GRABBER, IVTV_V4L2_DEC_MPG_OFFSET,
132 PCI_DMA_TODEVICE, 0, 132 PCI_DMA_TODEVICE, 0,
133 V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE, 133 V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE |
134 V4L2_CAP_VIDEO_OUTPUT_OVERLAY,
134 &ivtv_v4l2_dec_fops 135 &ivtv_v4l2_dec_fops
135 }, 136 },
136 { /* IVTV_DEC_STREAM_TYPE_VBI */ 137 { /* IVTV_DEC_STREAM_TYPE_VBI */
@@ -151,7 +152,8 @@ static struct {
151 "decoder YUV", 152 "decoder YUV",
152 VFL_TYPE_GRABBER, IVTV_V4L2_DEC_YUV_OFFSET, 153 VFL_TYPE_GRABBER, IVTV_V4L2_DEC_YUV_OFFSET,
153 PCI_DMA_TODEVICE, 0, 154 PCI_DMA_TODEVICE, 0,
154 V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE, 155 V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE |
156 V4L2_CAP_VIDEO_OUTPUT_OVERLAY,
155 &ivtv_v4l2_dec_fops 157 &ivtv_v4l2_dec_fops
156 } 158 }
157}; 159};