media/gpu/v4l2: use actual number of planes in ioctls

The Tegra V4L2 library has a bug in its handling of VIDIOC_QUERYBUF that
makes it fail if the number of planes of the passed v4l2_buffer does not
exactly match the number of planes of the currently set format. This CL
implements a workaround by first running a VIDIOC_G_FMT ioctl in
AllocateBuffers(), and then passing the returned number of planes to the
buffer constructor so the correct value can be passed to
VIDIOC_QUERYBUF.

And since we have this value, we also use it in VIDIOC_DQBUF.

BUG=893661
TEST=Checked that VDA unittest was passing on hana (Tegra devices have
another bug that is fixed in the next CL).

Change-Id: I830334de1cf322302fd476ac5535313ebc65900d
Reviewed-on: https://chromium-review.googlesource.com/c/1275726
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#599116}(cherry picked from commit cec52397f2ea0fb8ac322378d229f1a454edf972)
Reviewed-on: https://chromium-review.googlesource.com/c/1308958
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/branch-heads/3578@{#431}
Cr-Branched-From: 4226ddf99103e493d7afb23a4c7902ee496108b6-refs/heads/master@{#599034}
2 files changed