diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-06-22 10:57:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:11:51 -0400 |
commit | 37f89f9542c3945bddf46efc15a1b1e349af3f88 (patch) | |
tree | 5020c56d1b73c13e8e1a7425f55c703745cf12ca /drivers/media/video/ivtv | |
parent | 21575c13125f2ef790e192e2c70e446c6cfe0d7d (diff) |
V4L/DVB (8104): cx18/ivtv: ioctl debugging improvements
Completely rely on the video_ioctl2 debugging facilities rather than
doing it ourselves.
Fill in some missing fields in ivtv with VIDIOC_G_FBUF.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-controls.c | 16 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 21 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-streams.c | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtvfb.c | 3 |
4 files changed, 21 insertions, 23 deletions
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c index 06723bac99c5..2df9b0668f1f 100644 --- a/drivers/media/video/ivtv/ivtv-controls.c +++ b/drivers/media/video/ivtv/ivtv-controls.c | |||
@@ -53,8 +53,6 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl) | |||
53 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 53 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; |
54 | const char *name; | 54 | const char *name; |
55 | 55 | ||
56 | IVTV_DEBUG_IOCTL("VIDIOC_QUERYCTRL(%08x)\n", qctrl->id); | ||
57 | |||
58 | qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); | 56 | qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); |
59 | if (qctrl->id == 0) | 57 | if (qctrl->id == 0) |
60 | return -EINVAL; | 58 | return -EINVAL; |
@@ -91,10 +89,8 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl) | |||
91 | 89 | ||
92 | int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) | 90 | int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) |
93 | { | 91 | { |
94 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | ||
95 | struct v4l2_queryctrl qctrl; | 92 | struct v4l2_queryctrl qctrl; |
96 | 93 | ||
97 | IVTV_DEBUG_IOCTL("VIDIOC_QUERYMENU\n"); | ||
98 | qctrl.id = qmenu->id; | 94 | qctrl.id = qmenu->id; |
99 | ivtv_queryctrl(file, fh, &qctrl); | 95 | ivtv_queryctrl(file, fh, &qctrl); |
100 | return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); | 96 | return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); |
@@ -103,9 +99,6 @@ int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) | |||
103 | int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | 99 | int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) |
104 | { | 100 | { |
105 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 101 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; |
106 | s32 v = vctrl->value; | ||
107 | |||
108 | IVTV_DEBUG_IOCTL("VIDIOC_S_CTRL(%08x, %x)\n", vctrl->id, v); | ||
109 | 102 | ||
110 | switch (vctrl->id) { | 103 | switch (vctrl->id) { |
111 | /* Standard V4L2 controls */ | 104 | /* Standard V4L2 controls */ |
@@ -124,7 +117,7 @@ int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | |||
124 | return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl); | 117 | return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl); |
125 | 118 | ||
126 | default: | 119 | default: |
127 | IVTV_DEBUG_IOCTL("invalid control %x\n", vctrl->id); | 120 | IVTV_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id); |
128 | return -EINVAL; | 121 | return -EINVAL; |
129 | } | 122 | } |
130 | return 0; | 123 | return 0; |
@@ -134,8 +127,6 @@ int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | |||
134 | { | 127 | { |
135 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 128 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; |
136 | 129 | ||
137 | IVTV_DEBUG_IOCTL("VIDIOC_G_CTRL(%08x)\n", vctrl->id); | ||
138 | |||
139 | switch (vctrl->id) { | 130 | switch (vctrl->id) { |
140 | /* Standard V4L2 controls */ | 131 | /* Standard V4L2 controls */ |
141 | case V4L2_CID_BRIGHTNESS: | 132 | case V4L2_CID_BRIGHTNESS: |
@@ -152,7 +143,7 @@ int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | |||
152 | case V4L2_CID_AUDIO_LOUDNESS: | 143 | case V4L2_CID_AUDIO_LOUDNESS: |
153 | return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl); | 144 | return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl); |
154 | default: | 145 | default: |
155 | IVTV_DEBUG_IOCTL("invalid control %x\n", vctrl->id); | 146 | IVTV_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id); |
156 | return -EINVAL; | 147 | return -EINVAL; |
157 | } | 148 | } |
158 | return 0; | 149 | return 0; |
@@ -219,7 +210,6 @@ int ivtv_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
219 | } | 210 | } |
220 | return err; | 211 | return err; |
221 | } | 212 | } |
222 | IVTV_DEBUG_IOCTL("VIDIOC_G_EXT_CTRLS\n"); | ||
223 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) | 213 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) |
224 | return cx2341x_ext_ctrls(&itv->params, 0, c, VIDIOC_G_EXT_CTRLS); | 214 | return cx2341x_ext_ctrls(&itv->params, 0, c, VIDIOC_G_EXT_CTRLS); |
225 | return -EINVAL; | 215 | return -EINVAL; |
@@ -246,7 +236,6 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
246 | } | 236 | } |
247 | return err; | 237 | return err; |
248 | } | 238 | } |
249 | IVTV_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n"); | ||
250 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) { | 239 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) { |
251 | static u32 freqs[3] = { 44100, 48000, 32000 }; | 240 | static u32 freqs[3] = { 44100, 48000, 32000 }; |
252 | struct cx2341x_mpeg_params p = itv->params; | 241 | struct cx2341x_mpeg_params p = itv->params; |
@@ -286,7 +275,6 @@ int ivtv_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
286 | { | 275 | { |
287 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 276 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; |
288 | 277 | ||
289 | IVTV_DEBUG_IOCTL("VIDIOC_TRY_EXT_CTRLS\n"); | ||
290 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) | 278 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) |
291 | return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS); | 279 | return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS); |
292 | return -EINVAL; | 280 | return -EINVAL; |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index aa222056dd47..8d602cb6ba68 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1336,6 +1336,8 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) | |||
1336 | 1336 | ||
1337 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) | 1337 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
1338 | return -EINVAL; | 1338 | return -EINVAL; |
1339 | if (!itv->osd_video_pbase) | ||
1340 | return -EINVAL; | ||
1339 | 1341 | ||
1340 | fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY | | 1342 | fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY | |
1341 | V4L2_FBUF_CAP_GLOBAL_ALPHA; | 1343 | V4L2_FBUF_CAP_GLOBAL_ALPHA; |
@@ -1349,11 +1351,15 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) | |||
1349 | fb->fmt.height = itv->osd_rect.height; | 1351 | fb->fmt.height = itv->osd_rect.height; |
1350 | fb->fmt.field = V4L2_FIELD_INTERLACED; | 1352 | fb->fmt.field = V4L2_FIELD_INTERLACED; |
1351 | fb->fmt.bytesperline = fb->fmt.width; | 1353 | fb->fmt.bytesperline = fb->fmt.width; |
1354 | fb->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M; | ||
1355 | fb->fmt.field = V4L2_FIELD_INTERLACED; | ||
1356 | fb->fmt.priv = 0; | ||
1352 | if (fb->fmt.pixelformat != V4L2_PIX_FMT_PAL8) | 1357 | if (fb->fmt.pixelformat != V4L2_PIX_FMT_PAL8) |
1353 | fb->fmt.bytesperline *= 2; | 1358 | fb->fmt.bytesperline *= 2; |
1354 | if (fb->fmt.pixelformat == V4L2_PIX_FMT_RGB32 || | 1359 | if (fb->fmt.pixelformat == V4L2_PIX_FMT_RGB32 || |
1355 | fb->fmt.pixelformat == V4L2_PIX_FMT_YUV32) | 1360 | fb->fmt.pixelformat == V4L2_PIX_FMT_YUV32) |
1356 | fb->fmt.bytesperline *= 2; | 1361 | fb->fmt.bytesperline *= 2; |
1362 | fb->fmt.sizeimage = fb->fmt.bytesperline * fb->fmt.height; | ||
1357 | fb->base = (void *)itv->osd_video_pbase; | 1363 | fb->base = (void *)itv->osd_video_pbase; |
1358 | fb->flags = 0; | 1364 | fb->flags = 0; |
1359 | 1365 | ||
@@ -1396,6 +1402,8 @@ static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) | |||
1396 | 1402 | ||
1397 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) | 1403 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
1398 | return -EINVAL; | 1404 | return -EINVAL; |
1405 | if (!itv->osd_video_pbase) | ||
1406 | return -EINVAL; | ||
1399 | 1407 | ||
1400 | itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; | 1408 | itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; |
1401 | itv->osd_local_alpha_state = | 1409 | itv->osd_local_alpha_state = |
@@ -1744,6 +1752,7 @@ static int ivtv_default(struct file *file, void *fh, int cmd, void *arg) | |||
1744 | static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp, | 1752 | static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp, |
1745 | unsigned int cmd, unsigned long arg) | 1753 | unsigned int cmd, unsigned long arg) |
1746 | { | 1754 | { |
1755 | struct video_device *vfd = video_devdata(filp); | ||
1747 | struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; | 1756 | struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; |
1748 | int ret; | 1757 | int ret; |
1749 | 1758 | ||
@@ -1812,13 +1821,11 @@ static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct f | |||
1812 | return ret; | 1821 | return ret; |
1813 | } | 1822 | } |
1814 | 1823 | ||
1815 | if (ivtv_debug & IVTV_DBGFLG_IOCTL) { | 1824 | if (ivtv_debug & IVTV_DBGFLG_IOCTL) |
1816 | printk(KERN_INFO "ivtv%d ioctl: ", itv->num); | 1825 | vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; |
1817 | v4l_printk_ioctl(cmd); | 1826 | ret = video_ioctl2(inode, filp, cmd, arg); |
1818 | printk("\n"); | 1827 | vfd->debug = 0; |
1819 | } | 1828 | return ret; |
1820 | |||
1821 | return video_ioctl2(inode, filp, cmd, arg); | ||
1822 | } | 1829 | } |
1823 | 1830 | ||
1824 | int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | 1831 | int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index f8883b487f4a..8e3addd45090 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -213,8 +213,8 @@ static int ivtv_prep_dev(struct ivtv *itv, int type) | |||
213 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { | 213 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { |
214 | s->v4l2dev->type |= VID_TYPE_MPEG_DECODER; | 214 | s->v4l2dev->type |= VID_TYPE_MPEG_DECODER; |
215 | } | 215 | } |
216 | snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "ivtv%d %s", | 216 | snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "ivtv%d", |
217 | itv->num, s->name); | 217 | itv->num); |
218 | 218 | ||
219 | s->v4l2dev->minor = minor; | 219 | s->v4l2dev->minor = minor; |
220 | s->v4l2dev->dev = &itv->dev->dev; | 220 | s->v4l2dev->dev = &itv->dev->dev; |
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index e8dbee443946..14f93341f061 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c | |||
@@ -789,6 +789,9 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) | |||
789 | else | 789 | else |
790 | var->pixclock = pixclock; | 790 | var->pixclock = pixclock; |
791 | 791 | ||
792 | itv->osd_rect.width = var->xres; | ||
793 | itv->osd_rect.height = var->yres; | ||
794 | |||
792 | IVTVFB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n", | 795 | IVTVFB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n", |
793 | var->xres, var->yres, | 796 | var->xres, var->yres, |
794 | var->xres_virtual, var->yres_virtual, | 797 | var->xres_virtual, var->yres_virtual, |