]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: ti-vpe: vpe: Make sure YUYV is set as default format
authorBenoit Parrot <bparrot@ti.com>
Mon, 7 Oct 2019 15:09:58 +0000 (12:09 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 10 Oct 2019 16:48:37 +0000 (13:48 -0300)
v4l2-compliance fails with this message:

   fail: v4l2-test-formats.cpp(672): \
Video Capture Multiplanar: TRY_FMT(G_FMT) != G_FMT
   fail: v4l2-test-formats.cpp(672): \
Video Output Multiplanar: TRY_FMT(G_FMT) != G_FMT
...
   test VIDIOC_TRY_FMT: FAIL

The default pixel format was setup as pointing to a specific offset in
the vpe_formats table assuming it was pointing to the V4L2_PIX_FMT_YUYV
entry. This became false after the addition on the NV21 format (see
above commid-id)

So instead of hard-coding an offset which might change over time we need
to use a lookup helper instead so we know the default will always be what
we intended.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Fixes: 40cc823f7005 ("media: ti-vpe: Add support for NV21 format")
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/ti-vpe/vpe.c

index d3f1ae8b72fa1076f3fa162ca1c18d504e4837d2..7aa83026fb6c326c5faa0659d0e200197db4b75c 100644 (file)
@@ -2321,7 +2321,7 @@ static int vpe_open(struct file *file)
        v4l2_ctrl_handler_setup(hdl);
 
        s_q_data = &ctx->q_data[Q_DATA_SRC];
-       s_q_data->fmt = &vpe_formats[2];
+       s_q_data->fmt = __find_format(V4L2_PIX_FMT_YUYV);
        s_q_data->width = 1920;
        s_q_data->height = 1080;
        s_q_data->nplanes = 1;