[{"id":20418,"web_url":"https://patchwork.libcamera.org/comment/20418/","msgid":"<CAEmqJPo2O5RJLjWQ8K+PgwKPP=9Gj-SmOX9akcjDcDgxUtoYow@mail.gmail.com>","date":"2021-10-25T08:19:49","subject":"Re: [libcamera-devel] [PATCH v3 4/7] libcamera: Support passing\n\tColorSpaces to V4L2 video devices","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi David,\n\nThank you for your work.\n\nOn Wed, 20 Oct 2021 at 12:08, David Plowman <david.plowman@raspberrypi.com>\nwrote:\n\n> The ColorSpace from the StreamConfiguration is now handled\n> appropriately in the V4L2VideoDevice.\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n>\n---\n>  include/libcamera/internal/v4l2_videodevice.h |  2 +\n>  src/libcamera/v4l2_videodevice.cpp            | 69 +++++++++++++++++--\n>  2 files changed, 66 insertions(+), 5 deletions(-)\n>\n> diff --git a/include/libcamera/internal/v4l2_videodevice.h\n> b/include/libcamera/internal/v4l2_videodevice.h\n> index efe34d47..34cc9cdd 100644\n> --- a/include/libcamera/internal/v4l2_videodevice.h\n> +++ b/include/libcamera/internal/v4l2_videodevice.h\n> @@ -20,6 +20,7 @@\n>  #include <libcamera/base/log.h>\n>  #include <libcamera/base/signal.h>\n>\n> +#include <libcamera/color_space.h>\n>  #include <libcamera/framebuffer.h>\n>  #include <libcamera/geometry.h>\n>  #include <libcamera/pixel_format.h>\n> @@ -163,6 +164,7 @@ public:\n>\n>         V4L2PixelFormat fourcc;\n>         Size size;\n> +       ColorSpace colorSpace;\n>\n>         std::array<Plane, 3> planes;\n>         unsigned int planesCount = 0;\n> diff --git a/src/libcamera/v4l2_videodevice.cpp\n> b/src/libcamera/v4l2_videodevice.cpp\n> index ba5f88cd..9e57e257 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -364,11 +364,6 @@ bool V4L2BufferCache::Entry::operator==(const\n> FrameBuffer &buffer) const\n>   * \\brief The plane line stride (in bytes)\n>   */\n>\n> -/**\n> - * \\var V4L2DeviceFormat::size\n> - * \\brief The image size in pixels\n> - */\n> -\n>  /**\n>   * \\var V4L2DeviceFormat::fourcc\n>   * \\brief The fourcc code describing the pixel encoding scheme\n> @@ -377,6 +372,23 @@ bool V4L2BufferCache::Entry::operator==(const\n> FrameBuffer &buffer) const\n>   * that identifies the image format pixel encoding scheme.\n>   */\n>\n> +/**\n> + * \\var V4L2DeviceFormat::size\n> + * \\brief The image size in pixels\n> + */\n> +\n> +/**\n> + * \\var V4L2DeviceFormat::colorSpace\n> + * \\brief The color space of the pixels\n> + *\n> + * When setting or trying a format, passing in \"Undefined\" fields in the\n> + * ColorSpace is not permitted because the driver will then make an\n> + * arbitrary choice of its own. Choices made by the driver will be\n> + * passed back in the normal way, though note that \"Undefined\" values can\n> + * be returned if the device has chosen something that the ColorSpace\n> + * class cannot represent.\n> + */\n> +\n>  /**\n>   * \\var V4L2DeviceFormat::planes\n>   * \\brief The per-plane memory size information\n> @@ -873,6 +885,12 @@ int\n> V4L2VideoDevice::getFormatMultiplane(V4L2DeviceFormat *format)\n>         format->fourcc = V4L2PixelFormat(pix->pixelformat);\n>         format->planesCount = pix->num_planes;\n>\n> +       format->colorSpace = v4l2ToColorSpace(*pix);\n> +       if (!format->colorSpace.isFullyDefined())\n> +               LOG(V4L2, Warning)\n> +                       << \"Retrieved undefined color space: \"\n> +                       << format->colorSpace.toString();\n> +\n>         for (unsigned int i = 0; i < format->planesCount; ++i) {\n>                 format->planes[i].bpl = pix->plane_fmt[i].bytesperline;\n>                 format->planes[i].size = pix->plane_fmt[i].sizeimage;\n> @@ -887,6 +905,11 @@ int\n> V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n>         struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp;\n>         int ret;\n>\n> +       if (!format->colorSpace.isFullyDefined())\n> +               LOG(V4L2, Error)\n> +                       << \"Trying to set undefined color space: \"\n> +                       << format->colorSpace.toString();\n> +\n>\n\nShould we return with an error code in the above if clause?  Similar for\nthe other setFormat() calls.\nOther than that:\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n\n\n>         v4l2Format.type = bufferType_;\n>         pix->width = format->size.width;\n>         pix->height = format->size.height;\n> @@ -894,6 +917,12 @@ int\n> V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n>         pix->num_planes = format->planesCount;\n>         pix->field = V4L2_FIELD_NONE;\n>\n> +       ret = colorSpaceToV4l2(format->colorSpace, *pix);\n> +       if (ret < 0)\n> +               LOG(V4L2, Warning)\n> +                       << \"Setting color space unrecognised by V4L2: \"\n> +                       << format->colorSpace.toString();\n> +\n>         ASSERT(pix->num_planes <= std::size(pix->plane_fmt));\n>\n>         for (unsigned int i = 0; i < pix->num_planes; ++i) {\n> @@ -922,6 +951,12 @@ int\n> V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n>                 format->planes[i].size = pix->plane_fmt[i].sizeimage;\n>         }\n>\n> +       format->colorSpace = v4l2ToColorSpace(*pix);\n> +       if (!format->colorSpace.isFullyDefined())\n> +               LOG(V4L2, Warning)\n> +                       << \"Undefined color space has been set: \"\n> +                       << format->colorSpace.toString();\n> +\n>         return 0;\n>  }\n>\n> @@ -945,6 +980,12 @@ int\n> V4L2VideoDevice::getFormatSingleplane(V4L2DeviceFormat *format)\n>         format->planes[0].bpl = pix->bytesperline;\n>         format->planes[0].size = pix->sizeimage;\n>\n> +       format->colorSpace = v4l2ToColorSpace(*pix);\n> +       if (!format->colorSpace.isFullyDefined())\n> +               LOG(V4L2, Warning)\n> +                       << \"Retrieved undefined color space: \"\n> +                       << format->colorSpace.toString();\n> +\n>         return 0;\n>  }\n>\n> @@ -954,12 +995,24 @@ int\n> V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n>         struct v4l2_pix_format *pix = &v4l2Format.fmt.pix;\n>         int ret;\n>\n> +       if (!format->colorSpace.isFullyDefined())\n> +               LOG(V4L2, Error)\n> +                       << \"Trying to set undefined color space: \"\n> +                       << format->colorSpace.toString();\n> +\n>         v4l2Format.type = bufferType_;\n>         pix->width = format->size.width;\n>         pix->height = format->size.height;\n>         pix->pixelformat = format->fourcc;\n>         pix->bytesperline = format->planes[0].bpl;\n>         pix->field = V4L2_FIELD_NONE;\n> +\n> +       ret = colorSpaceToV4l2(format->colorSpace, *pix);\n> +       if (ret < 0)\n> +               LOG(V4L2, Warning)\n> +                       << \"Set color space unrecognised by V4L2: \"\n> +                       << format->colorSpace.toString();\n> +\n>         ret = ioctl(set ? VIDIOC_S_FMT : VIDIOC_TRY_FMT, &v4l2Format);\n>         if (ret) {\n>                 LOG(V4L2, Error)\n> @@ -979,6 +1032,12 @@ int\n> V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n>         format->planes[0].bpl = pix->bytesperline;\n>         format->planes[0].size = pix->sizeimage;\n>\n> +       format->colorSpace = v4l2ToColorSpace(*pix);\n> +       if (!format->colorSpace.isFullyDefined())\n> +               LOG(V4L2, Warning)\n> +                       << \"Undefined color space has been set: \"\n> +                       << format->colorSpace.toString();\n> +\n>         return 0;\n>  }\n>\n> --\n> 2.20.1\n>\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 37FCBBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Oct 2021 08:20:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 828CE64870;\n\tMon, 25 Oct 2021 10:20:07 +0200 (CEST)","from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com\n\t[IPv6:2a00:1450:4864:20::12c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B25C160124\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Oct 2021 10:20:05 +0200 (CEST)","by mail-lf1-x12c.google.com with SMTP id x192so9376066lff.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Oct 2021 01:20:05 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"U+OUigH8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=xLbJfGd6o04DPT5IvR4lPE50hDfnbmd0GQFpkCcGhqg=;\n\tb=U+OUigH8/8NvfoqUki9xQLvAHwSc69JBsuaFkDumIO7XoGd4ycixFuQq58HiuPcuqf\n\tJ+YMfsNaZGH3I/e72oGWaWnG8i8ON5YJuHqHSHcnHXwHpcmhmBe7HgCgApmkeaydbA6t\n\txI2Mfo9n8ixgYPnlZPGv4OXGMrjZ3fGFUMng0c7cLKheo6f8A4NhDxD5G3eBb+Q1JrzK\n\tmoBFf4IpLNGchrnMBv3aawQwiuOCKt+vviO1b0zS7jhgvedGgozNogC/qaPSyrf/+iQt\n\t2iWpr3zjWlbNI6U20yss8s3hzaRgDneMfGRMb6Ivk5bQcVVRhsgjJ7ortGN29YBF9lav\n\tPUEQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=xLbJfGd6o04DPT5IvR4lPE50hDfnbmd0GQFpkCcGhqg=;\n\tb=B5srSIbzfYJIcNXiJNa9NM+ig6M7o1CVCE30L0H3nqg0YXQRri6IyRG3aE857fFj3H\n\t0Z34dGB6T5hSEAcGa7j/EyLK8evxKOLq2YhX7lW5J5UjNG0dV3ZF7cM0yG9WgB/LFi10\n\t7GewC2cqvO6fjvCHelXYcbLpaBC5FMgPmABF/zSrDWKqWlnqnyjwF/7XHvvE36nqKBNv\n\tcbHsb82aJ6fzDzyT90sZrGCJ229F6QRhXRp+ETy2hzA6vw2o8JBIUSiPhzoFJ/ESO6N5\n\tZMbMzolZPpCalN3tHBkr5AqeasWAIgQ0UJRIPm6e7p4EZvP/3JklqlcuZoogX2gUtAvr\n\t9rdw==","X-Gm-Message-State":"AOAM532nSF/PxBJ28tuyarUUSjxkcp7ulVnAS/6/2Idzc4aipr8pEMcW\n\trrXG64GuRPFPOIodhUk1C38ze521IfjZ6Bc5WuFVbQ==","X-Google-Smtp-Source":"ABdhPJz/+f0femzbFhJCLaTo1vuCLDhR7Gva3eQX+KLl7NRFMdo/NJgm78PbRvLbuueT1kYuROq9HH+t5tdZvdFHopQ=","X-Received":"by 2002:a19:ad0d:: with SMTP id\n\tt13mr15959132lfc.161.1635150005026; \n\tMon, 25 Oct 2021 01:20:05 -0700 (PDT)","MIME-Version":"1.0","References":"<20211020110825.12902-1-david.plowman@raspberrypi.com>\n\t<20211020110825.12902-5-david.plowman@raspberrypi.com>","In-Reply-To":"<20211020110825.12902-5-david.plowman@raspberrypi.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Mon, 25 Oct 2021 09:19:49 +0100","Message-ID":"<CAEmqJPo2O5RJLjWQ8K+PgwKPP=9Gj-SmOX9akcjDcDgxUtoYow@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Content-Type":"multipart/alternative; boundary=\"00000000000034516605cf290712\"","Subject":"Re: [libcamera-devel] [PATCH v3 4/7] libcamera: Support passing\n\tColorSpaces to V4L2 video devices","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20426,"web_url":"https://patchwork.libcamera.org/comment/20426/","msgid":"<CAHW6GY+K-eY=uShw5bfB7mBgbnq7-NcS58=cWZ7C05zcvgJbDw@mail.gmail.com>","date":"2021-10-25T09:54:13","subject":"Re: [libcamera-devel] [PATCH v3 4/7] libcamera: Support passing\n\tColorSpaces to V4L2 video devices","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for asking another good question!\n\nOn Mon, 25 Oct 2021 at 09:20, Naushir Patuck <naush@raspberrypi.com> wrote:\n>\n> Hi David,\n>\n> Thank you for your work.\n>\n> On Wed, 20 Oct 2021 at 12:08, David Plowman <david.plowman@raspberrypi.com> wrote:\n>>\n>> The ColorSpace from the StreamConfiguration is now handled\n>> appropriately in the V4L2VideoDevice.\n>>\n>> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n>>\n>> ---\n>>  include/libcamera/internal/v4l2_videodevice.h |  2 +\n>>  src/libcamera/v4l2_videodevice.cpp            | 69 +++++++++++++++++--\n>>  2 files changed, 66 insertions(+), 5 deletions(-)\n>>\n>> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n>> index efe34d47..34cc9cdd 100644\n>> --- a/include/libcamera/internal/v4l2_videodevice.h\n>> +++ b/include/libcamera/internal/v4l2_videodevice.h\n>> @@ -20,6 +20,7 @@\n>>  #include <libcamera/base/log.h>\n>>  #include <libcamera/base/signal.h>\n>>\n>> +#include <libcamera/color_space.h>\n>>  #include <libcamera/framebuffer.h>\n>>  #include <libcamera/geometry.h>\n>>  #include <libcamera/pixel_format.h>\n>> @@ -163,6 +164,7 @@ public:\n>>\n>>         V4L2PixelFormat fourcc;\n>>         Size size;\n>> +       ColorSpace colorSpace;\n>>\n>>         std::array<Plane, 3> planes;\n>>         unsigned int planesCount = 0;\n>> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n>> index ba5f88cd..9e57e257 100644\n>> --- a/src/libcamera/v4l2_videodevice.cpp\n>> +++ b/src/libcamera/v4l2_videodevice.cpp\n>> @@ -364,11 +364,6 @@ bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const\n>>   * \\brief The plane line stride (in bytes)\n>>   */\n>>\n>> -/**\n>> - * \\var V4L2DeviceFormat::size\n>> - * \\brief The image size in pixels\n>> - */\n>> -\n>>  /**\n>>   * \\var V4L2DeviceFormat::fourcc\n>>   * \\brief The fourcc code describing the pixel encoding scheme\n>> @@ -377,6 +372,23 @@ bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const\n>>   * that identifies the image format pixel encoding scheme.\n>>   */\n>>\n>> +/**\n>> + * \\var V4L2DeviceFormat::size\n>> + * \\brief The image size in pixels\n>> + */\n>> +\n>> +/**\n>> + * \\var V4L2DeviceFormat::colorSpace\n>> + * \\brief The color space of the pixels\n>> + *\n>> + * When setting or trying a format, passing in \"Undefined\" fields in the\n>> + * ColorSpace is not permitted because the driver will then make an\n>> + * arbitrary choice of its own. Choices made by the driver will be\n>> + * passed back in the normal way, though note that \"Undefined\" values can\n>> + * be returned if the device has chosen something that the ColorSpace\n>> + * class cannot represent.\n>> + */\n>> +\n>>  /**\n>>   * \\var V4L2DeviceFormat::planes\n>>   * \\brief The per-plane memory size information\n>> @@ -873,6 +885,12 @@ int V4L2VideoDevice::getFormatMultiplane(V4L2DeviceFormat *format)\n>>         format->fourcc = V4L2PixelFormat(pix->pixelformat);\n>>         format->planesCount = pix->num_planes;\n>>\n>> +       format->colorSpace = v4l2ToColorSpace(*pix);\n>> +       if (!format->colorSpace.isFullyDefined())\n>> +               LOG(V4L2, Warning)\n>> +                       << \"Retrieved undefined color space: \"\n>> +                       << format->colorSpace.toString();\n>> +\n>>         for (unsigned int i = 0; i < format->planesCount; ++i) {\n>>                 format->planes[i].bpl = pix->plane_fmt[i].bytesperline;\n>>                 format->planes[i].size = pix->plane_fmt[i].sizeimage;\n>> @@ -887,6 +905,11 @@ int V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n>>         struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp;\n>>         int ret;\n>>\n>> +       if (!format->colorSpace.isFullyDefined())\n>> +               LOG(V4L2, Error)\n>> +                       << \"Trying to set undefined color space: \"\n>> +                       << format->colorSpace.toString();\n>> +\n>\n>\n> Should we return with an error code in the above if clause?  Similar for the other setFormat() calls.\n\nGood point. I was slightly nervous here about breaking pipeline\nhandlers that simply don't handle colour spaces yet. One might worry\nabout the ipu3/rkisp1 pipeline handlers but it might be even worse\nthan that. For example, if you bisected your tree and unluckily got\nthis as your top commit then nothing at all would run.\n\nPerhaps there needs to be a further commit after all pipeline handlers\nhave been upgraded so that they never pass anything undefined? At that\npoint, failure here would be fine. Thoughts welcome on that!\n\nThanks\nDavid\n\n> Other than that:\n>\n> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>\n>\n>\n>>\n>>         v4l2Format.type = bufferType_;\n>>         pix->width = format->size.width;\n>>         pix->height = format->size.height;\n>> @@ -894,6 +917,12 @@ int V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n>>         pix->num_planes = format->planesCount;\n>>         pix->field = V4L2_FIELD_NONE;\n>>\n>> +       ret = colorSpaceToV4l2(format->colorSpace, *pix);\n>> +       if (ret < 0)\n>> +               LOG(V4L2, Warning)\n>> +                       << \"Setting color space unrecognised by V4L2: \"\n>> +                       << format->colorSpace.toString();\n>> +\n>>         ASSERT(pix->num_planes <= std::size(pix->plane_fmt));\n>>\n>>         for (unsigned int i = 0; i < pix->num_planes; ++i) {\n>> @@ -922,6 +951,12 @@ int V4L2VideoDevice::trySetFormatMultiplane(V4L2DeviceFormat *format, bool set)\n>>                 format->planes[i].size = pix->plane_fmt[i].sizeimage;\n>>         }\n>>\n>> +       format->colorSpace = v4l2ToColorSpace(*pix);\n>> +       if (!format->colorSpace.isFullyDefined())\n>> +               LOG(V4L2, Warning)\n>> +                       << \"Undefined color space has been set: \"\n>> +                       << format->colorSpace.toString();\n>> +\n>>         return 0;\n>>  }\n>>\n>> @@ -945,6 +980,12 @@ int V4L2VideoDevice::getFormatSingleplane(V4L2DeviceFormat *format)\n>>         format->planes[0].bpl = pix->bytesperline;\n>>         format->planes[0].size = pix->sizeimage;\n>>\n>> +       format->colorSpace = v4l2ToColorSpace(*pix);\n>> +       if (!format->colorSpace.isFullyDefined())\n>> +               LOG(V4L2, Warning)\n>> +                       << \"Retrieved undefined color space: \"\n>> +                       << format->colorSpace.toString();\n>> +\n>>         return 0;\n>>  }\n>>\n>> @@ -954,12 +995,24 @@ int V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n>>         struct v4l2_pix_format *pix = &v4l2Format.fmt.pix;\n>>         int ret;\n>>\n>> +       if (!format->colorSpace.isFullyDefined())\n>> +               LOG(V4L2, Error)\n>> +                       << \"Trying to set undefined color space: \"\n>> +                       << format->colorSpace.toString();\n>> +\n>>         v4l2Format.type = bufferType_;\n>>         pix->width = format->size.width;\n>>         pix->height = format->size.height;\n>>         pix->pixelformat = format->fourcc;\n>>         pix->bytesperline = format->planes[0].bpl;\n>>         pix->field = V4L2_FIELD_NONE;\n>> +\n>> +       ret = colorSpaceToV4l2(format->colorSpace, *pix);\n>> +       if (ret < 0)\n>> +               LOG(V4L2, Warning)\n>> +                       << \"Set color space unrecognised by V4L2: \"\n>> +                       << format->colorSpace.toString();\n>> +\n>>         ret = ioctl(set ? VIDIOC_S_FMT : VIDIOC_TRY_FMT, &v4l2Format);\n>>         if (ret) {\n>>                 LOG(V4L2, Error)\n>> @@ -979,6 +1032,12 @@ int V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n>>         format->planes[0].bpl = pix->bytesperline;\n>>         format->planes[0].size = pix->sizeimage;\n>>\n>> +       format->colorSpace = v4l2ToColorSpace(*pix);\n>> +       if (!format->colorSpace.isFullyDefined())\n>> +               LOG(V4L2, Warning)\n>> +                       << \"Undefined color space has been set: \"\n>> +                       << format->colorSpace.toString();\n>> +\n>>         return 0;\n>>  }\n>>\n>> --\n>> 2.20.1\n>>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5D376BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Oct 2021 09:54:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9439B64870;\n\tMon, 25 Oct 2021 11:54:25 +0200 (CEST)","from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4B30360124\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Oct 2021 11:54:24 +0200 (CEST)","by mail-wr1-x436.google.com with SMTP id d3so7596281wrh.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Oct 2021 02:54:24 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"oiwZeSJh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=IdM7OS8Ma9oQUkJYZpaqwfX4meji7N6vODXQgNFngYg=;\n\tb=oiwZeSJhd8RoEjdrp2IqkxVeUuROF4xKaM0DR94CJvS6Tr5KVZkXAcxNJLPabK45en\n\tQjC0BUMlBHSXGz9+PJR5th4sh53t16rtIljWB6l+jwoNXNc2nZNw8+dowp0ny2wqbcCG\n\t7chqaJv40YaZt9BW0p1O3CNfeuHLtWDQEvpJChboYh7B8cRt5rlAQ2rwA+5Y4h6S8OOb\n\tbnsi+Z+UOfMoDtV2y4FqssX7Yr9YL3WwClKfnJbSDbYLfUs2d9Y1W6jV33Jcv4c4OvfW\n\th5SXWHRqTY7ICYDTPofiSrJ9ayPMQs2kSYBIDfCwNbnqnsuzqEgDXb0NXsQ3OnW5UNoW\n\teemA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=IdM7OS8Ma9oQUkJYZpaqwfX4meji7N6vODXQgNFngYg=;\n\tb=jOhP1Fknyqn1XAc1+Rd2VbMVUg7dTvEo0jKX+6ZS93Xgs9YILxmRPojkFBokgi5JPL\n\t4bH68T1yZc4ZTa2q5hyIg8Y8jlW9LWVkbVI0WavCrgmgT7KkOGhcyPxmcqTHLQK51fKM\n\tcvArejk5LrUKb9w38JrAeeKwSe5xQc0zFkfYPgsNzVDvjO4Cj7waS/bDQuGCZePKko7a\n\ttGgspsmFghN1WMNdJGQ+QrD1KAE9fLl84acveU67hCr5rGSm9CwpD5aVeDnLH1S0oRQo\n\twYlB24LfBXXzJkbrvW9p25WDf0aVD5IFGkZE+604x97sX8WJD8esOpig/BIwz+XQKpyF\n\tY1mg==","X-Gm-Message-State":"AOAM531y6RLa1bHpwu3Zv0gIXskC5UAg7Ipb23Z0CFVXGjr/19ffZFsJ\n\tdnq+KD3pXQOVs6Ni0/SEKWBKdANz/xROiCSk+WCqgfwa","X-Google-Smtp-Source":"ABdhPJzUxg7CPmzWtJiNFtKdUwMsKrlvGe7bVasvRFLE3WcrtL0uy2FAweSlnDmFimcOrK0BvalvjWnXB1zjcKfqyGE=","X-Received":"by 2002:a05:6000:4c:: with SMTP id\n\tk12mr16613191wrx.354.1635155663894; \n\tMon, 25 Oct 2021 02:54:23 -0700 (PDT)","MIME-Version":"1.0","References":"<20211020110825.12902-1-david.plowman@raspberrypi.com>\n\t<20211020110825.12902-5-david.plowman@raspberrypi.com>\n\t<CAEmqJPo2O5RJLjWQ8K+PgwKPP=9Gj-SmOX9akcjDcDgxUtoYow@mail.gmail.com>","In-Reply-To":"<CAEmqJPo2O5RJLjWQ8K+PgwKPP=9Gj-SmOX9akcjDcDgxUtoYow@mail.gmail.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Mon, 25 Oct 2021 10:54:13 +0100","Message-ID":"<CAHW6GY+K-eY=uShw5bfB7mBgbnq7-NcS58=cWZ7C05zcvgJbDw@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v3 4/7] libcamera: Support passing\n\tColorSpaces to V4L2 video devices","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]