New issue
Advanced search Search tips

Issue 902656 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Nov 9
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Feature



Sign in to add a comment

Merge request API into 4.19

Project Member Reported by acourbot@google.com, Nov 7

Issue description

The request API will be needed for some drivers in 4.19. This bug tracks its integration into the Chrome OS kernel tree.
 
Cc: posciak@chromium.org
Components: OS>Kernel>Camera OS>Kernel>Video
Labels: media-kernel-shortlist OS-Chrome
Project Member

Comment 3 by bugdroid1@chromium.org, Nov 9

Labels: merge-merged-chromeos-4.19
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/fafd43c288ef4de7f385fde1dd59e45aec303d45

commit fafd43c288ef4de7f385fde1dd59e45aec303d45
Author: Alexandre Courbot <acourbot@chromium.org>
Date: Fri Nov 09 03:54:58 2018

UPSTREAM: media: Documentation: v4l: document request API

Document the request API for V4L2 devices, and amend the documentation
of system calls influenced by it.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit cbb6a7f52b148dea0fed434b629aedddf7804d14)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I1fde2da10ee3d3a76bb2ac04165a9cd27ac75a6a
Reviewed-on: https://chromium-review.googlesource.com/c/1325750
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[add] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/mediactl/request-func-poll.rst
[modify] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/videodev2.h.rst.exceptions
[modify] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/v4l/vidioc-qbuf.rst
[modify] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/mediactl/media-funcs.rst
[modify] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/v4l/buffer.rst
[add] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/mediactl/media-ioc-request-alloc.rst
[add] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/mediactl/media-request-ioc-reinit.rst
[add] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/mediactl/request-func-close.rst
[add] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/mediactl/media-request-ioc-queue.rst
[modify] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst
[modify] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/mediactl/media-controller.rst
[add] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/mediactl/request-api.rst
[add] https://crrev.com/fafd43c288ef4de7f385fde1dd59e45aec303d45/Documentation/media/uapi/mediactl/request-func-ioctl.rst

Project Member

Comment 4 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/88cb44caacec31cdd0537fc577b6432bd7fe65ce

commit 88cb44caacec31cdd0537fc577b6432bd7fe65ce
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:01 2018

UPSTREAM: media: uapi/linux/media.h: add request API

Define the public request API.

This adds the new MEDIA_IOC_REQUEST_ALLOC ioctl to allocate a request
and two ioctls that operate on a request in order to queue the
contents of the request to the driver and to re-initialize the
request.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 66431c0bab0fb8bdd62930575869bea98eb2baf0)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I09aacf0dd8225054ef762b16ade015fe356cf62c
Reviewed-on: https://chromium-review.googlesource.com/c/1325751
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/88cb44caacec31cdd0537fc577b6432bd7fe65ce/include/uapi/linux/media.h

Project Member

Comment 5 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/3f122cb6ef79e8b78e09d020c0bdf2d6ba88550a

commit 3f122cb6ef79e8b78e09d020c0bdf2d6ba88550a
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:03 2018

UPSTREAM: media: media-request: implement media requests

Add initial media request support:

1) Add MEDIA_IOC_REQUEST_ALLOC ioctl support to media-device.c
2) Add struct media_request to store request objects.
3) Add struct media_request_object to represent a request object.
4) Add MEDIA_REQUEST_IOC_QUEUE/REINIT ioctl support.

Basic lifecycle: the application allocates a request, adds
objects to it, queues the request, polls until it is completed
and can then read the final values of the objects at the time
of completion. When it closes the file descriptor the request
memory will be freed (actually, when the last user of that request
releases the request).

Drivers will bind an object to a request (the 'adds objects to it'
phase), when MEDIA_REQUEST_IOC_QUEUE is called the request is
validated (req_validate op), then queued (the req_queue op).

When done with an object it can either be unbound from the request
(e.g. when the driver has finished with a vb2 buffer) or marked as
completed (e.g. for controls associated with a buffer). When all
objects in the request are completed (or unbound), then the request
fd will signal an exception (poll).

Co-developed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Co-developed-by: Alexandre Courbot <acourbot@chromium.org>

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 10905d70d78841a6fa191be5ec193e3c0d63555f)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I64ab2a7f6cad8569066cba013fcb6fe2b193db49
Reviewed-on: https://chromium-review.googlesource.com/c/1325752
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/3f122cb6ef79e8b78e09d020c0bdf2d6ba88550a/drivers/media/Makefile
[add] https://crrev.com/3f122cb6ef79e8b78e09d020c0bdf2d6ba88550a/include/media/media-request.h
[modify] https://crrev.com/3f122cb6ef79e8b78e09d020c0bdf2d6ba88550a/drivers/media/media-device.c
[modify] https://crrev.com/3f122cb6ef79e8b78e09d020c0bdf2d6ba88550a/include/media/media-device.h
[add] https://crrev.com/3f122cb6ef79e8b78e09d020c0bdf2d6ba88550a/drivers/media/media-request.c

Project Member

Comment 6 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/390a4ac830fd5b7f588a9698ba4ed42f7d6ff24c

commit 390a4ac830fd5b7f588a9698ba4ed42f7d6ff24c
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date: Fri Nov 09 03:55:05 2018

UPSTREAM: media: doc: Add media-request.h header to documentation build

media-request.h has been recently added; add it to the documentation build
as well.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 496f6f4d8a84421b70c4fb629656cb4730cbcd61)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I9c00ea2517fe470408d35537dc90556c06e1f692
Reviewed-on: https://chromium-review.googlesource.com/c/1325753
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/390a4ac830fd5b7f588a9698ba4ed42f7d6ff24c/Documentation/media/kapi/mc-core.rst

Project Member

Comment 7 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e58ce34bd28c7f8f00abadd5f1651e2e54c8d363

commit e58ce34bd28c7f8f00abadd5f1651e2e54c8d363
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:07 2018

UPSTREAM: media: media-request: add media_request_get_by_fd

Add media_request_get_by_fd() to find a request based on the file
descriptor.

The caller has to call media_request_put() for the returned
request since this function increments the refcount.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit be9d6d4b0bf9cc3644826fb95264dbddb9a6d047)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Iba41990c740bbb2785ff005b6bea21c18dad3638
Reviewed-on: https://chromium-review.googlesource.com/c/1325754
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/e58ce34bd28c7f8f00abadd5f1651e2e54c8d363/include/media/media-request.h

Project Member

Comment 8 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/ce6ce20ed2a03d003a0049eebee9f666454f7cc6

commit ce6ce20ed2a03d003a0049eebee9f666454f7cc6
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:09 2018

UPSTREAM: media: media-request: add media_request_object_find

Add media_request_object_find to find a request object inside a
request based on ops and priv values.

Objects of the same type (vb2 buffer, control handler) will have
the same ops value. And objects that refer to the same 'parent'
object (e.g. the v4l2_ctrl_handler that has the current driver
state) will have the same priv value.

The caller has to call media_request_object_put() for the returned
object since this function increments the refcount.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 0ca0e8442dcd5da2af5ce35e90b083a492b4cbac)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I5a137f2b5d2dbe1c62ddbde28b24a4c705c9ed3b
Reviewed-on: https://chromium-review.googlesource.com/c/1325755
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/ce6ce20ed2a03d003a0049eebee9f666454f7cc6/drivers/media/media-request.c
[modify] https://crrev.com/ce6ce20ed2a03d003a0049eebee9f666454f7cc6/include/media/media-request.h

Project Member

Comment 9 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/91ada0aba96dc1f408c4d99b43874f03fe724217

commit 91ada0aba96dc1f408c4d99b43874f03fe724217
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:11 2018

UPSTREAM: media: v4l2-device.h: add v4l2_device_supports_requests() helper

Add a simple helper function that tests if the driver supports
the request API.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 93a9d9008d3c963d5d12c56460b5e1d93dad3ea8)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I4a33fb7508b192db1a58c5069a438218ea68735d
Reviewed-on: https://chromium-review.googlesource.com/c/1325756
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/91ada0aba96dc1f408c4d99b43874f03fe724217/include/media/v4l2-device.h

Project Member

Comment 10 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/70967cee2258669bd6584f7a6cccc7cc63d18ee9

commit 70967cee2258669bd6584f7a6cccc7cc63d18ee9
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:13 2018

UPSTREAM: media: v4l2-dev: lock req_queue_mutex

We need to serialize streamon/off with queueing new requests.
These ioctls may trigger the cancellation of a streaming
operation, and that should not be mixed with queuing a new
request at the same time.

Finally close() needs this lock since that too can trigger the
cancellation of a streaming operation.

We take the req_queue_mutex here before any other locks since
it is a very high-level lock.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit cc6eddcd37ce6be403b5820ffd84cb84b33b653f)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I20620038691b0fa34e9c800b701aacb35f1b05ab
Reviewed-on: https://chromium-review.googlesource.com/c/1325757
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/70967cee2258669bd6584f7a6cccc7cc63d18ee9/drivers/media/v4l2-core/v4l2-dev.c
[modify] https://crrev.com/70967cee2258669bd6584f7a6cccc7cc63d18ee9/drivers/media/v4l2-core/v4l2-ioctl.c

Project Member

Comment 11 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2a3b4fc150160d8642d49f364cad1a352889c3ef

commit 2a3b4fc150160d8642d49f364cad1a352889c3ef
Author: Alexandre Courbot <acourbot@chromium.org>
Date: Fri Nov 09 03:55:15 2018

UPSTREAM: media: videodev2.h: add request_fd field to v4l2_ext_controls

If 'which' is V4L2_CTRL_WHICH_REQUEST_VAL, then the 'request_fd' field
can be used to specify a request for the G/S/TRY_EXT_CTRLS ioctls.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit f23317adf6a726b9dbedbe3a0363846f597cc0e8)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ifee45ac3315c61d8eb2ab3afc2654b2d098b7f71
Reviewed-on: https://chromium-review.googlesource.com/c/1325758
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/2a3b4fc150160d8642d49f364cad1a352889c3ef/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
[modify] https://crrev.com/2a3b4fc150160d8642d49f364cad1a352889c3ef/drivers/media/v4l2-core/v4l2-ioctl.c
[modify] https://crrev.com/2a3b4fc150160d8642d49f364cad1a352889c3ef/include/uapi/linux/videodev2.h

Project Member

Comment 12 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/bececf03e60d3e8cfcecf873b276f2e1a3e86b20

commit bececf03e60d3e8cfcecf873b276f2e1a3e86b20
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:17 2018

UPSTREAM: media: v4l2-ctrls: v4l2_ctrl_add_handler: add from_other_dev

Add a 'bool from_other_dev' argument: set to true if the two
handlers refer to different devices (e.g. it is true when
inheriting controls from a subdev into a main v4l2 bridge
driver).

This will be used later when implementing support for the
request API since we need to skip such controls.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit da1b1aeac1aced231ac85329112a592dc14d173a)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I63c35a46b14deab2452953fa3858190a459ea35d
Reviewed-on: https://chromium-review.googlesource.com/c/1325759
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/platform/rcar-vin/rcar-core.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/dvb-frontends/rtl2832_sdr.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/pci/bt8xx/bttv-driver.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/pci/cx88/cx88-video.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/v4l2-core/v4l2-device.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/platform/rcar_drif.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/staging/media/imx/imx-media-dev.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/pci/saa7134/saa7134-video.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/usb/cx231xx/cx231xx-video.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/pci/cx23885/cx23885-417.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/platform/soc_camera/soc_camera.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/staging/media/imx/imx-media-fim.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/v4l2-core/v4l2-ctrls.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/usb/cx231xx/cx231xx-417.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/include/media/v4l2-ctrls.h
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/pci/cx88/cx88-blackbird.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/platform/vivid/vivid-ctrls.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/usb/tm6000/tm6000-video.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/platform/exynos4-is/fimc-capture.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/usb/msi2500/msi2500.c
[modify] https://crrev.com/bececf03e60d3e8cfcecf873b276f2e1a3e86b20/drivers/media/pci/saa7134/saa7134-empress.c

Project Member

Comment 13 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/8e94589aed86f4efff53c8d45651a0dceb06f6ed

commit 8e94589aed86f4efff53c8d45651a0dceb06f6ed
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:19 2018

UPSTREAM: media: v4l2-ctrls: prepare internal structs for request API

Embed and initialize a media_request_object in struct v4l2_ctrl_handler.

Add a p_req field to struct v4l2_ctrl_ref that will store the
request value.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 52beeddb68833e02c0923bc46868b347a6ad393c)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Id6876187c2253b6bad362a74588068a4096d1194
Reviewed-on: https://chromium-review.googlesource.com/c/1325760
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/8e94589aed86f4efff53c8d45651a0dceb06f6ed/include/media/v4l2-ctrls.h
[modify] https://crrev.com/8e94589aed86f4efff53c8d45651a0dceb06f6ed/drivers/media/v4l2-core/v4l2-ctrls.c

Project Member

Comment 14 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2d100488abcbf812f90ec7e1cfeec6e6b16aa352

commit 2d100488abcbf812f90ec7e1cfeec6e6b16aa352
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:21 2018

UPSTREAM: media: v4l2-ctrls: alloc memory for p_req

To store request data the handler_new_ref() allocates memory
for it if needed.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 178543a3ba96b7857fcb6cef806ed9f98ea0cca1)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I4282a2edc3a96fc2cb21ab4ca940b902435b36b6
Reviewed-on: https://chromium-review.googlesource.com/c/1325761
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/2d100488abcbf812f90ec7e1cfeec6e6b16aa352/drivers/media/v4l2-core/v4l2-ctrls.c

Project Member

Comment 15 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/564ae4db3df5876ac3393f9cb4f32d0ccba3f421

commit 564ae4db3df5876ac3393f9cb4f32d0ccba3f421
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:23 2018

UPSTREAM: media: v4l2-ctrls: use ref in helper instead of ctrl

The next patch needs the reference to a control instead of the
control itself, so change struct v4l2_ctrl_helper accordingly.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit dcea5601dbdfb13be91526eb898c0f9122381032)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I19c888f74caeceb124f94ae280aea4309a132dec
Reviewed-on: https://chromium-review.googlesource.com/c/1325762
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/564ae4db3df5876ac3393f9cb4f32d0ccba3f421/drivers/media/v4l2-core/v4l2-ctrls.c

Project Member

Comment 16 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/22e53c8fec84b6eb19cc40446e174e37037ddc18

commit 22e53c8fec84b6eb19cc40446e174e37037ddc18
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:25 2018

UPSTREAM: media: v4l2-ctrls: add core request support

Integrate the request support. This adds the v4l2_ctrl_request_complete
and v4l2_ctrl_request_setup functions to complete a request and (as a
helper function) to apply a request to the hardware.

It takes care of queuing requests and correctly chaining control values
in the request queue.

Note that when a request is marked completed it will copy control values
to the internal request state. This can be optimized in the future since
this is sub-optimal when dealing with large compound and/or array controls.

For the initial 'stateless codec' use-case the current implementation is
sufficient.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 6fa6f831f0950bf46934e6c3a9766b258a9ea85f)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ic393e51f517086124b0df13815b56a79f06fda56
Reviewed-on: https://chromium-review.googlesource.com/c/1325763
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/22e53c8fec84b6eb19cc40446e174e37037ddc18/include/media/v4l2-ctrls.h
[modify] https://crrev.com/22e53c8fec84b6eb19cc40446e174e37037ddc18/drivers/media/v4l2-core/v4l2-ctrls.c

Project Member

Comment 17 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/811131262c063a32a736b613f391c0b7cd83879b

commit 811131262c063a32a736b613f391c0b7cd83879b
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:27 2018

UPSTREAM: media: v4l2-ctrls: support g/s_ext_ctrls for requests

The v4l2_g/s_ext_ctrls functions now support control handlers that
represent requests.

The v4l2_ctrls_find_req_obj() function is responsible for finding the
request from the fd.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit c41e9cff704a06b8cbd9eeea0fdec54fb6d13825)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ib850774ee2e9dc31bb179647b1780e5ea666a55e
Reviewed-on: https://chromium-review.googlesource.com/c/1325764
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/811131262c063a32a736b613f391c0b7cd83879b/drivers/media/platform/omap3isp/ispvideo.c
[modify] https://crrev.com/811131262c063a32a736b613f391c0b7cd83879b/drivers/media/v4l2-core/v4l2-ioctl.c
[modify] https://crrev.com/811131262c063a32a736b613f391c0b7cd83879b/drivers/media/v4l2-core/v4l2-subdev.c
[modify] https://crrev.com/811131262c063a32a736b613f391c0b7cd83879b/drivers/media/v4l2-core/v4l2-ctrls.c
[modify] https://crrev.com/811131262c063a32a736b613f391c0b7cd83879b/include/media/v4l2-ctrls.h

Project Member

Comment 18 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/0be4431b4d6dd05ae5d5a5604e8c58de165d0208

commit 0be4431b4d6dd05ae5d5a5604e8c58de165d0208
Author: Hans Verkuil <hverkuil@xs4all.nl>
Date: Fri Nov 09 03:55:29 2018

UPSTREAM: media: v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions

If a driver needs to find/inspect the controls set in a request then
it can use these functions.

E.g. to check if a required control is set in a request use this in the
req_validate() implementation:

	int res = -EINVAL;

	hdl = v4l2_ctrl_request_hdl_find(req, parent_hdl);
	if (hdl) {
		if (v4l2_ctrl_request_hdl_ctrl_find(hdl, ctrl_id))
			res = 0;
		v4l2_ctrl_request_hdl_put(hdl);
	}
	return res;

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 5f611d74c2bd89296aa045609df0e5309ff7ab41)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I02e6949dfe11ab90c1bc39ecaa30fe666b62c33b
Reviewed-on: https://chromium-review.googlesource.com/c/1325765
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/0be4431b4d6dd05ae5d5a5604e8c58de165d0208/include/media/v4l2-ctrls.h
[modify] https://crrev.com/0be4431b4d6dd05ae5d5a5604e8c58de165d0208/drivers/media/v4l2-core/v4l2-ctrls.c

Project Member

Comment 19 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/c0f12b266c2daaf74ce001969413472be8447b24

commit c0f12b266c2daaf74ce001969413472be8447b24
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:31 2018

UPSTREAM: media: videobuf2-v4l2: move __fill_v4l2_buffer() function

Move the __fill_v4l2_buffer() to before the vb2_queue_or_prepare_buf()
function to prepare for the next two patches.

No other changes.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 5f89ec80f1e074d3f25c989264e376a452b03d02)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I6f43151163bcadc18cbbe6ec87d3f97bc689c4c4
Reviewed-on: https://chromium-review.googlesource.com/c/1325766
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/c0f12b266c2daaf74ce001969413472be8447b24/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 20 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/0bdf8aa0966bb1a0f70636a03f119ad03d8af61a

commit 0bdf8aa0966bb1a0f70636a03f119ad03d8af61a
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:33 2018

UPSTREAM: media: videobuf2-v4l2: replace if by switch in __fill_vb2_buffer()

Replace 'if' statements by a switch in __fill_vb2_buffer()
in preparation of the next patch.

No other changes.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 0af4e80bf24a3caf56cd94d6dbe6a8bb72536b1d)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ia67543dbbea24ef18387ef24d0e2fb603eb6d9dd
Reviewed-on: https://chromium-review.googlesource.com/c/1325767
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/0bdf8aa0966bb1a0f70636a03f119ad03d8af61a/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 21 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/9f3bb88bb6de8c2f918fb33f13e8e911c9cd7964

commit 9f3bb88bb6de8c2f918fb33f13e8e911c9cd7964
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:35 2018

UPSTREAM: media: vb2: store userspace data in vb2_v4l2_buffer

The userspace-provided plane data needs to be stored in
vb2_v4l2_buffer. Currently this information is applied by
__fill_vb2_buffer() which is called by the core prepare_buf
and qbuf functions, but when using requests these functions
aren't called yet since the buffer won't be prepared until
the media request is actually queued.

In the meantime this information has to be stored somewhere
and vb2_v4l2_buffer is a good place for it.

The __fill_vb2_buffer callback now just copies the relevant
information from vb2_v4l2_buffer into the planes array.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit db6e8d57e2cd9fb77e6ceef8476912caecbd59b5)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I979d6a68d1e5a223872416b538b67bf7e963b376
Reviewed-on: https://chromium-review.googlesource.com/c/1325768
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/9f3bb88bb6de8c2f918fb33f13e8e911c9cd7964/drivers/media/dvb-core/dvb_vb2.c
[modify] https://crrev.com/9f3bb88bb6de8c2f918fb33f13e8e911c9cd7964/include/media/videobuf2-v4l2.h
[modify] https://crrev.com/9f3bb88bb6de8c2f918fb33f13e8e911c9cd7964/include/media/videobuf2-core.h
[modify] https://crrev.com/9f3bb88bb6de8c2f918fb33f13e8e911c9cd7964/drivers/media/common/videobuf2/videobuf2-core.c
[modify] https://crrev.com/9f3bb88bb6de8c2f918fb33f13e8e911c9cd7964/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 22 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/f5638801d80e420d2f983ee43a72ece81e30e8a9

commit f5638801d80e420d2f983ee43a72ece81e30e8a9
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:37 2018

UPSTREAM: media: davinci_vpfe: remove bogus vb2->state check

There is no need to check the vb2 state in the buf_prepare
callback: it can never be wrong.

Since VB2_BUF_STATE_PREPARED will be removed in the next patch
we'll remove this unnecessary check (and use of that state) first.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 559cd0a3e4848050810d125ffba36dab1e686c9d)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I5e2627b737bbc2693af71644d1784cc87112c41b
Reviewed-on: https://chromium-review.googlesource.com/c/1325769
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/f5638801d80e420d2f983ee43a72ece81e30e8a9/drivers/staging/media/davinci_vpfe/vpfe_video.c

Project Member

Comment 23 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/925f363e3da45fe0c222d1742b6851629602eae1

commit 925f363e3da45fe0c222d1742b6851629602eae1
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:39 2018

BACKPORT: media: vb2: drop VB2_BUF_STATE_PREPARED, use bool prepared/synced instead

The PREPARED state becomes a problem with the request API: a buffer
could be PREPARED but dequeued, or PREPARED and in state IN_REQUEST.

PREPARED is really not a state as such, but more a property of the
buffer. So make new 'prepared' and 'synced' bools instead to remember
whether the buffer is prepared and/or synced or not.

V4L2_BUF_FLAG_PREPARED is only set if the buffer is both synced and
prepared and in the DEQUEUED state.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 55028695c3bbd8f202b969a5a702caa7d7a51675)

Change-Id: I94016e051cbe78ba65cc5986ff3755e2e9f2fa0e
[acourbot@chromium.org: fixed conflicts in videobuf2-core.c]
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/1325770
Reviewed-by: Tomasz Figa <tfiga@chromium.org>

[modify] https://crrev.com/925f363e3da45fe0c222d1742b6851629602eae1/include/media/videobuf2-core.h
[modify] https://crrev.com/925f363e3da45fe0c222d1742b6851629602eae1/drivers/media/common/videobuf2/videobuf2-core.c
[modify] https://crrev.com/925f363e3da45fe0c222d1742b6851629602eae1/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 24 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/c8d652e2d50656f76e5014d34424920f897b3b2f

commit c8d652e2d50656f76e5014d34424920f897b3b2f
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:41 2018

UPSTREAM: media: videodev2.h: Add request_fd field to v4l2_buffer

When queuing buffers allow for passing the request that should
be associated with this buffer.

If V4L2_BUF_FLAG_REQUEST_FD is set, then request_fd is used as
the file descriptor.

If a buffer is stored in a request, but not yet queued to the
driver, then V4L2_BUF_FLAG_IN_REQUEST is set.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 62fed26ff4338eeccc702799be358bbb1471b76c)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I6d6f0f6a4dab3fe30d9a97697b04ffbe45e91204
Reviewed-on: https://chromium-review.googlesource.com/c/1325771
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/c8d652e2d50656f76e5014d34424920f897b3b2f/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
[modify] https://crrev.com/c8d652e2d50656f76e5014d34424920f897b3b2f/drivers/media/v4l2-core/v4l2-ioctl.c
[modify] https://crrev.com/c8d652e2d50656f76e5014d34424920f897b3b2f/drivers/media/usb/cpia2/cpia2_v4l.c
[modify] https://crrev.com/c8d652e2d50656f76e5014d34424920f897b3b2f/include/uapi/linux/videodev2.h
[modify] https://crrev.com/c8d652e2d50656f76e5014d34424920f897b3b2f/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 25 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/c9f1df5f71a9cc80d971d54017471c963f87e713

commit c9f1df5f71a9cc80d971d54017471c963f87e713
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:43 2018

UPSTREAM: media: vb2: add init_buffer buffer op

We need to initialize the request_fd field in struct vb2_v4l2_buffer
to -1 instead of the default of 0. So we need to add a new op that
is called when struct vb2_v4l2_buffer is allocated.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 8e013700bc12806d80f31ebe360916987f0e03df)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I3efa9d4bf46574f0e6a05e55fd1e366bb2394aff
Reviewed-on: https://chromium-review.googlesource.com/c/1325772
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/c9f1df5f71a9cc80d971d54017471c963f87e713/include/media/videobuf2-core.h
[modify] https://crrev.com/c9f1df5f71a9cc80d971d54017471c963f87e713/drivers/media/common/videobuf2/videobuf2-core.c

Project Member

Comment 26 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e3e09d5011a4ff72939ad066155204b18c2adcec

commit e3e09d5011a4ff72939ad066155204b18c2adcec
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:45 2018

UPSTREAM: media: videobuf2-core: embed media_request_object

Make vb2_buffer a request object.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 1cf96dcc6e79a860d2216a4d1c3edb1676a5798e)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: If91c56dc2127e21df7837b4409c5608c8d24da98
Reviewed-on: https://chromium-review.googlesource.com/c/1325773
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/e3e09d5011a4ff72939ad066155204b18c2adcec/include/media/videobuf2-core.h

Project Member

Comment 27 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/305f1c8ee5098de261faa2735934846f7f55741d

commit 305f1c8ee5098de261faa2735934846f7f55741d
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:47 2018

BACKPORT: media: videobuf2-core: integrate with media requests

Buffers can now be prepared or queued for a request.

A buffer is unbound from the request at vb2_buffer_done time or
when the queue is cancelled.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit fd89e0bb6ebff6481b9b8dd73729f5d62984490a)

Change-Id: I636bfca60b701b3b311a4e2fe2e02f40537c30b6
[acourbot@chromium.org: fix merge conflicts in videobuf2-core.c]
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/1325774
Reviewed-by: Tomasz Figa <tfiga@chromium.org>

[modify] https://crrev.com/305f1c8ee5098de261faa2735934846f7f55741d/drivers/media/dvb-core/dvb_vb2.c
[modify] https://crrev.com/305f1c8ee5098de261faa2735934846f7f55741d/include/media/videobuf2-core.h
[modify] https://crrev.com/305f1c8ee5098de261faa2735934846f7f55741d/drivers/media/common/videobuf2/videobuf2-core.c
[modify] https://crrev.com/305f1c8ee5098de261faa2735934846f7f55741d/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 28 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/9a1d425717ba5095db2518c0e45ecf7a1e916b1c

commit 9a1d425717ba5095db2518c0e45ecf7a1e916b1c
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:49 2018

UPSTREAM: media: videobuf2-v4l2: integrate with media requests

This implements the V4L2 part of the request support. The main
change is that vb2_qbuf and vb2_prepare_buf now have a new
media_device pointer. This required changes to several drivers
that did not use the vb2_ioctl_qbuf/prepare_buf helper functions.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 394dc588809158826e2877adb670391829f91c63)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I88f7aaa9ecc3a0e17e529cfe9da11de2e36fd6d3
Reviewed-on: https://chromium-review.googlesource.com/c/1325775
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/platform/omap3isp/ispvideo.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/usb/uvc/uvc_queue.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/platform/s3c-camif/camif-capture.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/v4l2-core/v4l2-mem2mem.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/usb/gadget/function/uvc_queue.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/platform/soc_camera/soc_camera.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/include/media/videobuf2-v4l2.h
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/staging/media/davinci_vpfe/vpfe_video.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/usb/uvc/uvcvideo.h
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/usb/uvc/uvc_v4l2.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/staging/media/omap4iss/iss_video.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/common/videobuf2/videobuf2-core.c
[modify] https://crrev.com/9a1d425717ba5095db2518c0e45ecf7a1e916b1c/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 29 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/6731c9859fe2d8c9170861856dd9baeb492e718a

commit 6731c9859fe2d8c9170861856dd9baeb492e718a
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:51 2018

UPSTREAM: media: videobuf2-core: add request helper functions

Add a new helper function to tell if a request object is a buffer.

Add a new helper function that returns true if a media_request
contains at least one buffer.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit c07aa48ec57eca649e987e8f19a336d4373b8da6)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I56ef0130695bcf4fd4a92a5ae2d9a80bcc0dbc9e
Reviewed-on: https://chromium-review.googlesource.com/c/1325776
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/6731c9859fe2d8c9170861856dd9baeb492e718a/include/media/videobuf2-core.h
[modify] https://crrev.com/6731c9859fe2d8c9170861856dd9baeb492e718a/drivers/media/common/videobuf2/videobuf2-core.c

Project Member

Comment 30 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/3ee139541cc35961fd7876a66407a8dfd3548fb4

commit 3ee139541cc35961fd7876a66407a8dfd3548fb4
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:53 2018

UPSTREAM: media: videobuf2-v4l2: add vb2_request_queue/validate helpers

The generic vb2_request_validate helper function checks if
there are buffers in the request and if so, prepares (validates)
all objects in the request.

The generic vb2_request_queue helper function queues all buffer
objects in the validated request.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 86f6bd3cf1222c62bcccd76daf1c831f22e595bf)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I6bba4e01142d58238a3203c6a2a137d65b2a99dd
Reviewed-on: https://chromium-review.googlesource.com/c/1325777
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/3ee139541cc35961fd7876a66407a8dfd3548fb4/include/media/videobuf2-v4l2.h
[modify] https://crrev.com/3ee139541cc35961fd7876a66407a8dfd3548fb4/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 31 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/6e2e3a14a2603194617397ddcfdf9129ddf86093

commit 6e2e3a14a2603194617397ddcfdf9129ddf86093
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:55 2018

UPSTREAM: media: videobuf2-core: add uses_requests/qbuf flags

Set the first time a buffer from a request is queued to vb2
(uses_requests) or directly queued (uses_qbuf).
Cleared when the queue is canceled.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 61add367dda6309ee1702d85344b5fcbd6ede9a1)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ia109073262e5b60c2491edd8edadb0fa9b289751
Reviewed-on: https://chromium-review.googlesource.com/c/1325778
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/6e2e3a14a2603194617397ddcfdf9129ddf86093/include/media/videobuf2-core.h
[modify] https://crrev.com/6e2e3a14a2603194617397ddcfdf9129ddf86093/drivers/media/common/videobuf2/videobuf2-core.c

Project Member

Comment 32 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/68bb281e1cec7072aa76b5dfd6b800d1c2aec895

commit 68bb281e1cec7072aa76b5dfd6b800d1c2aec895
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:57 2018

UPSTREAM: media: videobuf2-v4l2: refuse qbuf if queue uses requests or vv.

Check if the vb2 queue uses requests, and if so refuse to
add buffers that are not part of a request. Also check for
the reverse: a vb2 queue did not use requests, and an attempt
was made to queue a buffer to a request.

We might relax this in the future, but for now just return
-EPERM in that case.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 9ac8090fda77f072815c209c80fb230e89cda18c)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I782ddb38197e515e5dfffd26254ec9d317424e94
Reviewed-on: https://chromium-review.googlesource.com/c/1325779
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/68bb281e1cec7072aa76b5dfd6b800d1c2aec895/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 33 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/f39dfb6bf653e00399c147c860b9b142b014dd70

commit f39dfb6bf653e00399c147c860b9b142b014dd70
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:55:59 2018

UPSTREAM: media: v4l2-mem2mem: add vb2_m2m_request_queue

For mem2mem devices we have to make sure that v4l2_m2m_try_schedule()
is called whenever a request is queued.

We do that by creating a vb2_m2m_request_queue() helper that should
be used instead of the 'normal' vb2_request_queue() helper. The m2m
helper function will call v4l2_m2m_try_schedule() as needed.

In addition we also avoid calling v4l2_m2m_try_schedule() when preparing
or queueing a buffer for a request since that is no longer needed.
Instead this helper function will do that when the request is actually
queued.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 803a7ab758252599ddadf5fe9326acee7340d9b6)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ic3f0472711ec5939c871e60a7a699728cee4bf0c
Reviewed-on: https://chromium-review.googlesource.com/c/1325780
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/f39dfb6bf653e00399c147c860b9b142b014dd70/drivers/media/v4l2-core/v4l2-mem2mem.c
[modify] https://crrev.com/f39dfb6bf653e00399c147c860b9b142b014dd70/include/media/v4l2-mem2mem.h

Project Member

Comment 34 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e53e1cfdcbe1a4c857f8f5159376243f40ae391a

commit e53e1cfdcbe1a4c857f8f5159376243f40ae391a
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:56:02 2018

UPSTREAM: media: vim2m: use workqueue

v4l2_ctrl uses mutexes, so we can't setup a ctrl_handler in
interrupt context. Switch to a workqueue instead and drop the timer.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 144bd0ee304c7d0690eec285aee93019d3f30fc8)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I694910ff20feac5a331618161b3d97d12bdad11b
Reviewed-on: https://chromium-review.googlesource.com/c/1325781
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/e53e1cfdcbe1a4c857f8f5159376243f40ae391a/drivers/media/platform/vim2m.c

Project Member

Comment 35 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e37ca766863eddd8b0b0771e68bac648bd8b96a2

commit e37ca766863eddd8b0b0771e68bac648bd8b96a2
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:56:05 2018

UPSTREAM: media: vim2m: support requests

Add support for requests to vim2m.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 86b93b2c95f15d6b0c753b17de43db0e7e588f2d)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ied32e13257062258846e244462e7180241047f4f
Reviewed-on: https://chromium-review.googlesource.com/c/1325782
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/e37ca766863eddd8b0b0771e68bac648bd8b96a2/drivers/media/platform/vim2m.c

Project Member

Comment 36 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/6317ee9a8cb7299f235dc8592c05b242fa6fade5

commit 6317ee9a8cb7299f235dc8592c05b242fa6fade5
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:56:07 2018

UPSTREAM: media: vivid: add mc

Add support for the media_device to vivid. This is a prerequisite
for request support.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 945b07b1630fd15e556137e31e9c38d01db0fb0c)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Idb540f8847b9f6532e44740ae346119718b307f1
Reviewed-on: https://chromium-review.googlesource.com/c/1325783
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/6317ee9a8cb7299f235dc8592c05b242fa6fade5/drivers/media/platform/vivid/vivid-core.h
[modify] https://crrev.com/6317ee9a8cb7299f235dc8592c05b242fa6fade5/drivers/media/platform/vivid/vivid-core.c

Project Member

Comment 37 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a0d217dfb7c9ebc2ced5880506ac06c145811e7e

commit a0d217dfb7c9ebc2ced5880506ac06c145811e7e
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:56:09 2018

UPSTREAM: media: vivid: add request support

Add support for requests to vivid.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 757fdb51c14fda221ccb6999a865f7f895c79750)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I3bf1b900d6d73b9e853eeb5e2ed110b708a5daaa
Reviewed-on: https://chromium-review.googlesource.com/c/1325784
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/a0d217dfb7c9ebc2ced5880506ac06c145811e7e/drivers/media/platform/vivid/vivid-sdr-cap.c
[modify] https://crrev.com/a0d217dfb7c9ebc2ced5880506ac06c145811e7e/drivers/media/platform/vivid/vivid-vid-out.c
[modify] https://crrev.com/a0d217dfb7c9ebc2ced5880506ac06c145811e7e/drivers/media/platform/vivid/vivid-vbi-out.c
[modify] https://crrev.com/a0d217dfb7c9ebc2ced5880506ac06c145811e7e/drivers/media/platform/vivid/vivid-kthread-cap.c
[modify] https://crrev.com/a0d217dfb7c9ebc2ced5880506ac06c145811e7e/drivers/media/platform/vivid/vivid-vid-cap.c
[modify] https://crrev.com/a0d217dfb7c9ebc2ced5880506ac06c145811e7e/drivers/media/platform/vivid/vivid-kthread-out.c
[modify] https://crrev.com/a0d217dfb7c9ebc2ced5880506ac06c145811e7e/drivers/media/platform/vivid/vivid-vbi-cap.c
[modify] https://crrev.com/a0d217dfb7c9ebc2ced5880506ac06c145811e7e/drivers/media/platform/vivid/vivid-core.c

Project Member

Comment 38 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/505e6346f0346c56359c6c0e8c2ebe581a39aa10

commit 505e6346f0346c56359c6c0e8c2ebe581a39aa10
Author: Hans Verkuil <hansverk@cisco.com>
Date: Fri Nov 09 03:56:11 2018

UPSTREAM: media: media-request: return -EINVAL for invalid request_fds

Instead of returning -ENOENT when a request_fd was not found (VIDIOC_QBUF
and VIDIOC_G/S/TRY_EXT_CTRLS), we now return -EINVAL. This is in line
with what we do when invalid dmabuf fds are passed to e.g. VIDIOC_QBUF.

Also document that EINVAL is returned for invalid m.fd values, we never
documented that.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 34b41472465b1b5a2c6c63255431fb2c1a450af1)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ie6b3ee6492021af9e9f2d8b6cf7e7809f98f305e
Reviewed-on: https://chromium-review.googlesource.com/c/1325785
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/505e6346f0346c56359c6c0e8c2ebe581a39aa10/drivers/media/media-request.c
[modify] https://crrev.com/505e6346f0346c56359c6c0e8c2ebe581a39aa10/Documentation/media/uapi/v4l/vidioc-qbuf.rst
[modify] https://crrev.com/505e6346f0346c56359c6c0e8c2ebe581a39aa10/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst
[modify] https://crrev.com/505e6346f0346c56359c6c0e8c2ebe581a39aa10/Documentation/media/uapi/v4l/buffer.rst
[modify] https://crrev.com/505e6346f0346c56359c6c0e8c2ebe581a39aa10/include/media/media-request.h

Project Member

Comment 39 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a0b296b9db1b00bd81548ec3df68eed1e9c1c6af

commit a0b296b9db1b00bd81548ec3df68eed1e9c1c6af
Author: Hans Verkuil <hansverk@cisco.com>
Date: Fri Nov 09 03:56:13 2018

UPSTREAM: media: v4l2-ctrls: return -EACCES if request wasn't completed

For now (this might be relaxed in the future) we do not allow getting
controls from a request that isn't completed. In that case we return
-EACCES. Update the documentation accordingly.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit b6b84557eca71ae0631be1567fec85870a2c1b93)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ieb152394cfd505d3447f805b130118dd74ae3cf8
Reviewed-on: https://chromium-review.googlesource.com/c/1325786
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/a0b296b9db1b00bd81548ec3df68eed1e9c1c6af/drivers/media/v4l2-core/v4l2-ctrls.c
[modify] https://crrev.com/a0b296b9db1b00bd81548ec3df68eed1e9c1c6af/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst

Project Member

Comment 40 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/cf67fbaf1ea5af696fbcb89aac35bd722fa9ea30

commit cf67fbaf1ea5af696fbcb89aac35bd722fa9ea30
Author: Hans Verkuil <hansverk@cisco.com>
Date: Fri Nov 09 03:56:16 2018

UPSTREAM: media: buffer.rst: only set V4L2_BUF_FLAG_REQUEST_FD for QBUF

Document that V4L2_BUF_FLAG_REQUEST_FD should only be used with
VIDIOC_QBUF and cleared otherwise.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit dc58a553ba8c4edd26c4f585bbbc16ab2f0ec35f)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I7b9d31d74a7ab449b7b6c87a143de627b4a36833
Reviewed-on: https://chromium-review.googlesource.com/c/1325787
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/cf67fbaf1ea5af696fbcb89aac35bd722fa9ea30/Documentation/media/uapi/v4l/buffer.rst

Project Member

Comment 41 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/d7b1d7b469416fe3fae3447f84cab9cf81677085

commit d7b1d7b469416fe3fae3447f84cab9cf81677085
Author: Hans Verkuil <hansverk@cisco.com>
Date: Fri Nov 09 03:56:18 2018

UPSTREAM: media: videodev2.h: add new capabilities for buffer types

VIDIOC_REQBUFS and VIDIOC_CREATE_BUFFERS will return capabilities
telling userspace what the given buffer type is capable of.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit f35f5d72e70e6b91389eb98fcabf43b79f40587f)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I6e872e58b3b03f8f9d233dc0f97d712682e81940
Reviewed-on: https://chromium-review.googlesource.com/c/1325788
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/d7b1d7b469416fe3fae3447f84cab9cf81677085/Documentation/media/uapi/v4l/vidioc-create-bufs.rst
[modify] https://crrev.com/d7b1d7b469416fe3fae3447f84cab9cf81677085/include/uapi/linux/videodev2.h
[modify] https://crrev.com/d7b1d7b469416fe3fae3447f84cab9cf81677085/Documentation/media/uapi/v4l/vidioc-reqbufs.rst

Project Member

Comment 42 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2e698b1423046c45286d56d0c4339bcfa856f35f

commit 2e698b1423046c45286d56d0c4339bcfa856f35f
Author: Hans Verkuil <hansverk@cisco.com>
Date: Fri Nov 09 03:56:20 2018

UPSTREAM: media: vb2: set reqbufs/create_bufs capabilities

Set the capabilities field of v4l2_requestbuffers and v4l2_create_buffers.

The various mapping modes were easy, but for signaling the request capability
a new 'supports_requests' bitfield was added to videobuf2-core.h (and set in
vim2m and vivid). Drivers have to set this bitfield for any queue where
requests are supported.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit e5079cf11373e4cc98be8b1072aece429eb2d4d2)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ib2973ab7ff35909572ba2629d7c01c4f44a2df16
Reviewed-on: https://chromium-review.googlesource.com/c/1325789
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/2e698b1423046c45286d56d0c4339bcfa856f35f/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
[modify] https://crrev.com/2e698b1423046c45286d56d0c4339bcfa856f35f/drivers/media/v4l2-core/v4l2-ioctl.c
[modify] https://crrev.com/2e698b1423046c45286d56d0c4339bcfa856f35f/include/media/videobuf2-core.h
[modify] https://crrev.com/2e698b1423046c45286d56d0c4339bcfa856f35f/drivers/media/platform/vim2m.c
[modify] https://crrev.com/2e698b1423046c45286d56d0c4339bcfa856f35f/drivers/media/platform/vivid/vivid-core.c
[modify] https://crrev.com/2e698b1423046c45286d56d0c4339bcfa856f35f/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 43 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/f4cb3525e424b790e85be17bb0c48f80d73c4ed4

commit f4cb3525e424b790e85be17bb0c48f80d73c4ed4
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:56:22 2018

UPSTREAM: media: media-request: add media_request_(un)lock_for_access

Add helper functions to prevent a completed request from being
re-inited while it is being accessed.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 6736f4e948817ca8385bdc6feb5475cdf1eb1ec8)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I90657a0b5a3bbfc668a0988a2347d83437c12a9c
Reviewed-on: https://chromium-review.googlesource.com/c/1325790
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/f4cb3525e424b790e85be17bb0c48f80d73c4ed4/drivers/media/media-request.c
[modify] https://crrev.com/f4cb3525e424b790e85be17bb0c48f80d73c4ed4/include/media/media-request.h

Project Member

Comment 44 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2cc61c06d60c0e9f705b319068c40c5decc81cf3

commit 2cc61c06d60c0e9f705b319068c40c5decc81cf3
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:56:24 2018

UPSTREAM: media: v4l2-ctrls: use media_request_(un)lock_for_access

When getting control values from a completed request, we have
to protect the request against being re-inited when it is
being accessed by calling media_request_(un)lock_for_access.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit ca6c163399a9f1913efdbeab654a185b3cde03c4)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ib06bbfdce79cf2da22d8a461f294295777f085a0
Reviewed-on: https://chromium-review.googlesource.com/c/1325791
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/2cc61c06d60c0e9f705b319068c40c5decc81cf3/drivers/media/v4l2-core/v4l2-ctrls.c

Project Member

Comment 45 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/964d10ae8c8981f9dc9b01020014d8f4a33f5089

commit 964d10ae8c8981f9dc9b01020014d8f4a33f5089
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:56:26 2018

UPSTREAM: media: v4l2-ctrls: improve media_request_(un)lock_for_update

The request reference count was decreased again once a reference to the
request object was taken. Postpone this until we finished using the object.

In theory I think it is possible that the request_fd can be closed by
the application from another thread. In that case when request_put is
called the whole request would be freed.

It's highly unlikely, but let's just be safe and fix this potential
race condition.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit ffda0b4c2481b2a0faf634abccb1da0d0ba4eddb)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I03bb642fd844d225c4627768072c4110b768bdb8
Reviewed-on: https://chromium-review.googlesource.com/c/1325792
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/964d10ae8c8981f9dc9b01020014d8f4a33f5089/drivers/media/v4l2-core/v4l2-ctrls.c

Project Member

Comment 46 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/d0d9365e2e55175a102d0e6ee4f236a79678deaa

commit d0d9365e2e55175a102d0e6ee4f236a79678deaa
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:56:28 2018

UPSTREAM: media: media-request: EPERM -> EACCES/EBUSY

If requests are not supported by the driver, then return EACCES, not
EPERM.

If you attempt to mix queueing buffers directly and using requests,
then EBUSY is returned instead of EPERM: once a specific queueing mode
has been chosen the queue is 'busy' if you attempt the other mode
(i.e. direct queueing vs via a request).

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 15cd442e79e2a60a725ee5501e4ffb537698c802)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I95cfac1df2e3e6725e34f6dd19be4867b038538e
Reviewed-on: https://chromium-review.googlesource.com/c/1325793
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/d0d9365e2e55175a102d0e6ee4f236a79678deaa/Documentation/media/uapi/v4l/vidioc-qbuf.rst
[modify] https://crrev.com/d0d9365e2e55175a102d0e6ee4f236a79678deaa/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst
[modify] https://crrev.com/d0d9365e2e55175a102d0e6ee4f236a79678deaa/Documentation/media/uapi/v4l/buffer.rst
[modify] https://crrev.com/d0d9365e2e55175a102d0e6ee4f236a79678deaa/Documentation/media/uapi/mediactl/media-request-ioc-queue.rst
[modify] https://crrev.com/d0d9365e2e55175a102d0e6ee4f236a79678deaa/drivers/media/media-request.c
[modify] https://crrev.com/d0d9365e2e55175a102d0e6ee4f236a79678deaa/Documentation/media/uapi/mediactl/request-api.rst
[modify] https://crrev.com/d0d9365e2e55175a102d0e6ee4f236a79678deaa/include/media/media-request.h
[modify] https://crrev.com/d0d9365e2e55175a102d0e6ee4f236a79678deaa/drivers/media/common/videobuf2/videobuf2-core.c
[modify] https://crrev.com/d0d9365e2e55175a102d0e6ee4f236a79678deaa/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 47 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/45a161cff398f28ddebbcd3e6c2c549c1abea0a5

commit 45a161cff398f28ddebbcd3e6c2c549c1abea0a5
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date: Fri Nov 09 03:56:30 2018

UPSTREAM: media: media-request: update documentation

Various clarifications and readability improvements based on
Laurent Pinchart's review of the documentation.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit d4215edbd4b170b207b0e5a1d8ae42fb49f5c470)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I32c4681de9712dac850a6201cbb394254666074a
Reviewed-on: https://chromium-review.googlesource.com/c/1325794
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/45a161cff398f28ddebbcd3e6c2c549c1abea0a5/Documentation/media/uapi/mediactl/request-func-poll.rst
[modify] https://crrev.com/45a161cff398f28ddebbcd3e6c2c549c1abea0a5/Documentation/media/uapi/v4l/vidioc-qbuf.rst
[modify] https://crrev.com/45a161cff398f28ddebbcd3e6c2c549c1abea0a5/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst
[modify] https://crrev.com/45a161cff398f28ddebbcd3e6c2c549c1abea0a5/Documentation/media/uapi/v4l/buffer.rst
[modify] https://crrev.com/45a161cff398f28ddebbcd3e6c2c549c1abea0a5/Documentation/media/uapi/mediactl/media-ioc-request-alloc.rst
[modify] https://crrev.com/45a161cff398f28ddebbcd3e6c2c549c1abea0a5/Documentation/media/uapi/mediactl/request-func-close.rst
[modify] https://crrev.com/45a161cff398f28ddebbcd3e6c2c549c1abea0a5/Documentation/media/uapi/mediactl/media-request-ioc-queue.rst
[modify] https://crrev.com/45a161cff398f28ddebbcd3e6c2c549c1abea0a5/Documentation/media/uapi/mediactl/request-api.rst

Project Member

Comment 48 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/1095e73621ce9ca5e680f2530856fc7815cbb7a8

commit 1095e73621ce9ca5e680f2530856fc7815cbb7a8
Author: Hans Verkuil <hverkuil@xs4all.nl>
Date: Fri Nov 09 03:56:33 2018

UPSTREAM: media: v4l2-compat-ioctl32.c: add missing documentation for a field

Fix this sparse warning:

drivers/media/v4l2-core/v4l2-compat-ioctl32.c:256: warning:
Function parameter or member 'capabilities' not described in 'v4l2_create_buffers32'

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 9e39b43612e5cc496b02784a8560ded1ebb9e3af)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I00163ebe6b41871204ae4a8dbff421a002de37fb
Reviewed-on: https://chromium-review.googlesource.com/c/1325795
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/1095e73621ce9ca5e680f2530856fc7815cbb7a8/drivers/media/v4l2-core/v4l2-compat-ioctl32.c

Project Member

Comment 49 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/1e4f02d259e551af91d2d06119e88d8dbc9155c2

commit 1e4f02d259e551af91d2d06119e88d8dbc9155c2
Author: Hans Verkuil <hverkuil@xs4all.nl>
Date: Fri Nov 09 03:56:34 2018

UPSTREAM: media: v4l2-ctrls.c: initialize an error return code with zero

Fix this smatch error:

drivers/media/v4l2-core/v4l2-ctrls.c:2971 v4l2_ctrl_request_clone() error: uninitialized symbol 'err'.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 7390ba4397c1ed069de3b7f88c3f3821d648a582)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I1ada996b521c9b81c10433ebd53e40ab396713f3
Reviewed-on: https://chromium-review.googlesource.com/c/1325796
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/1e4f02d259e551af91d2d06119e88d8dbc9155c2/drivers/media/v4l2-core/v4l2-ctrls.c

Project Member

Comment 50 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/c0a9ad85a9ebf5a61df41a2baeb6d44a7c18ee2c

commit c0a9ad85a9ebf5a61df41a2baeb6d44a7c18ee2c
Author: Paul Kocialkowski <contact@paulk.fr>
Date: Fri Nov 09 03:56:36 2018

UPSTREAM: media: videobuf2-core: Rework and rename helper for request buffer count

The helper indicating whether buffers are associated with the request is
reworked and renamed to return the number of associated buffer objects.

This is useful for drivers that need to check how many buffers are in
the request to validate it.

Existing users of the helper don't need particular adaptation since the
meaning of zero/non-zero remains consistent.

BUG= chromium:902656 
TEST=Checked that Cheza was working with request API enabled.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 515c5a7333be87a7d01ab267d94626a454a7e794)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I72a2fdeb6dfaadc745edd12fc0427d5ef194d3f3
Reviewed-on: https://chromium-review.googlesource.com/c/1325797
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/c0a9ad85a9ebf5a61df41a2baeb6d44a7c18ee2c/include/media/videobuf2-core.h
[modify] https://crrev.com/c0a9ad85a9ebf5a61df41a2baeb6d44a7c18ee2c/drivers/media/common/videobuf2/videobuf2-core.c
[modify] https://crrev.com/c0a9ad85a9ebf5a61df41a2baeb6d44a7c18ee2c/drivers/media/common/videobuf2/videobuf2-v4l2.c

Status: Verified (was: Started)
Support has been merged - closing.
Issue 713476 has been merged into this issue.
Project Member

Comment 53 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2293498e8b66e66ab6881a799caad67be001f2fd

commit 2293498e8b66e66ab6881a799caad67be001f2fd
Author: Ezequiel Garcia <ezequiel@collabora.com>
Date: Tue Jan 22 08:30:34 2019

UPSTREAM: media: Rename vb2_m2m_request_queue -> v4l2_m2m_request_queue

To be consistent with the rest of the mem2mem helpers,
rename vb2_m2m_request_queue to v4l2_m2m_request_queue.

This is just a cosmetic change.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit ef86eaf97acd6d82cd3fd40f997b1c8c4895a443)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: If35878ea93dfaf9fcde98cfa2b1af1a351b71d7e
Reviewed-on: https://chromium-review.googlesource.com/1420537
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/2293498e8b66e66ab6881a799caad67be001f2fd/include/media/v4l2-mem2mem.h
[modify] https://crrev.com/2293498e8b66e66ab6881a799caad67be001f2fd/drivers/media/v4l2-core/v4l2-mem2mem.c
[modify] https://crrev.com/2293498e8b66e66ab6881a799caad67be001f2fd/drivers/media/platform/vim2m.c

Project Member

Comment 54 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/174d47bf3b4aa9659a1916840691f4364b7395ae

commit 174d47bf3b4aa9659a1916840691f4364b7395ae
Author: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Tue Jan 22 08:30:35 2019

UPSTREAM: media: media-request: Add compat ioctl

Currently media request ioctl operations fail on 64-bit kernel with
32-bit userspace due to missing .compat_ioctl callback.

Because no ioctl command uses any argument, just reuse existing ioctl
handler for compat_ioctl too.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit f44e361e37eb074df2e2ca204ef31c834ce44af8)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I5b4aac606411b811ba5cfbd503bafe68f2c35333
Reviewed-on: https://chromium-review.googlesource.com/1420538
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/174d47bf3b4aa9659a1916840691f4364b7395ae/drivers/media/media-request.c

Project Member

Comment 55 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/1d59b9588242e8b794ad92270043504d6c3c66c5

commit 1d59b9588242e8b794ad92270043504d6c3c66c5
Author: Ezequiel Garcia <ezequiel@collabora.com>
Date: Tue Jan 22 08:30:37 2019

UPSTREAM: media: v4l2-mem2mem: Avoid calling .device_run in v4l2_m2m_job_finish

v4l2_m2m_job_finish() is typically called when
DMA operations complete, in interrupt handlers or DMA
completion callbacks. Calling .device_run from v4l2_m2m_job_finish
creates a nasty re-entrancy path into the driver.

Moreover, some implementation of .device_run might need to sleep,
as is the case for drivers supporting the Request API,
where controls are applied via v4l2_ctrl_request_setup,
which takes the ctrl handler mutex.

This commit adds a deferred context that calls v4l2_m2m_try_run,
and gets scheduled by v4l2_m2m_job_finish().

Before this change, device_run would be called from these
paths:

vb2_m2m_request_queue, or
v4l2_m2m_streamon, or
v4l2_m2m_qbuf
  v4l2_m2m_try_schedule
    v4l2_m2m_try_run
      .device_run

v4l2_m2m_job_finish
  v4l2_m2m_try_run
    .device_run

After this change, the latter is now gone and instead:

v4l2_m2m_device_run_work
  v4l2_m2m_try_run
    .device_run

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit cbd9463da1b12cdf9aa79e7cf470431d39131fca)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I5451df51348e8e7b02c6e102d2573a393a6a2723
Reviewed-on: https://chromium-review.googlesource.com/1420539
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/1d59b9588242e8b794ad92270043504d6c3c66c5/drivers/media/v4l2-core/v4l2-mem2mem.c

Project Member

Comment 56 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/999af66a7291387bc7e34e2286446e9abb732705

commit 999af66a7291387bc7e34e2286446e9abb732705
Author: Hans Verkuil <hansverk@cisco.com>
Date: Tue Jan 22 08:30:38 2019

UPSTREAM: media: vb2: skip request checks for VIDIOC_PREPARE_BUF

VIDIOC_PREPARE_BUF should ignore V4L2_BUF_FLAG_REQUEST_FD since it isn't
doing anything with requests. So inform vb2_queue_or_prepare_buf whether
it is called from vb2_prepare_buf or vb2_qbuf and just return 0 in the
first case.

This was found when adding new v4l2-compliance checks.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit b7ff0b099089f3d4bfd4e30f581ee9d9dc4f8840)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I913f9c97d4ee0f1e3ff0b54a806a2bc321493205
Reviewed-on: https://chromium-review.googlesource.com/1420540
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/999af66a7291387bc7e34e2286446e9abb732705/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 57 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/c9cf1daa8a5c560096cb6726ce91927f9fffb912

commit c9cf1daa8a5c560096cb6726ce91927f9fffb912
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Tue Jan 22 08:30:39 2019

UPSTREAM: media: vb2: keep a reference to the request until dqbuf

When vb2_buffer_done is called the buffer is unbound from the
request and put. The media_request_object_put also 'put's the
request reference. If the application has already closed the
request fd, then that means that the request reference at that
point goes to 0 and the whole request is released.

This means that the control handler associated with the request is
also freed and that causes this kernel oops:

[174705.995401] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:908
[174705.995411] in_atomic(): 1, irqs_disabled(): 1, pid: 28071, name: vivid-000-vid-o
[174705.995416] 2 locks held by vivid-000-vid-o/28071:
[174705.995420]  #0: 000000001ea3a232 (&dev->mutex#3){....}, at: vivid_thread_vid_out+0x3f5/0x550 [vivid]
[174705.995447]  #1: 00000000e30a0d1e (&(&q->done_lock)->rlock){....}, at: vb2_buffer_done+0x92/0x1d0 [videobuf2_common]
[174705.995460] Preemption disabled at:
[174705.995461] [<0000000000000000>]           (null)
[174705.995472] CPU: 11 PID: 28071 Comm: vivid-000-vid-o Tainted: G        W         4.20.0-rc1-test-no #88
[174705.995476] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/19/2017
[174705.995481] Call Trace:
[174705.995500]  dump_stack+0x46/0x60
[174705.995512]  ___might_sleep.cold.79+0xe1/0xf1
[174705.995523]  __mutex_lock+0x50/0x8f0
[174705.995531]  ? find_held_lock+0x2d/0x90
[174705.995536]  ? find_held_lock+0x2d/0x90
[174705.995542]  ? find_held_lock+0x2d/0x90
[174705.995564]  ? v4l2_ctrl_handler_free.part.13+0x44/0x1d0 [videodev]
[174705.995576]  v4l2_ctrl_handler_free.part.13+0x44/0x1d0 [videodev]
[174705.995590]  v4l2_ctrl_request_release+0x1c/0x30 [videodev]
[174705.995600]  media_request_clean+0x64/0xe0 [media]
[174705.995609]  media_request_release+0x19/0x40 [media]
[174705.995617]  vb2_buffer_done+0xef/0x1d0 [videobuf2_common]
[174705.995630]  vivid_thread_vid_out+0x2c1/0x550 [vivid]
[174705.995645]  ? vivid_stop_generating_vid_cap+0x1c0/0x1c0 [vivid]
[174705.995653]  kthread+0x113/0x130
[174705.995659]  ? kthread_park+0x80/0x80
[174705.995667]  ret_from_fork+0x35/0x40

The vb2_buffer_done function can be called from interrupt context, so
anything that sleeps is not allowed.

The solution is to increment the request refcount when the buffer is
queued and decrement it when the buffer is dequeued. Releasing the
request is fine if that happens from VIDIOC_DQBUF.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 6093d3002eabd7c2913d97f1d1f4ce34b072acf9)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ifd92dfdde0ca26198e3bb1fedfd13edfe758adb4
Reviewed-on: https://chromium-review.googlesource.com/1420541
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/c9cf1daa8a5c560096cb6726ce91927f9fffb912/include/media/videobuf2-core.h
[modify] https://crrev.com/c9cf1daa8a5c560096cb6726ce91927f9fffb912/drivers/media/common/videobuf2/videobuf2-core.c

Project Member

Comment 58 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2d2423699ba19c1a91e65e3a23fca98a731935f2

commit 2d2423699ba19c1a91e65e3a23fca98a731935f2
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Tue Jan 22 08:30:41 2019

UPSTREAM: media: vb2: don't unbind/put the object when going to state QUEUED

When a buffer is returned to state QUEUED (that happens when
start_streaming fails), then do not unbind and put the object
from the request. Nothing has changed yet, so just keep it as
is.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit dde6bdcc975983c219ffe9b8f3a2942df0b7937d)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I849e1e94778ac01ce63117525bfd3b2fc41716fa
Reviewed-on: https://chromium-review.googlesource.com/1420542
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/2d2423699ba19c1a91e65e3a23fca98a731935f2/drivers/media/common/videobuf2/videobuf2-core.c

Project Member

Comment 59 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/df5273df36b91ee2d0877c392aa53d845fcbc5c7

commit df5273df36b91ee2d0877c392aa53d845fcbc5c7
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Tue Jan 22 08:30:42 2019

UPSTREAM: media: vivid: drop v4l2_ctrl_request_complete() from start_streaming

If start_streaming() fails and all queued buffers are returned to
vb2, then do not call v4l2_ctrl_request_complete(). Nothing happened
to the request and the state should remain as it was before
start_streaming was called.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit e714c92f42aeed6052a287b8ccf5a519e42bab15)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I32e80bd2ee396bdbc855b887ea98811fe9331a3a
Reviewed-on: https://chromium-review.googlesource.com/1420543
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/df5273df36b91ee2d0877c392aa53d845fcbc5c7/drivers/media/platform/vivid/vivid-sdr-cap.c
[modify] https://crrev.com/df5273df36b91ee2d0877c392aa53d845fcbc5c7/drivers/media/platform/vivid/vivid-vid-out.c
[modify] https://crrev.com/df5273df36b91ee2d0877c392aa53d845fcbc5c7/drivers/media/platform/vivid/vivid-vid-cap.c
[modify] https://crrev.com/df5273df36b91ee2d0877c392aa53d845fcbc5c7/drivers/media/platform/vivid/vivid-vbi-cap.c
[modify] https://crrev.com/df5273df36b91ee2d0877c392aa53d845fcbc5c7/drivers/media/platform/vivid/vivid-vbi-out.c

Project Member

Comment 60 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/d394cfa4c6ba8188d68ba0d03d27b43ac1960f62

commit d394cfa4c6ba8188d68ba0d03d27b43ac1960f62
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
Date: Tue Jan 22 08:30:43 2019

UPSTREAM: media: Add a Kconfig option for the Request API

The Request API is now merged to the kernel but the confidence on the
stability of that API is not great, especially regarding the interaction
with V4L2.

Add a Kconfig option for the API, with a scary-looking warning.

The patch itself disables request creation as well as does not advertise
them as buffer flags. The driver requiring requests (cedrus) now depends
on the Kconfig option as well.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 078ab3ea2c3bb69cb989d52346fefa1246055e5b)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I2bbad1013bab9122b136c753f224cfa9607b5e50
Reviewed-on: https://chromium-review.googlesource.com/1420544
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/d394cfa4c6ba8188d68ba0d03d27b43ac1960f62/drivers/media/media-device.c
[modify] https://crrev.com/d394cfa4c6ba8188d68ba0d03d27b43ac1960f62/drivers/media/Kconfig
[modify] https://crrev.com/d394cfa4c6ba8188d68ba0d03d27b43ac1960f62/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 61 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/79b50fa2147a255dd5385ad4b0e0c39783f0da66

commit 79b50fa2147a255dd5385ad4b0e0c39783f0da66
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Tue Jan 22 08:30:44 2019

FROMGIT: media: v4l2-mem2mem: add v4l2_m2m_buf_copy_data helper function

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.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit e2d8ffe2e76028457759988ba6216fd13eeea01b
 git://linuxtv.org/media_tree.git master)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I30dc2932c01477ec57cd1b30b010960a9f7697d7
Reviewed-on: https://chromium-review.googlesource.com/1420545
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/79b50fa2147a255dd5385ad4b0e0c39783f0da66/drivers/media/v4l2-core/v4l2-mem2mem.c
[modify] https://crrev.com/79b50fa2147a255dd5385ad4b0e0c39783f0da66/include/media/v4l2-mem2mem.h

Project Member

Comment 62 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/42d02cfd9d7794e8b926d008c2b2fc2e46b9bdcc

commit 42d02cfd9d7794e8b926d008c2b2fc2e46b9bdcc
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Tue Jan 22 08:30:46 2019

FROMGIT: media: vim2m: use v4l2_m2m_buf_copy_data

Use the new v4l2_m2m_buf_copy_data() function in vim2m.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 7aca565ee3d0febeb980545a5ce72452b401ac90
 git://linuxtv.org/media_tree.git master)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ib89591e817202b63548997426a86f4980c642a11
Reviewed-on: https://chromium-review.googlesource.com/1420546
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/42d02cfd9d7794e8b926d008c2b2fc2e46b9bdcc/drivers/media/platform/vim2m.c

Project Member

Comment 63 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/4e74336b235b193520fb10d3c83e250dadd63afc

commit 4e74336b235b193520fb10d3c83e250dadd63afc
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Tue Jan 22 08:30:47 2019

FROMGIT: media: buffer.rst: clean up timecode documentation

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.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 0e9109ffded1cfa2aeb5617a9a683ca3467e6e99
 git://linuxtv.org/media_tree.git master)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Ic2c70f5137690f71eeb4d16579b3e894cafdc74b
Reviewed-on: https://chromium-review.googlesource.com/1420547
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/4e74336b235b193520fb10d3c83e250dadd63afc/Documentation/media/uapi/v4l/buffer.rst

Project Member

Comment 64 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/7529d6af6804caf5c18d3ee3c7f3076f497e0f78

commit 7529d6af6804caf5c18d3ee3c7f3076f497e0f78
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Tue Jan 22 08:30:48 2019

FROMGIT: media: videodev2.h: add v4l2_timeval_to_ns inline function

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 converts the struct timeval
into a u64 in the same way that the kernel does. This makes it possible
to use this u64 elsewhere as a unique identifier of the buffer.

Since timestamps are also copied from the output buffer to the
corresponding capture buffer(s) by M2M devices, the u64 can be
used to refer to both output and capture buffers.

The plan is that in the future we redesign struct v4l2_buffer and use
u64 for the timestamp instead of a struct timeval (which has lots of
problems with 32 vs 64 bit and y2038 layout changes), and then there
is no more need to use this function.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit c2eb8effb265ac5cdd960d8e61ecb931e9c767cd
 git://linuxtv.org/media_tree.git master)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: Id70d70f5cf5c8a13c18958d9aafc10da72a4e136
Reviewed-on: https://chromium-review.googlesource.com/1420548
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/7529d6af6804caf5c18d3ee3c7f3076f497e0f78/include/uapi/linux/videodev2.h

Project Member

Comment 65 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2eee00e948c1d9c459f121d1808248e78948092e

commit 2eee00e948c1d9c459f121d1808248e78948092e
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Tue Jan 22 08:30:49 2019

FROMGIT: media: vb2: add vb2_find_timestamp()

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 buffers, i.e.
buffers that are already processed.

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 245ede423b43a6e081e94e0e5d4e895bd1f31228
 git://linuxtv.org/media_tree.git master)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: If6b38898d8d136b7d19b44ce93b6f046262f37d3
Reviewed-on: https://chromium-review.googlesource.com/1420549
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/2eee00e948c1d9c459f121d1808248e78948092e/include/media/videobuf2-v4l2.h
[modify] https://crrev.com/2eee00e948c1d9c459f121d1808248e78948092e/drivers/media/common/videobuf2/videobuf2-v4l2.c

Project Member

Comment 66 by bugdroid1@chromium.org, Today (23 hours ago)

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/ae097d57077eeccd511c1a41a90dfd9af100e5b9

commit ae097d57077eeccd511c1a41a90dfd9af100e5b9
Author: Hans Verkuil <hverkuil@xs4all.nl>
Date: Tue Jan 22 08:30:51 2019

FROMGIT: media: vim2m: the v4l2_m2m_buf_copy_data args were swapped

The buffer arguments to v4l2_m2m_buf_copy_data args were swapped.

The reason is confusing naming conventions in vim2m. It certainly
could be improved.

Fixes: 7aca565ee3d0 ("media: vim2m: use v4l2_m2m_buf_copy_data")

BUG= chromium:902656 
TEST=Checked that kernel was building for Kukui.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit 86824694184642a4dc1be0c050df9854da5f51d3
 git://linuxtv.org/media_tree.git master)
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

Change-Id: I9e2d26beeb113a5f00fd7ef0e3755db6bbb6aa6e
Reviewed-on: https://chromium-review.googlesource.com/1420550
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>

[modify] https://crrev.com/ae097d57077eeccd511c1a41a90dfd9af100e5b9/drivers/media/platform/vim2m.c

Sign in to add a comment