diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-02-18 11:51:13 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:56 -0400 |
commit | dcbd83b1777fa6ed566a8bba035332ed245c0826 (patch) | |
tree | 6754f1334d1e4dd47ce7d10d24df76185c51f9b0 /drivers/media | |
parent | 9f1b9efa6712201aacc590b3250e6f39f9e13f21 (diff) |
V4L/DVB (10708): zoran: remove old V4L1 ioctls, use v4l1-compat instead.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/zoran/Kconfig | 4 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_driver.c | 459 |
2 files changed, 46 insertions, 417 deletions
diff --git a/drivers/media/video/zoran/Kconfig b/drivers/media/video/zoran/Kconfig index 8666e19f31a7..e35121fdf78a 100644 --- a/drivers/media/video/zoran/Kconfig +++ b/drivers/media/video/zoran/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_ZORAN | 1 | config VIDEO_ZORAN |
2 | tristate "Zoran ZR36057/36067 Video For Linux" | 2 | tristate "Zoran ZR36057/36067 Video For Linux" |
3 | depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && VIRT_TO_BUS | 3 | depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 && VIRT_TO_BUS |
4 | help | 4 | help |
5 | Say Y for support for MJPEG capture cards based on the Zoran | 5 | Say Y for support for MJPEG capture cards based on the Zoran |
6 | 36057/36067 PCI controller chipset. This includes the Iomega | 6 | 36057/36067 PCI controller chipset. This includes the Iomega |
@@ -66,7 +66,7 @@ config VIDEO_ZORAN_LML33R10 | |||
66 | 66 | ||
67 | config VIDEO_ZORAN_AVS6EYES | 67 | config VIDEO_ZORAN_AVS6EYES |
68 | tristate "AverMedia 6 Eyes support (EXPERIMENTAL)" | 68 | tristate "AverMedia 6 Eyes support (EXPERIMENTAL)" |
69 | depends on VIDEO_ZORAN_ZR36060 && EXPERIMENTAL && VIDEO_V4L1 | 69 | depends on VIDEO_ZORAN_ZR36060 && EXPERIMENTAL |
70 | select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO | 70 | select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO |
71 | select VIDEO_BT866 if VIDEO_HELPER_CHIPS_AUTO | 71 | select VIDEO_BT866 if VIDEO_HELPER_CHIPS_AUTO |
72 | select VIDEO_KS0127 if VIDEO_HELPER_CHIPS_AUTO | 72 | select VIDEO_KS0127 if VIDEO_HELPER_CHIPS_AUTO |
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index db9ff4a8ad85..0e4b8d03fda3 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -613,64 +613,6 @@ zoran_v4l_queue_frame (struct file *file, | |||
613 | return res; | 613 | return res; |
614 | } | 614 | } |
615 | 615 | ||
616 | static int | ||
617 | v4l_grab (struct file *file, | ||
618 | struct video_mmap *mp) | ||
619 | { | ||
620 | struct zoran_fh *fh = file->private_data; | ||
621 | struct zoran *zr = fh->zr; | ||
622 | int res = 0, i; | ||
623 | |||
624 | for (i = 0; i < NUM_FORMATS; i++) { | ||
625 | if (zoran_formats[i].palette == mp->format && | ||
626 | zoran_formats[i].flags & ZORAN_FORMAT_CAPTURE && | ||
627 | !(zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED)) | ||
628 | break; | ||
629 | } | ||
630 | if (i == NUM_FORMATS || zoran_formats[i].depth == 0) { | ||
631 | dprintk(1, | ||
632 | KERN_ERR | ||
633 | "%s: v4l_grab() - wrong bytes-per-pixel format\n", | ||
634 | ZR_DEVNAME(zr)); | ||
635 | return -EINVAL; | ||
636 | } | ||
637 | |||
638 | /* | ||
639 | * To minimize the time spent in the IRQ routine, we avoid setting up | ||
640 | * the video front end there. | ||
641 | * If this grab has different parameters from a running streaming capture | ||
642 | * we stop the streaming capture and start it over again. | ||
643 | */ | ||
644 | if (zr->v4l_memgrab_active && | ||
645 | (zr->v4l_settings.width != mp->width || | ||
646 | zr->v4l_settings.height != mp->height || | ||
647 | zr->v4l_settings.format->palette != mp->format)) { | ||
648 | res = wait_grab_pending(zr); | ||
649 | if (res) | ||
650 | return res; | ||
651 | } | ||
652 | if ((res = zoran_v4l_set_format(file, | ||
653 | mp->width, | ||
654 | mp->height, | ||
655 | &zoran_formats[i]))) | ||
656 | return res; | ||
657 | zr->v4l_settings = fh->v4l_settings; | ||
658 | |||
659 | /* queue the frame in the pending queue */ | ||
660 | if ((res = zoran_v4l_queue_frame(file, mp->frame))) { | ||
661 | fh->v4l_buffers.active = ZORAN_FREE; | ||
662 | return res; | ||
663 | } | ||
664 | |||
665 | /* put the 36057 into frame grabbing mode */ | ||
666 | if (!res && !zr->v4l_memgrab_active) | ||
667 | zr36057_set_memgrab(zr, 1); | ||
668 | |||
669 | //dprintk(4, KERN_INFO "%s: Frame grab 3...\n", ZR_DEVNAME(zr)); | ||
670 | |||
671 | return res; | ||
672 | } | ||
673 | |||
674 | /* | 616 | /* |
675 | * Sync on a V4L buffer | 617 | * Sync on a V4L buffer |
676 | */ | 618 | */ |
@@ -1760,6 +1702,7 @@ zoran_set_input (struct zoran *zr, | |||
1760 | * ioctl routine | 1702 | * ioctl routine |
1761 | */ | 1703 | */ |
1762 | 1704 | ||
1705 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1763 | static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) | 1706 | static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) |
1764 | { | 1707 | { |
1765 | struct zoran_fh *fh = __fh; | 1708 | struct zoran_fh *fh = __fh; |
@@ -1767,363 +1710,6 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) | |||
1767 | struct zoran_jpg_settings settings; | 1710 | struct zoran_jpg_settings settings; |
1768 | 1711 | ||
1769 | switch (cmd) { | 1712 | switch (cmd) { |
1770 | case VIDIOCGCAP: | ||
1771 | { | ||
1772 | struct video_capability *vcap = arg; | ||
1773 | |||
1774 | dprintk(3, KERN_DEBUG "%s: VIDIOCGCAP\n", ZR_DEVNAME(zr)); | ||
1775 | |||
1776 | memset(vcap, 0, sizeof(struct video_capability)); | ||
1777 | strncpy(vcap->name, ZR_DEVNAME(zr), sizeof(vcap->name)-1); | ||
1778 | vcap->type = ZORAN_VID_TYPE; | ||
1779 | |||
1780 | vcap->channels = zr->card.inputs; | ||
1781 | vcap->audios = 0; | ||
1782 | mutex_lock(&zr->resource_lock); | ||
1783 | vcap->maxwidth = BUZ_MAX_WIDTH; | ||
1784 | vcap->maxheight = BUZ_MAX_HEIGHT; | ||
1785 | vcap->minwidth = BUZ_MIN_WIDTH; | ||
1786 | vcap->minheight = BUZ_MIN_HEIGHT; | ||
1787 | mutex_unlock(&zr->resource_lock); | ||
1788 | |||
1789 | return 0; | ||
1790 | } | ||
1791 | |||
1792 | case VIDIOCGCHAN: | ||
1793 | { | ||
1794 | struct video_channel *vchan = arg; | ||
1795 | int channel = vchan->channel; | ||
1796 | |||
1797 | dprintk(3, KERN_DEBUG "%s: VIDIOCGCHAN - channel=%d\n", | ||
1798 | ZR_DEVNAME(zr), vchan->channel); | ||
1799 | |||
1800 | memset(vchan, 0, sizeof(struct video_channel)); | ||
1801 | if (channel > zr->card.inputs || channel < 0) { | ||
1802 | dprintk(1, | ||
1803 | KERN_ERR | ||
1804 | "%s: VIDIOCGCHAN on not existing channel %d\n", | ||
1805 | ZR_DEVNAME(zr), channel); | ||
1806 | return -EINVAL; | ||
1807 | } | ||
1808 | |||
1809 | strcpy(vchan->name, zr->card.input[channel].name); | ||
1810 | |||
1811 | vchan->tuners = 0; | ||
1812 | vchan->flags = 0; | ||
1813 | vchan->type = VIDEO_TYPE_CAMERA; | ||
1814 | mutex_lock(&zr->resource_lock); | ||
1815 | vchan->norm = zr->norm; | ||
1816 | mutex_unlock(&zr->resource_lock); | ||
1817 | vchan->channel = channel; | ||
1818 | |||
1819 | return 0; | ||
1820 | } | ||
1821 | |||
1822 | /* RJ: the documentation at http://roadrunner.swansea.linux.org.uk/v4lapi.shtml says: | ||
1823 | * | ||
1824 | * * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input." | ||
1825 | * * ^^^^^^^ | ||
1826 | * * The famos BTTV driver has it implemented with a struct video_channel argument | ||
1827 | * * and we follow it for compatibility reasons | ||
1828 | * * | ||
1829 | * * BTW: this is the only way the user can set the norm! | ||
1830 | */ | ||
1831 | |||
1832 | case VIDIOCSCHAN: | ||
1833 | { | ||
1834 | struct video_channel *vchan = arg; | ||
1835 | int res; | ||
1836 | |||
1837 | dprintk(3, | ||
1838 | KERN_DEBUG | ||
1839 | "%s: VIDIOCSCHAN - channel=%d, norm=%d\n", | ||
1840 | ZR_DEVNAME(zr), vchan->channel, vchan->norm); | ||
1841 | |||
1842 | mutex_lock(&zr->resource_lock); | ||
1843 | if ((res = zoran_set_input(zr, vchan->channel))) | ||
1844 | goto schan_unlock_and_return; | ||
1845 | if ((res = zoran_set_norm(zr, vchan->norm))) | ||
1846 | goto schan_unlock_and_return; | ||
1847 | |||
1848 | /* Make sure the changes come into effect */ | ||
1849 | res = wait_grab_pending(zr); | ||
1850 | schan_unlock_and_return: | ||
1851 | mutex_unlock(&zr->resource_lock); | ||
1852 | return res; | ||
1853 | } | ||
1854 | |||
1855 | case VIDIOCGPICT: | ||
1856 | { | ||
1857 | struct video_picture *vpict = arg; | ||
1858 | |||
1859 | dprintk(3, KERN_DEBUG "%s: VIDIOCGPICT\n", ZR_DEVNAME(zr)); | ||
1860 | |||
1861 | memset(vpict, 0, sizeof(struct video_picture)); | ||
1862 | mutex_lock(&zr->resource_lock); | ||
1863 | vpict->hue = zr->hue; | ||
1864 | vpict->brightness = zr->brightness; | ||
1865 | vpict->contrast = zr->contrast; | ||
1866 | vpict->colour = zr->saturation; | ||
1867 | if (fh->overlay_settings.format) { | ||
1868 | vpict->depth = fh->overlay_settings.format->depth; | ||
1869 | vpict->palette = fh->overlay_settings.format->palette; | ||
1870 | } else { | ||
1871 | vpict->depth = 0; | ||
1872 | } | ||
1873 | mutex_unlock(&zr->resource_lock); | ||
1874 | |||
1875 | return 0; | ||
1876 | } | ||
1877 | |||
1878 | case VIDIOCSPICT: | ||
1879 | { | ||
1880 | struct video_picture *vpict = arg; | ||
1881 | int i; | ||
1882 | |||
1883 | dprintk(3, | ||
1884 | KERN_DEBUG | ||
1885 | "%s: VIDIOCSPICT - bri=%d, hue=%d, col=%d, con=%d, dep=%d, pal=%d\n", | ||
1886 | ZR_DEVNAME(zr), vpict->brightness, vpict->hue, | ||
1887 | vpict->colour, vpict->contrast, vpict->depth, | ||
1888 | vpict->palette); | ||
1889 | |||
1890 | for (i = 0; i < NUM_FORMATS; i++) { | ||
1891 | const struct zoran_format *fmt = &zoran_formats[i]; | ||
1892 | |||
1893 | if (fmt->palette != -1 && | ||
1894 | fmt->flags & ZORAN_FORMAT_OVERLAY && | ||
1895 | fmt->palette == vpict->palette && | ||
1896 | fmt->depth == vpict->depth) | ||
1897 | break; | ||
1898 | } | ||
1899 | if (i == NUM_FORMATS) { | ||
1900 | dprintk(1, | ||
1901 | KERN_ERR | ||
1902 | "%s: VIDIOCSPICT - Invalid palette %d\n", | ||
1903 | ZR_DEVNAME(zr), vpict->palette); | ||
1904 | return -EINVAL; | ||
1905 | } | ||
1906 | |||
1907 | mutex_lock(&zr->resource_lock); | ||
1908 | |||
1909 | decoder_command(zr, DECODER_SET_PICTURE, vpict); | ||
1910 | |||
1911 | zr->hue = vpict->hue; | ||
1912 | zr->contrast = vpict->contrast; | ||
1913 | zr->saturation = vpict->colour; | ||
1914 | zr->brightness = vpict->brightness; | ||
1915 | |||
1916 | fh->overlay_settings.format = &zoran_formats[i]; | ||
1917 | |||
1918 | mutex_unlock(&zr->resource_lock); | ||
1919 | |||
1920 | return 0; | ||
1921 | } | ||
1922 | |||
1923 | case VIDIOCCAPTURE: | ||
1924 | { | ||
1925 | int *on = arg, res; | ||
1926 | |||
1927 | dprintk(3, KERN_DEBUG "%s: VIDIOCCAPTURE - on=%d\n", | ||
1928 | ZR_DEVNAME(zr), *on); | ||
1929 | |||
1930 | mutex_lock(&zr->resource_lock); | ||
1931 | res = setup_overlay(file, *on); | ||
1932 | mutex_unlock(&zr->resource_lock); | ||
1933 | |||
1934 | return res; | ||
1935 | } | ||
1936 | |||
1937 | case VIDIOCGWIN: | ||
1938 | { | ||
1939 | struct video_window *vwin = arg; | ||
1940 | |||
1941 | dprintk(3, KERN_DEBUG "%s: VIDIOCGWIN\n", ZR_DEVNAME(zr)); | ||
1942 | |||
1943 | memset(vwin, 0, sizeof(struct video_window)); | ||
1944 | mutex_lock(&zr->resource_lock); | ||
1945 | vwin->x = fh->overlay_settings.x; | ||
1946 | vwin->y = fh->overlay_settings.y; | ||
1947 | vwin->width = fh->overlay_settings.width; | ||
1948 | vwin->height = fh->overlay_settings.height; | ||
1949 | mutex_unlock(&zr->resource_lock); | ||
1950 | vwin->clipcount = 0; | ||
1951 | return 0; | ||
1952 | } | ||
1953 | |||
1954 | case VIDIOCSWIN: | ||
1955 | { | ||
1956 | struct video_window *vwin = arg; | ||
1957 | int res; | ||
1958 | |||
1959 | dprintk(3, | ||
1960 | KERN_DEBUG | ||
1961 | "%s: VIDIOCSWIN - x=%d, y=%d, w=%d, h=%d, clipcount=%d\n", | ||
1962 | ZR_DEVNAME(zr), vwin->x, vwin->y, vwin->width, | ||
1963 | vwin->height, vwin->clipcount); | ||
1964 | |||
1965 | mutex_lock(&zr->resource_lock); | ||
1966 | res = | ||
1967 | setup_window(file, vwin->x, vwin->y, vwin->width, | ||
1968 | vwin->height, vwin->clips, | ||
1969 | vwin->clipcount, NULL); | ||
1970 | mutex_unlock(&zr->resource_lock); | ||
1971 | |||
1972 | return res; | ||
1973 | } | ||
1974 | |||
1975 | case VIDIOCGFBUF: | ||
1976 | { | ||
1977 | struct video_buffer *vbuf = arg; | ||
1978 | |||
1979 | dprintk(3, KERN_DEBUG "%s: VIDIOCGFBUF\n", ZR_DEVNAME(zr)); | ||
1980 | |||
1981 | mutex_lock(&zr->resource_lock); | ||
1982 | *vbuf = zr->buffer; | ||
1983 | mutex_unlock(&zr->resource_lock); | ||
1984 | return 0; | ||
1985 | } | ||
1986 | |||
1987 | case VIDIOCSFBUF: | ||
1988 | { | ||
1989 | struct video_buffer *vbuf = arg; | ||
1990 | int i, res = 0; | ||
1991 | |||
1992 | dprintk(3, | ||
1993 | KERN_DEBUG | ||
1994 | "%s: VIDIOCSFBUF - base=%p, w=%d, h=%d, depth=%d, bpl=%d\n", | ||
1995 | ZR_DEVNAME(zr), vbuf->base, vbuf->width, | ||
1996 | vbuf->height, vbuf->depth, vbuf->bytesperline); | ||
1997 | |||
1998 | for (i = 0; i < NUM_FORMATS; i++) | ||
1999 | if (zoran_formats[i].depth == vbuf->depth) | ||
2000 | break; | ||
2001 | if (i == NUM_FORMATS) { | ||
2002 | dprintk(1, | ||
2003 | KERN_ERR | ||
2004 | "%s: VIDIOCSFBUF - invalid fbuf depth %d\n", | ||
2005 | ZR_DEVNAME(zr), vbuf->depth); | ||
2006 | return -EINVAL; | ||
2007 | } | ||
2008 | |||
2009 | mutex_lock(&zr->resource_lock); | ||
2010 | res = | ||
2011 | setup_fbuffer(file, vbuf->base, &zoran_formats[i], | ||
2012 | vbuf->width, vbuf->height, | ||
2013 | vbuf->bytesperline); | ||
2014 | mutex_unlock(&zr->resource_lock); | ||
2015 | |||
2016 | return res; | ||
2017 | } | ||
2018 | |||
2019 | case VIDIOCSYNC: | ||
2020 | { | ||
2021 | int *frame = arg, res; | ||
2022 | |||
2023 | dprintk(3, KERN_DEBUG "%s: VIDIOCSYNC - frame=%d\n", | ||
2024 | ZR_DEVNAME(zr), *frame); | ||
2025 | |||
2026 | mutex_lock(&zr->resource_lock); | ||
2027 | res = v4l_sync(file, *frame); | ||
2028 | mutex_unlock(&zr->resource_lock); | ||
2029 | if (!res) | ||
2030 | zr->v4l_sync_tail++; | ||
2031 | return res; | ||
2032 | } | ||
2033 | |||
2034 | case VIDIOCMCAPTURE: | ||
2035 | { | ||
2036 | struct video_mmap *vmap = arg; | ||
2037 | int res; | ||
2038 | |||
2039 | dprintk(3, | ||
2040 | KERN_DEBUG | ||
2041 | "%s: VIDIOCMCAPTURE - frame=%d, geom=%dx%d, fmt=%d\n", | ||
2042 | ZR_DEVNAME(zr), vmap->frame, vmap->width, vmap->height, | ||
2043 | vmap->format); | ||
2044 | |||
2045 | mutex_lock(&zr->resource_lock); | ||
2046 | res = v4l_grab(file, vmap); | ||
2047 | mutex_unlock(&zr->resource_lock); | ||
2048 | return res; | ||
2049 | } | ||
2050 | |||
2051 | |||
2052 | case VIDIOCGMBUF: | ||
2053 | { | ||
2054 | struct video_mbuf *vmbuf = arg; | ||
2055 | int i, res = 0; | ||
2056 | |||
2057 | dprintk(3, KERN_DEBUG "%s: VIDIOCGMBUF\n", ZR_DEVNAME(zr)); | ||
2058 | |||
2059 | vmbuf->size = | ||
2060 | fh->v4l_buffers.num_buffers * | ||
2061 | fh->v4l_buffers.buffer_size; | ||
2062 | vmbuf->frames = fh->v4l_buffers.num_buffers; | ||
2063 | for (i = 0; i < vmbuf->frames; i++) { | ||
2064 | vmbuf->offsets[i] = | ||
2065 | i * fh->v4l_buffers.buffer_size; | ||
2066 | } | ||
2067 | |||
2068 | mutex_lock(&zr->resource_lock); | ||
2069 | |||
2070 | if (fh->jpg_buffers.allocated || fh->v4l_buffers.allocated) { | ||
2071 | dprintk(1, | ||
2072 | KERN_ERR | ||
2073 | "%s: VIDIOCGMBUF - buffers already allocated\n", | ||
2074 | ZR_DEVNAME(zr)); | ||
2075 | res = -EINVAL; | ||
2076 | goto v4l1reqbuf_unlock_and_return; | ||
2077 | } | ||
2078 | |||
2079 | if (v4l_fbuffer_alloc(file)) { | ||
2080 | res = -ENOMEM; | ||
2081 | goto v4l1reqbuf_unlock_and_return; | ||
2082 | } | ||
2083 | |||
2084 | /* The next mmap will map the V4L buffers */ | ||
2085 | fh->map_mode = ZORAN_MAP_MODE_RAW; | ||
2086 | v4l1reqbuf_unlock_and_return: | ||
2087 | mutex_unlock(&zr->resource_lock); | ||
2088 | |||
2089 | return res; | ||
2090 | } | ||
2091 | |||
2092 | case VIDIOCGUNIT: | ||
2093 | { | ||
2094 | struct video_unit *vunit = arg; | ||
2095 | |||
2096 | dprintk(3, KERN_DEBUG "%s: VIDIOCGUNIT\n", ZR_DEVNAME(zr)); | ||
2097 | |||
2098 | vunit->video = zr->video_dev->minor; | ||
2099 | vunit->vbi = VIDEO_NO_UNIT; | ||
2100 | vunit->radio = VIDEO_NO_UNIT; | ||
2101 | vunit->audio = VIDEO_NO_UNIT; | ||
2102 | vunit->teletext = VIDEO_NO_UNIT; | ||
2103 | |||
2104 | return 0; | ||
2105 | } | ||
2106 | |||
2107 | /* | ||
2108 | * RJ: In principal we could support subcaptures for V4L grabbing. | ||
2109 | * Not even the famous BTTV driver has them, however. | ||
2110 | * If there should be a strong demand, one could consider | ||
2111 | * to implement them. | ||
2112 | */ | ||
2113 | case VIDIOCGCAPTURE: | ||
2114 | { | ||
2115 | dprintk(3, KERN_ERR "%s: VIDIOCGCAPTURE not supported\n", | ||
2116 | ZR_DEVNAME(zr)); | ||
2117 | return -EINVAL; | ||
2118 | } | ||
2119 | |||
2120 | case VIDIOCSCAPTURE: | ||
2121 | { | ||
2122 | dprintk(3, KERN_ERR "%s: VIDIOCSCAPTURE not supported\n", | ||
2123 | ZR_DEVNAME(zr)); | ||
2124 | return -EINVAL; | ||
2125 | } | ||
2126 | |||
2127 | case BUZIOC_G_PARAMS: | 1713 | case BUZIOC_G_PARAMS: |
2128 | { | 1714 | { |
2129 | struct zoran_params *bparams = arg; | 1715 | struct zoran_params *bparams = arg; |
@@ -2383,6 +1969,46 @@ gstat_unlock_and_return: | |||
2383 | } | 1969 | } |
2384 | } | 1970 | } |
2385 | 1971 | ||
1972 | static int zoran_vidiocgmbuf(struct file *file, void *__fh, struct video_mbuf *vmbuf) | ||
1973 | { | ||
1974 | struct zoran_fh *fh = __fh; | ||
1975 | struct zoran *zr = fh->zr; | ||
1976 | int i, res = 0; | ||
1977 | |||
1978 | vmbuf->size = | ||
1979 | fh->v4l_buffers.num_buffers * | ||
1980 | fh->v4l_buffers.buffer_size; | ||
1981 | vmbuf->frames = fh->v4l_buffers.num_buffers; | ||
1982 | for (i = 0; i < vmbuf->frames; i++) { | ||
1983 | vmbuf->offsets[i] = | ||
1984 | i * fh->v4l_buffers.buffer_size; | ||
1985 | } | ||
1986 | |||
1987 | mutex_lock(&zr->resource_lock); | ||
1988 | |||
1989 | if (fh->jpg_buffers.allocated || fh->v4l_buffers.allocated) { | ||
1990 | dprintk(1, | ||
1991 | KERN_ERR | ||
1992 | "%s: VIDIOCGMBUF - buffers already allocated\n", | ||
1993 | ZR_DEVNAME(zr)); | ||
1994 | res = -EINVAL; | ||
1995 | goto v4l1reqbuf_unlock_and_return; | ||
1996 | } | ||
1997 | |||
1998 | if (v4l_fbuffer_alloc(file)) { | ||
1999 | res = -ENOMEM; | ||
2000 | goto v4l1reqbuf_unlock_and_return; | ||
2001 | } | ||
2002 | |||
2003 | /* The next mmap will map the V4L buffers */ | ||
2004 | fh->map_mode = ZORAN_MAP_MODE_RAW; | ||
2005 | v4l1reqbuf_unlock_and_return: | ||
2006 | mutex_unlock(&zr->resource_lock); | ||
2007 | |||
2008 | return res; | ||
2009 | } | ||
2010 | #endif | ||
2011 | |||
2386 | static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability *cap) | 2012 | static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability *cap) |
2387 | { | 2013 | { |
2388 | struct zoran_fh *fh = __fh; | 2014 | struct zoran_fh *fh = __fh; |
@@ -4118,7 +3744,10 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { | |||
4118 | .vidioc_queryctrl = zoran_queryctrl, | 3744 | .vidioc_queryctrl = zoran_queryctrl, |
4119 | .vidioc_s_ctrl = zoran_s_ctrl, | 3745 | .vidioc_s_ctrl = zoran_s_ctrl, |
4120 | .vidioc_g_ctrl = zoran_g_ctrl, | 3746 | .vidioc_g_ctrl = zoran_g_ctrl, |
3747 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
4121 | .vidioc_default = zoran_default, | 3748 | .vidioc_default = zoran_default, |
3749 | .vidiocgmbuf = zoran_vidiocgmbuf, | ||
3750 | #endif | ||
4122 | }; | 3751 | }; |
4123 | 3752 | ||
4124 | static const struct v4l2_file_operations zoran_fops = { | 3753 | static const struct v4l2_file_operations zoran_fops = { |