[RFC PATCH 1/5] vicodec: always return a valid format.

2019-03-29 Thread hverkuil-cisco
From: Hans Verkuil Rather than returning width/height values of 0, just default to a format. Formats in V4L2 are always supposed to be valid, there is no concept of an invalid format. Signed-off-by: Hans Verkuil --- drivers/media/platform/vicodec/vicodec-core.c | 26 ++- 1 file

[RFC PATCH 2/5] vicodec: pass on enc output format to capture side

2019-03-29 Thread hverkuil-cisco
From: Hans Verkuil Setting the encoder output format to e.g. 1920x1080 will set the crop rectangle to 1920x1080, the coded resolution to 1920x1088 and the capture coded resolution and sizeimage to 1920x1088 as well. Signed-off-by: Hans Verkuil --- drivers/media/platform/vicodec/vicodec-core.c

[RFC PATCH 4/5] videobuf2-v4l2: set last_buffer_dequeued in dqbuf

2019-03-29 Thread hverkuil-cisco
From: Hans Verkuil last_buffer_dequeued was set to true in __fill_v4l2_buffer, but this is called for qbuf as well. Move it to vb2_dqbuf. Signed-off-by: Hans Verkuil --- drivers/media/common/videobuf2/videobuf2-v4l2.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[RFC PATCH 0/5] vicodec: sync with stateful codec specs

2019-03-29 Thread hverkuil-cisco
From: Hans Verkuil This RFC series fixes vicodec to conform to the upcoming version of the codec specs. This is RFC since the decoder side isn't done yet (missing compliance tests) and the last patch isn't fully verified. I pushed most of the compliance tests for the stateful encoder, but some

[RFC PATCH 5/5] vicodec: improve handling of ENC_CMD_STOP/START

2019-03-29 Thread hverkuil-cisco
From: Hans Verkuil Correctly handle stopping and restarting the encoder, keeping track of the stop and drain states. Signed-off-by: Hans Verkuil --- drivers/media/platform/vicodec/vicodec-core.c | 121 +++--- 1 file changed, 100 insertions(+), 21 deletions(-) diff --git a/drivers/

[RFC PATCH 3/5] vicodec: add V4L2_CID_MIN_BUFFERS_FOR_OUTPUT

2019-03-29 Thread hverkuil-cisco
From: Hans Verkuil The stateful encoder requires the presence of this control. Since a single buffer is sufficient for vicodec, we just set this control to 1. Signed-off-by: Hans Verkuil --- drivers/media/platform/vicodec/vicodec-core.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-)

[PATCH v5.1 0/2] add requires_requests bit for stateless codecs

2019-03-20 Thread hverkuil-cisco
From: Hans Verkuil These two patches replace patches 1-3 of the vicodec v5 patch series: https://www.spinics.net/lists/linux-media/msg147923.html The original patch 2/23 (videodev2.h: add V4L2_BUF_CAP_REQUIRES_REQUESTS) was dropped. This needs a bit more thought. Patch 1 now returns EBADR if an

[PATCH v5.1 1/2] vb2: add requires_requests bit for stateless codecs

2019-03-20 Thread hverkuil-cisco
From: Hans Verkuil Stateless codecs require the use of the Request API as opposed of it being optional. So add a bit to indicate this and let vb2 check for this. If an attempt is made to queue a buffer without an associated request, then the EBADR error is returned to userspace. Doing this che

[PATCH v5.1 2/2] cedrus: set requires_requests

2019-03-20 Thread hverkuil-cisco
From: Hans Verkuil The cedrus stateless decoder requires the use of request, so indicate this by setting requires_requests to 1. Note that the cedrus driver never checked for this, and as far as I can tell would just crash if an attempt was made to queue a buffer without a request. Signed-off-b

[PATCHv3 1/9] cec: fill in cec chardev kobject to ease debugging

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil The cec chardev kobject has no name, which made it hard to debug when kobject debugging is turned on. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart --- drivers/media/cec/cec-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/cec/cec-core.c

[PATCHv3 4/9] media-entity: set ent_enum->bmap to NULL after freeing it

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil Ensure that this pointer is set to NULL after it is freed. The vimc driver has a static media_entity and after unbinding and rebinding the vimc device the media code will try to free this pointer again since it wasn't set to NULL. Signed-off-by: Hans Verkuil --- drivers/medi

[PATCHv3 5/9] vim2m: replace devm_kzalloc by kzalloc

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil It is not possible to use devm_kzalloc since that memory is freed immediately when the device instance is unbound. Various objects like the video device may still be in use since someone has the device node open, and when that is closed it expects the memory to be around. So

[PATCHv3 3/9] vivid: use vzalloc for dev->bitmap_out

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil When vivid is unloaded it used vfree to free dev->bitmap_out, but it was actually allocated using kmalloc. Use vzalloc instead, conform what vivid-vid-cap.c does. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart --- drivers/media/platform/vivid/vivid-vid-out.c | 14

[PATCHv3 2/9] media-devnode: fill in media chardev kobject to ease debugging

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil The media chardev kobject has no name, which made it hard to debug when kobject debugging is turned on. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart --- drivers/media/media-devnode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/media-devnod

[PATCHv3 7/9] v4l2-subdev: handle module refcounting here

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil The module ownership refcounting was done in media_entity_get/put, but that was very confusing and it did not work either in case an application had a v4l-subdevX device open and the module was unbound. When the v4l-subdevX device was closed the media_entity_put was never calle

[PATCHv3 8/9] vimc: free vimc_cap_device when the last user disappears

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil Don't free vimc_cap_device immediately, instead do this in the video_device release function which is called when the last user closes the video device. Only then is it safe to free the memory. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart --- drivers/media/plat

[PATCHv3 6/9] v4l2-subdev: add release() internal op

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil If the subdevice created a device node, then the v4l2_subdev cannot be freed until the last user of the device node closes it. This means that we need a release() callback in v4l2_subdev_internal_ops that is called from the video_device release function so the subdevice driver

[PATCHv3 0/9] Various core and virtual driver fixes

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil Various fixes for bugs that I found while working on the regression test-media script. The CONFIG_DEBUG_KOBJECT_RELEASE=y option in particular found a bunch of bugs where things were not released in the right order. Note that the first two patches are not bug fixes, but they

[PATCHv3 9/9] vimc: use new release op

2019-03-07 Thread hverkuil-cisco
From: Hans Verkuil Use the new v4l2_subdev_internal_ops release op to free the subdev memory only once the last user closed the file handle. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart --- drivers/media/platform/vimc/vimc-common.c | 2 ++ drivers/media/platform/vimc/vimc-commo

[PATCHv2 4/9] media-entity: set ent_enum->bmap to NULL after freeing it

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil Ensure that this pointer is set to NULL after it is freed. The vimc driver has a static media_entity and after unbinding and rebinding the vimc device the media code will try to free this pointer again since it wasn't set to NULL. Signed-off-by: Hans Verkuil --- drivers/medi

[PATCHv2 9/9] vimc: use new release op

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil Use the new v4l2_subdev_internal_ops release op to free the subdev memory only once the last user closed the file handle. Signed-off-by: Hans Verkuil --- drivers/media/platform/vimc/vimc-common.c | 2 ++ drivers/media/platform/vimc/vimc-common.h | 2 ++ drivers/media/pla

[PATCHv2 5/9] vim2m: replace devm_kzalloc by kzalloc

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil It is not possible to use devm_kzalloc since that memory is freed immediately when the device instance is unbound. Various objects like the video device may still be in use since someone has the device node open, and when that is closed it expects the memory to be around. So

[PATCHv2 8/9] vimc: free vimc_cap_device when the last user disappears

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil Don't free vimc_cap_device immediately, instead do this in the video_device release function which is called when the last user closes the video device. Only then is it safe to free the memory. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart --- drivers/media/plat

[PATCHv2 3/9] vivid: use vzalloc for dev->bitmap_out

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil When vivid is unloaded it used vfree to free dev->bitmap_out, but it was actually allocated using kmalloc. Use vzalloc instead, conform what vivid-vid-cap.c does. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart --- drivers/media/platform/vivid/vivid-vid-out.c | 14

[PATCHv2 6/9] v4l2-subdev: add release() internal op

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil If the subdevice created a device node, then the v4l2_subdev cannot be freed until the last user of the device node closes it. This means that we need a release() callback in v4l2_subdev_internal_ops that is called from the video_device release function so the subdevice driver

[PATCHv2 0/9] Various core and virtual driver fixes

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil Various fixes for bugs that I found while working on the regression test-media script. The CONFIG_DEBUG_KOBJECT_RELEASE=y option in particular found a bunch of bugs where things were not released in the right order. Note that the first two patches are not bug fixes, but they

[PATCHv2 2/9] media-devnode: fill in media chardev kobject to ease debugging

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil The media chardev kobject has no name, which made it hard to debug when kobject debugging is turned on. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart --- drivers/media/media-devnode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/media-devnod

[PATCHv2 7/9] v4l2-subdev: handle module refcounting here

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil The module ownership refcounting was done in media_entity_get/put, but that was very confusing and it did not work either in case an application had a v4l-subdevX device open and the module was unbound. When the v4l-subdevX device was closed the media_entity_put was never calle

[PATCHv2 1/9] cec: fill in cec chardev kobject to ease debugging

2019-03-05 Thread hverkuil-cisco
From: Hans Verkuil The cec chardev kobject has no name, which made it hard to debug when kobject debugging is turned on. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart --- drivers/media/cec/cec-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/cec/cec-core.c

[RFC PATCH 3/8] vb2: fix epoll() by calling poll_wait first

2019-02-07 Thread hverkuil-cisco
From: Hans Verkuil The epoll function expects that whenever the poll file op is called, the poll_wait function is also called. That didn't always happen in vb2_core_poll() and vb2_poll(). Fix this, otherwise epoll() would timeout when it shouldn't. Signed-off-by: Hans Verkuil Reported-by: Yi Qi

[RFC PATCH 2/8] media-request: fix epoll() by calling poll_wait first

2019-02-07 Thread hverkuil-cisco
From: Hans Verkuil The epoll function expects that whenever the poll file op is called, the poll_wait function is also called. That didn't always happen in media_request_poll(). Fix this, otherwise epoll() would timeout when it shouldn't. Signed-off-by: Hans Verkuil --- drivers/media/media-req

[RFC PATCH 7/8] videobuf: fix epoll() by calling poll_wait first

2019-02-07 Thread hverkuil-cisco
From: Hans Verkuil The epoll function expects that whenever the poll file op is called, the poll_wait function is also called. That didn't always happen in videobuf_poll_stream(). Fix this, otherwise epoll() would timeout when it shouldn't. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-co

[RFC PATCH 1/8] cec: fix epoll() by calling poll_wait first

2019-02-07 Thread hverkuil-cisco
From: Hans Verkuil The epoll function expects that whenever the poll file op is called, the poll_wait function is also called. That didn't always happen in cec_poll(). Fix this, otherwise epoll() would timeout when it shouldn't. Signed-off-by: Hans Verkuil --- drivers/media/cec/cec-api.c | 2 +

[RFC PATCH 5/8] v4l2-mem2mem: fix epoll() by calling poll_wait first

2019-02-07 Thread hverkuil-cisco
From: Hans Verkuil The epoll function expects that whenever the poll file op is called, the poll_wait function is also called. That didn't always happen in v4l2_m2m_poll(). Fix this, otherwise epoll() would timeout when it shouldn't. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2

[RFC PATCH 8/8] dvb-core: fix epoll() by calling poll_wait first

2019-02-07 Thread hverkuil-cisco
From: Hans Verkuil The epoll function expects that whenever the poll file op is called, the poll_wait function is also called. That didn't always happen in dvb_demux_poll(), dvb_dvr_poll() and dvb_ca_en50221_io_poll(). Fix this, otherwise epoll() can timeout when it shouldn't. Signed-off-by: Han

[RFC PATCH 0/8] cec/mc/vb2/dvb: fix epoll support

2019-02-07 Thread hverkuil-cisco
From: Hans Verkuil As was reported by Yi Qingliang (http://lkml.iu.edu/hypermail/linux/kernel/1812.3/02144.html) the epoll support in v4l2 is broken. After researching this some more it turns out that we never really understood when poll_wait() should be called, and that in fact it is broken in

[RFC PATCH 6/8] v4l2-mem2mem: add q->error check to v4l2_m2m_poll()

2019-02-07 Thread hverkuil-cisco
From: Hans Verkuil The v4l2_m2m_poll function didn't check whether q->error was set for either of the two queues. Add support for this. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2-mem2mem.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media

[RFC PATCH 4/8] v4l2-ctrls.c: fix epoll() by calling poll_wait first

2019-02-07 Thread hverkuil-cisco
From: Hans Verkuil The epoll function expects that whenever the poll file op is called, the poll_wait function is also called. That didn't always happen in v4l2_ctrl_poll(). Fix this, otherwise epoll() would timeout when it shouldn't. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/v4l

[PATCHv2 1/3] vb2: replace bool by bitfield in vb2_buffer

2019-02-04 Thread hverkuil-cisco
From: Hans Verkuil The bool type is not recommended for use in structs, so replace these by bitfields. Signed-off-by: Hans Verkuil --- drivers/media/common/videobuf2/videobuf2-core.c | 12 ++-- include/media/videobuf2-core.h | 4 ++-- 2 files changed, 8 insertions(+),

[PATCHv2 2/3] vb2: keep track of timestamp status

2019-02-04 Thread hverkuil-cisco
From: Hans Verkuil If a stream is stopped, or if a USERPTR/DMABUF buffer is queued backed by a different user address or dmabuf fd, then the timestamp should be skipped by vb2_find_timestamp since the memory it refers to is no longer valid. So keep track of a 'copied_timestamp' state: it is set

[PATCHv2 0/3] Improve vb2_find_buffer

2019-02-04 Thread hverkuil-cisco
From: Hans Verkuil This supersedes my previous patch: https://www.mail-archive.com/linux-media@vger.kernel.org/msg144099.html Rather than marking a timestamp of 0 as 'special', I add a bitfield to keep track of the validity of the timestamp. The last patch also adds extra checks to verify that

[PATCHv2 3/3] vb2: add 'match' arg to vb2_find_buffer()

2019-02-04 Thread hverkuil-cisco
From: Hans Verkuil When finding a buffer vb2_find_buffer() should also check if the properties of the found buffer (i.e. number of planes and plane sizes) match the properties of the 'match' buffer. Update the cedrus driver accordingly. Signed-off-by: Hans Verkuil --- drivers/media/common/vid

[PATCH 2/3] dev-teletext.rst: remove obsolete teletext interface

2019-01-22 Thread hverkuil-cisco
From: Hans Verkuil The teletext interface has been dead for years now, just remove it. Signed-off-by: Hans Verkuil --- Documentation/media/uapi/v4l/dev-teletext.rst | 41 --- Documentation/media/uapi/v4l/devices.rst | 1 - 2 files changed, 42 deletions(-) delete mode 100

[PATCH 3/3] Documentation/media: rename "Codec Interface"

2019-01-22 Thread hverkuil-cisco
From: Hans Verkuil The "Codec Interface" chapter is poorly named since codecs are just one use-case of the Memory-to-Memory Interface. Rename it and clean up the text a bit. Signed-off-by: Hans Verkuil --- .../media/uapi/mediactl/request-api.rst | 4 ++-- .../v4l/{dev-codec.rst => dev-m

[PATCH 1/3] dev-effect.rst: remove unused Effect Interface chapter

2019-01-22 Thread hverkuil-cisco
From: Hans Verkuil We never had an effect interface, and if you want to do such things you use the mem2mem interface instead. Just drop this from the spec. Signed-off-by: Hans Verkuil --- Documentation/media/uapi/v4l/dev-effect.rst | 28 - Documentation/media/uapi/v4l/devi

[PATCH 0/3] Documentation cleanups

2019-01-22 Thread hverkuil-cisco
From: Hans Verkuil Drop the obsolete Effect and Teletext interfaces. Rename the Codec Interface to Video Memory To Memory Interface, which is more accurate. This also makes more sense when the detailed codec APIs are added. Regards, Hans Hans Verkuil (3): dev-effect.rst: remove unus

[PATCH 8/8] v4l2-common: drop v4l2_get_timestamp

2019-01-21 Thread hverkuil-cisco
From: Hans Verkuil This function is no longer used, so drop it. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2-common.c | 10 -- include/media/v4l2-common.h | 9 - 2 files changed, 19 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/d

[PATCH 1/8] v4l2-event: keep track of the timestamp in ns

2019-01-21 Thread hverkuil-cisco
From: Hans Verkuil Internally use ktime_get_ns() to get the timestamp of the event. Only convert to timespec when interfacing with userspace. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2-event.c | 19 +-- include/media/v4l2-event.h | 2 ++ 2 files cha

[PATCH 0/8] Preparing for Y2038 support

2019-01-21 Thread hverkuil-cisco
From: Hans Verkuil This patch series modifies v4l2-event, videobuf and various drivers that do not use vb2 or videobuf at all to store the event and buffer timestamps internally as a u64 (ktime_get_ns()). Only when interfacing with the userspace API are these timestamps converted to a timespec o

[PATCH 5/8] stkwebcam: use u64 for the timestamp internally

2019-01-21 Thread hverkuil-cisco
From: Hans Verkuil Just like vb2 does, use u64 internally to store the timestamps of the buffers. Only convert to timeval when interfacing with userspace. Signed-off-by: Hans Verkuil --- drivers/media/usb/stkwebcam/stk-webcam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 6/8] usbvision: use u64 for the timestamp internally

2019-01-21 Thread hverkuil-cisco
From: Hans Verkuil Just like vb2 does, use u64 internally to store the timestamps of the buffers. Only convert to timeval when interfacing with userspace. Signed-off-by: Hans Verkuil --- drivers/media/usb/usbvision/usbvision-core.c | 2 +- drivers/media/usb/usbvision/usbvision-video.c | 4 ++-

[PATCH 3/8] meye: use u64 for the timestamp internally

2019-01-21 Thread hverkuil-cisco
From: Hans Verkuil Just like vb2 does, use u64 internally to store the timestamps of the buffers. Only convert to timeval when interfacing with userspace. Signed-off-by: Hans Verkuil --- drivers/media/pci/meye/meye.c | 8 drivers/media/pci/meye/meye.h | 2 +- 2 files changed, 5 insert

[PATCH 4/8] cpia2: use u64 for the timestamp internally

2019-01-21 Thread hverkuil-cisco
From: Hans Verkuil Just like vb2 does, use u64 internally to store the timestamps of the buffers. Only convert to timeval when interfacing with userspace. Signed-off-by: Hans Verkuil --- drivers/media/usb/cpia2/cpia2.h | 2 +- drivers/media/usb/cpia2/cpia2_usb.c | 2 +- drivers/media/usb

[PATCH 7/8] zoran: use u64 for the timestamp internally

2019-01-21 Thread hverkuil-cisco
From: Hans Verkuil Just like vb2 does, use u64 internally to store the timestamps of the buffers. Only convert to timeval when interfacing with userspace. Signed-off-by: Hans Verkuil --- drivers/staging/media/zoran/zoran.h| 2 +- drivers/staging/media/zoran/zoran_device.c | 4 ++-- dri

[PATCH 2/8] videobuf: use u64 for the timestamp internally

2019-01-21 Thread hverkuil-cisco
From: Hans Verkuil Just like vb2 does, use u64 internally to store the timestamps of the buffers. Only convert to timeval when interfacing with userspace. Signed-off-by: Hans Verkuil --- drivers/media/common/saa7146/saa7146_fops.c | 2 +- drivers/media/pci/bt8xx/bttv-driver.c | 8 +

[PATCH 8/8] soc_camera_platform: remove obsolete soc_camera test driver

2019-01-17 Thread hverkuil-cisco
From: Hans Verkuil This is a test stub driver for soc_camera. Since soc_camera is being deprecated (and in fact, nobody is using it anymore) there's no sense in keeping this test driver. Signed-off-by: Hans Verkuil --- drivers/media/platform/soc_camera/Kconfig | 6 - drivers/media/platfo

[PATCH 1/8] media: tw9910: Unregister subdevice with v4l2-async

2019-01-17 Thread hverkuil-cisco
From: Jacopo Mondi As the tw9910 subdevice is registered through the v4l2-async framework, use the v4l2-async provided function to register it. Fixes: 7b20f325a566 ("media: i2c: tw9910: Remove soc_camera dependencies") Signed-off-by: Jacopo Mondi Signed-off-by: Hans Verkuil --- drivers/media/

[PATCH 3/8] soc_ov772x: remove obsolete sensor driver

2019-01-17 Thread hverkuil-cisco
From: Hans Verkuil This driver got converted to not depend on soc_camera in commit 762c28121d7c ("media: i2c: ov772x: Remove soc_camera dependencies"). There's no sense in keeping the old version there. Signed-off-by: Hans Verkuil --- drivers/media/i2c/soc_camera/Kconfig |6 - driver

[PATCH 0/8] Remove obsolete soc_camera drivers

2019-01-17 Thread hverkuil-cisco
From: Hans Verkuil The soc_mt9t112, soc_ov772x and soc_tw9910 drivers now have non-soc-camera replacements, so those three drivers can be removed. The soc_camera sh_mobile_ceu_camera platform driver also has a non-soc-camera replacement, so remove this driver as well. This driver was also the l

[PATCH 7/8] soc_camera/soc_scale_crop: drop this unused code

2019-01-17 Thread hverkuil-cisco
From: Hans Verkuil With the removal of sh_mobile_ceu_camera.c this code is no longer used and can be removed. Signed-off-by: Hans Verkuil --- drivers/media/platform/soc_camera/Kconfig | 3 - drivers/media/platform/soc_camera/Makefile| 1 - .../platform/soc_camera/soc_scale_crop.c

[PATCH 5/8] soc_tw9910: remove obsolete sensor driver

2019-01-17 Thread hverkuil-cisco
From: Hans Verkuil This driver got converted to not depend on soc_camera in commit 7b20f325a566 ("media: i2c: tw9910: Remove soc_camera dependencies"). There's no sense in keeping the old version there. Signed-off-by: Hans Verkuil --- drivers/media/i2c/soc_camera/Kconfig | 6 - drivers

[PATCH 2/8] soc_mt9t112: remove obsolete sensor driver

2019-01-17 Thread hverkuil-cisco
From: Hans Verkuil This driver got converted to not depend on soc_camera in commit 6a26f141bf62 ("media: i2c: mt9t112: Remove soc_camera dependencies"). There's no sense in keeping the old version there. Signed-off-by: Hans Verkuil --- drivers/media/i2c/soc_camera/Kconfig |6 - driv

[PATCH 6/8] sh_mobile_ceu_camera: remove obsolete soc_camera driver

2019-01-17 Thread hverkuil-cisco
From: Hans Verkuil This driver got converted to not depend on soc_camera in commit 32e5a70dc8f4 ("media: platform: Add Renesas CEU driver"). There's no sense in keeping the old version there. Signed-off-by: Hans Verkuil --- drivers/media/platform/soc_camera/Kconfig |9 - drivers/media

[PATCH 4/8] tw9910.h: remove obsolete soc_camera.h include.

2019-01-17 Thread hverkuil-cisco
From: Hans Verkuil This include isn't use anymore, so drop it. Signed-off-by: Hans Verkuil --- include/media/i2c/tw9910.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/media/i2c/tw9910.h b/include/media/i2c/tw9910.h index bec8f7bce745..2f93799d5a21 100644 --- a/include/media/i2c

[PATCHv4 3/5] vivid: add buf_out_validate callback

2019-01-16 Thread hverkuil-cisco
From: Hans Verkuil Validate the field for an output buffer. This ensures that the field is validated when the buffer is queued to a request, and not when the request itself is queued, which is too late. Signed-off-by: Hans Verkuil --- drivers/media/platform/vivid/vivid-vid-out.c | 23 +

[PATCHv4 0/5] vb2: add buf_out_validate callback

2019-01-16 Thread hverkuil-cisco
From: Hans Verkuil When queueing a buffer to a request the 'field' value is not validated. That field is only validated when the _buf_prepare() is called, which happens when the request is queued. However, this validation should happen at QBUF time, since you want to know about this as soon as p

[PATCHv4 4/5] cedrus: add buf_out_validate callback

2019-01-16 Thread hverkuil-cisco
From: Hans Verkuil Validate the field for an output buffer. This ensures that the field is validated when the buffer is queued to a request, and not when the request itself is queued, which is too late. Signed-off-by: Hans Verkuil --- drivers/staging/media/sunxi/cedrus/cedrus_video.c | 9 +

[PATCHv4 2/5] vim2m: add buf_out_validate callback

2019-01-16 Thread hverkuil-cisco
From: Hans Verkuil Validate the field for an output buffer. This ensures that the field is validated when the buffer is queued to a request, and not when the request itself is queued, which is too late. Signed-off-by: Hans Verkuil --- drivers/media/platform/vim2m.c | 27 ---

[PATCHv4 5/5] vb2: check that buf_out_validate is present

2019-01-16 Thread hverkuil-cisco
From: Hans Verkuil The buf_out_validate is required for output queues in combination with requests. Check this. Signed-off-by: Hans Verkuil --- drivers/media/common/videobuf2/videobuf2-v4l2.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/common/videobuf2/videobuf2-v4

[PATCHv4 1/5] vb2: add buf_out_validate callback

2019-01-16 Thread hverkuil-cisco
From: Hans Verkuil When queueing a buffer to a request the 'field' value is not validated. That field is only validated when the _buf_prepare() is called, which happens when the request is queued. However, this validation should happen at QBUF time, since you want to know about this as soon as p

[PATCHv2 0/3] vb2: add buf_out_validate callback

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil Adding the request API uncovered a pre-existing problem with validating output buffers. The problem is that for output buffers the driver has to validate the 'field' field of struct v4l2_buffer. This is critical when encoding or deinterlacing interlaced video. Drivers always

[PATCHv2 1/3] vb2: add buf_out_validate callback

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil Adding the request API uncovered a pre-existing problem with validating output buffers. The problem is that for output buffers the driver has to validate the 'field' field of struct v4l2_buffer. This is critical when encoding or deinterlacing interlaced video. Drivers always

[PATCHv2 2/3] vim2m: add buf_out_validate callback

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil Split off the field validation from buf_prepare into a new buf_out_validate function. Field validation for output buffers should be done there since buf_prepare is not guaranteed to be called at QBUF time. Signed-off-by: Hans Verkuil --- drivers/media/platform/vim2m.c | 16 +

[PATCHv2 3/3] vivid: add buf_out_validate callback

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil Split off the field validation from buf_prepare into a new buf_out_validate function. Field validation for output buffers should be done there since buf_prepare is not guaranteed to be called at QBUF time. Signed-off-by: Hans Verkuil --- drivers/media/platform/vivid/vivid-vi

[PATCHv6 8/8] extended-controls.rst: update the mpeg2 compound controls

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil The layout of the compound controls has changed to fix 32/64 bit alignment issues and the use of timestamps instead of buffer indices to refer to buffers. Signed-off-by: Hans Verkuil --- .../media/uapi/v4l/extended-controls.rst | 28 +++ 1 file changed,

[PATCHv6 6/8] vb2: add vb2_find_timestamp()

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil Use v4l2_timeval_to_ns instead of timeval_to_ns to ensure that both kernelspace and userspace will use the same conversion function. Next add a new vb2_find_timestamp() function to find buffers with a specific timestamp. This function will only look at DEQUEUED and DONE buffe

[PATCHv6 5/8] videodev2.h: add v4l2_timeval_to_ns inline function

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil We want to be able to uniquely identify buffers for stateless codecs. The internal timestamp (a u64) as stored internally in the kernel is a suitable candidate for that, but in struct v4l2_buffer it is represented as a struct timeval. Add a v4l2_timeval_to_ns() function that c

[PATCHv6 7/8] cedrus: identify buffers by timestamp

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil Use the new v4l2_m2m_buf_copy_data helper function and use timestamps to refer to reference frames instead of using buffer indices. Also remove the padding fields in the structs, that's a bad idea. Just use the right types to keep everything aligned. Signed-off-by: Hans Verku

[PATCHv6 3/8] vicodec: use v4l2_m2m_buf_copy_data

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil Use the new v4l2_m2m_buf_copy_data() function in vicodec. Signed-off-by: Hans Verkuil --- drivers/media/platform/vicodec/vicodec-core.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/m

[PATCHv6 1/8] v4l2-mem2mem: add v4l2_m2m_buf_copy_data helper function

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil Memory-to-memory devices should copy various parts of struct v4l2_buffer from the output buffer to the capture buffer. Add a helper function that does that to simplify the driver code. Signed-off-by: Hans Verkuil Reviewed-by: Paul Kocialkowski Reviewed-by: Alexandre Courbot

[PATCHv6 2/8] vim2m: use v4l2_m2m_buf_copy_data

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil Use the new v4l2_m2m_buf_copy_data() function in vim2m. Signed-off-by: Hans Verkuil --- drivers/media/platform/vim2m.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index d0182

[PATCHv6 4/8] buffer.rst: clean up timecode documentation

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil V4L2_BUF_FLAG_TIMECODE is not video capture specific, so drop that part. The 'Timecodes' section was a bit messy, so that's cleaned up. Signed-off-by: Hans Verkuil Reviewed-by: Paul Kocialkowski Reviewed-by: Alexandre Courbot --- Documentation/media/uapi/v4l/buffer.rst |

[PATCHv6 0/8] vb2/cedrus: use timestamps to identify buffers

2019-01-07 Thread hverkuil-cisco
From: Hans Verkuil As was discussed here (among other places): https://lkml.org/lkml/2018/10/19/440 using capture queue buffer indices to refer to reference frames is not a good idea. Instead, after a long irc discussion: https://linuxtv.org/irc/irclogger_log/v4l?date=2018-12-12,Wed it was

[PATCH 1/2] v4l2-mem2mem: add job_write callback

2018-12-14 Thread hverkuil-cisco
From: Hans Verkuil The m2m framework works well for a stateful decoder: in job_ready() you can process all output buffers until the whole compressed frame is available for decoding, and then you return true to signal that the decoder can start. The decoder decodes to a single capture buffer, and

[PATCH 2/2] vicodec: add encoder support to write to multiple buffers

2018-12-14 Thread hverkuil-cisco
From: Hans Verkuil With the new mem2mem functionality it is now easy to write the result of the encoder to multiple buffers. Signed-off-by: Hans Verkuil --- drivers/media/platform/vicodec/vicodec-core.c | 91 +++ 1 file changed, 75 insertions(+), 16 deletions(-) diff --git a/d

[PATCH 0/2] v4l2-mem2mem: add job_write() to support encoders

2018-12-14 Thread hverkuil-cisco
From: Hans Verkuil The m2m framework is not quite symmetrical: decoders can process multiple output buffers in job_ready until enough buffers have arrived so a frame can be decoded. However, encoders do not have an equivalent where multiple capture buffers can be used to write the compressed fra

[RFCv5 PATCH 3/4] media: add functions to add properties to objects

2018-12-13 Thread hverkuil-cisco
From: Hans Verkuil Add functions to add properties to entities, pads and other properties. This can be extended to include interfaces and links in the future when needed. Signed-off-by: Hans Verkuil --- drivers/media/media-entity.c | 64 + include/media/media-entity.h | 264 ++

[RFCv5 PATCH 0/4] Add properties support to the media controller

2018-12-13 Thread hverkuil-cisco
From: Hans Verkuil The main changes since RFCv4 are: - Dropped all the indexing code that I added to make it easier to traverse the topology. I still think that's a good idea, but that can be done in a future patch. - Split the second patch into two: the first part adds the core support, t

[RFCv5 PATCH 2/4] media controller: add properties support

2018-12-13 Thread hverkuil-cisco
From: Hans Verkuil Add support for properties. In this initial implementation properties can be added to entities and pads. In addition, properties can be nested. Most of the changes are straightforward, but I had to make some changes to the way entities are initialized, since the struct has to

[RFCv5 PATCH 4/4] vimc: add property test code

2018-12-13 Thread hverkuil-cisco
From: Hans Verkuil Add properties to entities and pads to be able to test the properties API. Signed-off-by: Hans Verkuil --- drivers/media/platform/vimc/vimc-common.c | 50 +++ 1 file changed, 50 insertions(+) diff --git a/drivers/media/platform/vimc/vimc-common.c b/driv

[RFCv5 PATCH 1/4] uapi/linux/media.h: add property support

2018-12-13 Thread hverkuil-cisco
From: Hans Verkuil Extend the topology struct with a properties array. Add a new media_v2_prop structure to store property information. Signed-off-by: Hans Verkuil --- include/uapi/linux/media.h | 56 ++ 1 file changed, 56 insertions(+) diff --git a/includ

[PATCHv5 2/8] vim2m: use v4l2_m2m_buf_copy_data

2018-12-12 Thread hverkuil-cisco
From: Hans Verkuil Use the new v4l2_m2m_buf_copy_data() function in vim2m. Signed-off-by: Hans Verkuil --- drivers/media/platform/vim2m.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index d0182

[PATCHv5 6/8] vb2: add vb2_find_timestamp()

2018-12-12 Thread hverkuil-cisco
From: Hans Verkuil Use v4l2_timeval_to_ns instead of timeval_to_ns to ensure that both kernelspace and userspace will use the same conversion function. Next add a new vb2_find_timestamp() function to find buffers with a specific timestamp. This function will only look at DEQUEUED and DONE buffe

[PATCHv5 3/8] vicodec: use v4l2_m2m_buf_copy_data

2018-12-12 Thread hverkuil-cisco
From: Hans Verkuil Use the new v4l2_m2m_buf_copy_data() function in vicodec. Signed-off-by: Hans Verkuil --- drivers/media/platform/vicodec/vicodec-core.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/m

[PATCHv5 5/8] videodev2.h: add v4l2_timeval_to_ns inline function

2018-12-12 Thread hverkuil-cisco
From: Hans Verkuil We want to be able to uniquely identify buffers for stateless codecs. The internal timestamp (a u64) as stored internally in the kernel is a suitable candidate for that, but in struct v4l2_buffer it is represented as a struct timeval. Add a v4l2_timeval_to_ns() function that c

[PATCHv5 4/8] buffer.rst: clean up timecode documentation

2018-12-12 Thread hverkuil-cisco
From: Hans Verkuil V4L2_BUF_FLAG_TIMECODE is not video capture specific, so drop that part. The 'Timecodes' section was a bit messy, so that's cleaned up. Signed-off-by: Hans Verkuil Reviewed-by: Paul Kocialkowski Reviewed-by: Alexandre Courbot --- Documentation/media/uapi/v4l/buffer.rst |

[PATCHv5 1/8] v4l2-mem2mem: add v4l2_m2m_buf_copy_data helper function

2018-12-12 Thread hverkuil-cisco
From: Hans Verkuil Memory-to-memory devices should copy various parts of struct v4l2_buffer from the output buffer to the capture buffer. Add a helper function that does that to simplify the driver code. Signed-off-by: Hans Verkuil Reviewed-by: Paul Kocialkowski Reviewed-by: Alexandre Courbot

[PATCHv5 8/8] extended-controls.rst: update the mpeg2 compound controls

2018-12-12 Thread hverkuil-cisco
From: Hans Verkuil The layout of the compound controls has changed to fix 32/64 bit alignment issues and the use of timestamps instead of buffer indices to refer to buffers. Signed-off-by: Hans Verkuil --- .../media/uapi/v4l/extended-controls.rst | 28 +++ 1 file changed,

[PATCHv5 0/8] vb2/cedrus: use timestamps to identify buffers

2018-12-12 Thread hverkuil-cisco
From: Hans Verkuil As was discussed here (among other places): https://lkml.org/lkml/2018/10/19/440 using capture queue buffer indices to refer to reference frames is not a good idea. Instead, after a long irc discussion: https://linuxtv.org/irc/irclogger_log/v4l?date=2018-12-12,Wed it was

[PATCHv5 7/8] cedrus: identify buffers by timestamp

2018-12-12 Thread hverkuil-cisco
From: Hans Verkuil Use the new v4l2_m2m_buf_copy_data helper function and use timestamps to refer to reference frames instead of using buffer indices. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2-ctrls.c | 9 drivers/staging/media/sunxi/cedrus/cedrus.h | 9

  1   2   >