From: Hans Verkuil <hans.verk...@cisco.com>

This resolves an issue raised by v4l2-compliance.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
---
 drivers/media/platform/mem2mem_testdev.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/mem2mem_testdev.c 
b/drivers/media/platform/mem2mem_testdev.c
index 35b2327..886d475 100644
--- a/drivers/media/platform/mem2mem_testdev.c
+++ b/drivers/media/platform/mem2mem_testdev.c
@@ -540,7 +540,11 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void 
*priv,
        struct m2mtest_ctx *ctx = file2ctx(file);
 
        fmt = find_format(f);
-       if (!fmt || !(fmt->types & MEM2MEM_CAPTURE)) {
+       if (!fmt) {
+               f->fmt.pix.pixelformat = formats[0].fourcc;
+               fmt = find_format(f);
+       }
+       if (!(fmt->types & MEM2MEM_CAPTURE)) {
                v4l2_err(&ctx->dev->v4l2_dev,
                         "Fourcc format (0x%08x) invalid.\n",
                         f->fmt.pix.pixelformat);
@@ -558,7 +562,11 @@ static int vidioc_try_fmt_vid_out(struct file *file, void 
*priv,
        struct m2mtest_ctx *ctx = file2ctx(file);
 
        fmt = find_format(f);
-       if (!fmt || !(fmt->types & MEM2MEM_OUTPUT)) {
+       if (!fmt) {
+               f->fmt.pix.pixelformat = formats[0].fourcc;
+               fmt = find_format(f);
+       }
+       if (!(fmt->types & MEM2MEM_OUTPUT)) {
                v4l2_err(&ctx->dev->v4l2_dev,
                         "Fourcc format (0x%08x) invalid.\n",
                         f->fmt.pix.pixelformat);
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to