{"id":2220,"url":"https://patchwork.libcamera.org/api/patches/2220/?format=json","web_url":"https://patchwork.libcamera.org/patch/2220/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191025133208.22637-1-andrey.konovalov@linaro.org>","date":"2019-10-25T13:32:08","name":"[libcamera-devel] libcamera: v4l2_subdevice: use G_FORMAT if ENUM_FRAME_SIZE isn't implemented","commit_ref":null,"pull_url":null,"state":"rejected","archived":false,"hash":"77f060ac0f5a1df1e44c6185689bc758bddd624f","submitter":{"id":25,"url":"https://patchwork.libcamera.org/api/people/25/?format=json","name":"Andrey Konovalov","email":"andrey.konovalov@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2220/mbox/","series":[{"id":548,"url":"https://patchwork.libcamera.org/api/series/548/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=548","date":"2019-10-25T13:32:08","name":"[libcamera-devel] libcamera: v4l2_subdevice: use G_FORMAT if ENUM_FRAME_SIZE isn't implemented","version":1,"mbox":"https://patchwork.libcamera.org/series/548/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2220/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2220/checks/","tags":{},"headers":{"Return-Path":"<andrey.konovalov@linaro.org>","Received":["from mail-lf1-x142.google.com (mail-lf1-x142.google.com\n\t[IPv6:2a00:1450:4864:20::142])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 918F461375\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Oct 2019 15:32:28 +0200 (CEST)","by mail-lf1-x142.google.com with SMTP id f5so1794073lfp.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Oct 2019 06:32:28 -0700 (PDT)","from TM-8481.Dlink (office.dev.rtsoft.ru. [62.117.114.130])\n\tby smtp.googlemail.com with ESMTPSA id\n\tc76sm900098lfg.11.2019.10.25.06.32.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 25 Oct 2019 06:32:26 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id;\n\tbh=kSSd3q8kcXla/aTMCijrzaYKxW56S3yJu/GkNoRa3wA=;\n\tb=U0SVYjzXi9rROaWbwoqeS4bYzBJKjN1J1zYrZS1mlGya8P1EZ+u1v9GE+okRKvN0iQ\n\tElg7Px+lZmD1tCT2ahhRgiaNOSzKpOk4UeUq2D5jrlrWuGDTe3rH6vqx9RoEK+x+h0cg\n\tQefR3Wbrpiy+Hj/l1MBGYY8lGDHODTSeAajmRduEkjCsIxsyMS1ARdTt5nXW4WGsMGla\n\tb49iW8ojvBc4QfFv3fdi+/xuYIAC+gUVVGx7A9AZgdVmsgjSX3/lAdHiWR0ThKHEozVj\n\tijcCyl2qYhA8lji0RsLRcWpGv04YK8lX2qk5gjxcGM3uGMPd54s48dTQ/+8me+YTsRGj\n\tqObQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=kSSd3q8kcXla/aTMCijrzaYKxW56S3yJu/GkNoRa3wA=;\n\tb=Xmf5uuOEzmpWVyVxaIUDkcKvkGWNpc4PpJybku3R32/4boPz7WMNDLz1VMQtvAOHMa\n\tvP/A5XYKhRuts53zcfiXXq/k6D2fSbGxiiGisbaoYdbbX/37Ty359vphZAL3Til3P0hF\n\t9PH9enRI0KZ8GfcXENp9oZkuTCKg5GsVaZNGi3eXh+8YsCO75vByDbbDhYY6SWdJ+gii\n\tk5qZekZiq/C93jk3Iy1yptcG2vSZBMmYvdGPKzT3Zl7grl86lwCIZIlKIdHakCMsNqtP\n\tPm+sd9GtIzTN83ibRv+4Lkc9kRczESl5p7g3S1uw0DOIm6KFVzeEz32T3bt0cjQLBr+M\n\tO3+Q==","X-Gm-Message-State":"APjAAAVV7bFAfF0Nd/RgwxPw2KkgCZG+XemAmQsg9FQlCMoLdm9aUptq\n\tXvjK2MsAER4dvcydfEItEIuDu+TcoVY=","X-Google-Smtp-Source":"APXvYqxytrmVpc7mTOY9i+cV+wuSS26f7DdOXfAvE4Keu3fAldVEHc2rfK9m6AhLdqzeh1JewlnA6w==","X-Received":"by 2002:a19:41d7:: with SMTP id\n\to206mr2782316lfa.188.1572010347391; \n\tFri, 25 Oct 2019 06:32:27 -0700 (PDT)","From":"Andrey Konovalov <andrey.konovalov@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 25 Oct 2019 16:32:08 +0300","Message-Id":"<20191025133208.22637-1-andrey.konovalov@linaro.org>","X-Mailer":"git-send-email 2.17.1","Subject":"[libcamera-devel] [PATCH] libcamera: v4l2_subdevice: use G_FORMAT\n\tif ENUM_FRAME_SIZE isn't implemented","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>","X-List-Received-Date":"Fri, 25 Oct 2019 13:32:28 -0000"},"content":"Many camera sensor drivers support only one frame size, and don't\nimplement VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl. And libcamera fails\nto enumerate such cameras as it doesn't get the list of resolutions\nthe sensor driver supports. Fix this by using VIDIOC_SUBDEV_G_FORMAT\nto get the size of the sensor's active format when the ENUM_FRAME_SIZE\nioctl isn't implemented by the sensor driver.\n\nSigned-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n---\n src/libcamera/v4l2_subdevice.cpp | 20 +++++++++++++++++++-\n 1 file changed, 19 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex f2bcd7f..fac7586 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -317,7 +317,25 @@ std::vector<SizeRange> V4L2Subdevice::enumPadSizes(unsigned int pad,\n \t\t\t\t   sizeEnum.max_width, sizeEnum.max_height);\n \t}\n \n-\tif (ret < 0 && ret != -EINVAL && ret != -ENOTTY) {\n+\tif (ret == -ENOTTY) {\n+\t\tstruct v4l2_subdev_format format = {};\n+\n+\t\tLOG(V4L2, Debug)\n+\t\t\t<< \"VIDIOC_SUBDEV_ENUM_FRAME_SIZE not implemented \"\n+\t\t\t<< \"- trying VIDIOC_SUBDEV_G_FMT\";\n+\t\tformat.pad = pad;\n+\t\tformat.which = V4L2_SUBDEV_FORMAT_ACTIVE;\n+\n+\t\tret = ioctl(VIDIOC_SUBDEV_G_FMT, &format);\n+\t\tif (ret == 0) {\n+\t\t\tsizes.emplace_back(format.format.width,\n+\t\t\t\t\t   format.format.height,\n+\t\t\t\t\t   format.format.width,\n+\t\t\t\t\t   format.format.height);\n+\t\t}\n+\t}\n+\n+\tif (ret < 0 && ret != -EINVAL) {\n \t\tLOG(V4L2, Error)\n \t\t\t<< \"Unable to enumerate sizes on pad \" << pad\n \t\t\t<< \": \" << strerror(-ret);\n","prefixes":["libcamera-devel"]}