History log of /netbsd-current/sys/dev/video.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.45 03-Mar-2022 riastradh

video(9): Make softc argument mandatory for video_attach_mi.

No separate video_attach_mi_softc function any more.


# 1.44 03-Mar-2022 riastradh

video(4): Allow drivers to pass the softc explicitly.

This way one device driver can have multiple video0, video1, &c.,
interfaces attached, using independent state and a common parent.


# 1.43 08-Dec-2021 andvar

fix various typos in comments and log messages.


# 1.42 09-Aug-2021 andvar

s/fist/first/


Revision tags: thorpej-i2c-spi-conf2-base
# 1.41 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 1.40 24-Apr-2021 thorpej

branches: 1.40.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 1.39 13-Aug-2020 riastradh

branches: 1.39.4;
Nix trailing whitespace.


# 1.38 10-Aug-2020 rjs

Add some extra V4L ioctl() requests to latest V4L userland to work.

Import sys/videoio.h from OpenBSD, this is just the Linux headers
concatenated together.


# 1.37 22-May-2020 jmcneill

Support VIDIOC_G_PARM/VIDIOC_S_PARM


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.36 27-Dec-2019 msaitoh

s/transfered/transferred/


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2; 1.34.4;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


# 1.43 08-Dec-2021 andvar

fix various typos in comments and log messages.


# 1.42 09-Aug-2021 andvar

s/fist/first/


Revision tags: thorpej-i2c-spi-conf2-base
# 1.41 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 1.40 24-Apr-2021 thorpej

branches: 1.40.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 1.39 13-Aug-2020 riastradh

branches: 1.39.4;
Nix trailing whitespace.


# 1.38 10-Aug-2020 rjs

Add some extra V4L ioctl() requests to latest V4L userland to work.

Import sys/videoio.h from OpenBSD, this is just the Linux headers
concatenated together.


# 1.37 22-May-2020 jmcneill

Support VIDIOC_G_PARM/VIDIOC_S_PARM


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.36 27-Dec-2019 msaitoh

s/transfered/transferred/


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2; 1.34.4;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


# 1.42 09-Aug-2021 andvar

s/fist/first/


Revision tags: thorpej-i2c-spi-conf2-base
# 1.41 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 1.40 24-Apr-2021 thorpej

branches: 1.40.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 1.39 13-Aug-2020 riastradh

branches: 1.39.4;
Nix trailing whitespace.


# 1.38 10-Aug-2020 rjs

Add some extra V4L ioctl() requests to latest V4L userland to work.

Import sys/videoio.h from OpenBSD, this is just the Linux headers
concatenated together.


# 1.37 22-May-2020 jmcneill

Support VIDIOC_G_PARM/VIDIOC_S_PARM


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.36 27-Dec-2019 msaitoh

s/transfered/transferred/


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2; 1.34.4;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


# 1.41 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 1.40 24-Apr-2021 thorpej

branches: 1.40.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 1.39 13-Aug-2020 riastradh

branches: 1.39.4;
Nix trailing whitespace.


# 1.38 10-Aug-2020 rjs

Add some extra V4L ioctl() requests to latest V4L userland to work.

Import sys/videoio.h from OpenBSD, this is just the Linux headers
concatenated together.


# 1.37 22-May-2020 jmcneill

Support VIDIOC_G_PARM/VIDIOC_S_PARM


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.36 27-Dec-2019 msaitoh

s/transfered/transferred/


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2; 1.34.4;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


# 1.40 24-Apr-2021 thorpej

Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
# 1.39 13-Aug-2020 riastradh

branches: 1.39.4;
Nix trailing whitespace.


# 1.38 10-Aug-2020 rjs

Add some extra V4L ioctl() requests to latest V4L userland to work.

Import sys/videoio.h from OpenBSD, this is just the Linux headers
concatenated together.


# 1.37 22-May-2020 jmcneill

Support VIDIOC_G_PARM/VIDIOC_S_PARM


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.36 27-Dec-2019 msaitoh

s/transfered/transferred/


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2; 1.34.4;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


# 1.39 13-Aug-2020 riastradh

Nix trailing whitespace.


# 1.38 10-Aug-2020 rjs

Add some extra V4L ioctl() requests to latest V4L userland to work.

Import sys/videoio.h from OpenBSD, this is just the Linux headers
concatenated together.


# 1.37 22-May-2020 jmcneill

Support VIDIOC_G_PARM/VIDIOC_S_PARM


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.36 27-Dec-2019 msaitoh

s/transfered/transferred/


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2; 1.34.4;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


# 1.38 10-Aug-2020 rjs

Add some extra V4L ioctl() requests to latest V4L userland to work.

Import sys/videoio.h from OpenBSD, this is just the Linux headers
concatenated together.


# 1.37 22-May-2020 jmcneill

Support VIDIOC_G_PARM/VIDIOC_S_PARM


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.36 27-Dec-2019 msaitoh

s/transfered/transferred/


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2; 1.34.4;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


# 1.37 22-May-2020 jmcneill

Support VIDIOC_G_PARM/VIDIOC_S_PARM


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.36 27-Dec-2019 msaitoh

s/transfered/transferred/


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2; 1.34.4;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


# 1.36 27-Dec-2019 msaitoh

s/transfered/transferred/


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2; 1.34.4;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.35 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.34 28-Oct-2017 riastradh

branches: 1.34.2;
Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.


# 1.34 28-Oct-2017 riastradh

Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".


Revision tags: matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.33 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.32 25-Jul-2014 dholland

branches: 1.32.4; 1.32.8; 1.32.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.31 16-Mar-2014 dholland

branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.


# 1.30 17-Oct-2013 christos

- remove unused variables
- moved debugging variable into debugging ifdef


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 1.29 07-Jan-2013 prlw1

branches: 1.29.2;
Allow USB memory allocation by multiple segments in scatter/gather lists
rather than in a single contiguous block which causes problems with
large USB video frames.
Based on a patch by Jeremy Morse in the thread
http://mail-index.netbsd.org/current-users/2011/01/26/msg015532.html
Tested by developing http://code.opencv.org/issues/2360
OK jmcneill@


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.28 02-Feb-2012 drochner

branches: 1.28.6;
fill in timestamps in outgoing data buffers


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.27 13-Aug-2011 jakllsch

branches: 1.27.2; 1.27.6;
Restore binary compatibility with NetBSD 5 binaries that utilize video(4).


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.26 26-Dec-2010 jmcneill

don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".


# 1.25 24-Dec-2010 jmcneill

VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if


# 1.24 14-Dec-2010 jmcneill

video(4) changes to support analog tv capture devices:
- support interlacing with VIDIOC_G_FMT
- set V4L2_CAP_TUNER if driver implements the set_tuner/get_tuner
callbacks
- set V4L2_CAP_AUDIO if driver implements the set_audio/get_audio/enum_audio
callbacks
- add support for the following ioctls: VIDIOC_ENUMSTD, VIDIOC_G_STD,
VIDIOC_S_STD, VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT,
VIDIOC_ENUMAUDIO, VIDIOC_G_AUDIO, VIDIOC_S_AUDIO, VIDIOC_G_TUNER,
VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
- in video_submit_payload(), fix support for signaling sample complete
using frame numbers
- new optional callbacks for drivers: enum_standard, get_standard,
set_standard, enum_input, get_input, set_input, enum_audio, get_audio,
set_audio, get_tuner, set_tuner, get_frequency, set_frequency

for drivers that don't provide enum_standard, get_standard, set_standard,
enum_input, get_input and set_input, the original stub implementations are
provided


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.23 06-Dec-2009 dyoung

branches: 1.23.4;
Simplify these device-activation hooks using the following semantic
patch.

XXX sc_dying must die.

@@
type device_t;

identifier act, midi_softc, midiactivate, sc, self;
@@

int
midiactivate(device_t self, enum devact act)
{
(
struct midi_softc *sc = device_private(self);
|
- struct midi_softc *sc;
+ struct midi_softc *sc = device_private(self);
...
- sc = device_private(self);
)
...
switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
-
case DVACT_DEACTIVATE:
(
sc->dying
|
sc->sc_dying
)
=
(
1
|
true
)
;
- break;
+ return 0;
+ default:
+ return EOPNOTSUPP;
}
- return (0);
}


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.22 18-Aug-2009 christos

1. some of the video24linux structs are not as machine independent as their
authors want them to be. For the buffer ioctls, define new ioctls with
the 32 bit buffer sizes. For the format struct, define it as packed
so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.21 07-Jul-2009 njoly

Fix amd64 build with VIDEO_DEBUG.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.20 14-Mar-2009 jmcneill

branches: 1.20.2;
PR# kern/41008: possible simple mistake of field check in video(9)

video_set_format() requires hw->set_format to be set, not get_format,
from fukumoto@imasy.or.jp


Revision tags: nick-hppapmap-base2
# 1.19 20-Jan-2009 drochner

branches: 1.19.2;
-avoid eternal block if device is not streaming
-apply locking to avoid race in poll()
-fix an obviously wrong flag check


Revision tags: mjf-devfs2-base
# 1.18 23-Dec-2008 jmorse

Fix UVC webcam output by:
- Storing updated video format after user changes format
- Round up number of xfers queued to multiple of 8, due to ehci inefficiencies
- Remove random debugging line I slipped in earlier


Revision tags: haad-dm-base haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4
# 1.17 21-Sep-2008 jmcneill

branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Register with pmf


# 1.16 20-Sep-2008 jmcneill

Add RGB555, RGB565, UYVY support


Revision tags: wrstuden-revivesa-base-3
# 1.15 18-Sep-2008 jmcneill

branches: 1.15.2;
Use get_format instead of set_format in videoopen


# 1.14 14-Sep-2008 jmcneill

Add VIDEO_FORMAT_YUV420 support


# 1.13 14-Sep-2008 jmcneill

Allow VIDIOC_ENUM_FORMAT to return more than one result.


# 1.12 14-Sep-2008 jmcneill

Revert previous double-free hack, needs revisiting.


# 1.11 13-Sep-2008 jmcneill

Add RGB24 support, and prevent a double-free on videoclose


# 1.10 09-Sep-2008 jmcneill

VIDIOC_QUERYCAP: device_xname on device_t, not softc


# 1.9 09-Sep-2008 jmcneill

More pixelformat mapping typo fixes


# 1.8 09-Sep-2008 jmcneill

Map VIDEO_FORMAT_MJPEG to V4L2_PIX_FMT_MJPEG, not V4L2_PIX_FMT_JPEG


# 1.7 09-Sep-2008 jmcneill

Fix "select timeout" and low framerate issues with mplayer, from drochner@


# 1.6 08-Sep-2008 jmcneill

Limit VIDEO_MAX_BUFS to 32 instead of 255


# 1.5 07-Sep-2008 jmcneill

Missing aprint newline in video_attach


# 1.4 07-Sep-2008 jmcneill

Actually, EINVAL is correct for an unimplemented ioctl. ENOTTY is only
needed for the VIDIOC_*_FMT ioctls.


Revision tags: wrstuden-revivesa-base-2
# 1.3 07-Sep-2008 jmcneill

Return ENOTTY instead of EINVAL if a driver doesn't implement one of the
set, try, get, or enum format ioctls.


# 1.2 06-Sep-2008 rmind

Unbreak build when VIDEO_DEBUG is not defined.


# 1.1 06-Sep-2008 jmcneill

Add MI video4linux2 layer, part of Patrick Mahoney's Google Summer
of Code 2008 project.