[{"id":4025,"web_url":"https://patchwork.libcamera.org/comment/4025/","msgid":"<20200316134011.GC2260535@oden.dyn.berto.se>","date":"2020-03-16T13:40:11","subject":"Re: [libcamera-devel] [PATCH 3/9] libcamera: v4l2_videodevice: Pass\n\tmemory type to reqbufs()","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2020-03-15 01:57:22 +0200, Laurent Pinchart wrote:\n> To prepare for the rework of buffer export, pass the memory type\n> explicitly to the V4L2VideoDevice::reqbufs() function.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/include/v4l2_videodevice.h |  2 +-\n>  src/libcamera/v4l2_videodevice.cpp       | 15 ++++++++-------\n>  2 files changed, 9 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\n> index 893d28c7db88..26f5e5917716 100644\n> --- a/src/libcamera/include/v4l2_videodevice.h\n> +++ b/src/libcamera/include/v4l2_videodevice.h\n> @@ -227,7 +227,7 @@ private:\n>  \n>  \tint setSelection(unsigned int target, Rectangle *rect);\n>  \n> -\tint requestBuffers(unsigned int count);\n> +\tint requestBuffers(unsigned int count, enum v4l2_memory memoryType);\n>  \tstd::unique_ptr<FrameBuffer> createBuffer(const struct v4l2_buffer &buf);\n>  \tFileDescriptor exportDmabufFd(unsigned int index, unsigned int plane);\n>  \n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index aea7a4ea3a23..6911ab024fd7 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -1013,14 +1013,15 @@ int V4L2VideoDevice::setSelection(unsigned int target, Rectangle *rect)\n>  \treturn 0;\n>  }\n>  \n> -int V4L2VideoDevice::requestBuffers(unsigned int count)\n> +int V4L2VideoDevice::requestBuffers(unsigned int count,\n> +\t\t\t\t    enum v4l2_memory memoryType)\n>  {\n>  \tstruct v4l2_requestbuffers rb = {};\n>  \tint ret;\n>  \n>  \trb.count = count;\n>  \trb.type = bufferType_;\n> -\trb.memory = memoryType_;\n> +\trb.memory = memoryType;\n>  \n>  \tret = ioctl(VIDIOC_REQBUFS, &rb);\n>  \tif (ret < 0) {\n> @@ -1033,7 +1034,7 @@ int V4L2VideoDevice::requestBuffers(unsigned int count)\n>  \tif (rb.count < count) {\n>  \t\tLOG(V4L2, Error)\n>  \t\t\t<< \"Not enough buffers provided by V4L2VideoDevice\";\n> -\t\trequestBuffers(0);\n> +\t\trequestBuffers(0, memoryType);\n>  \t\treturn -ENOMEM;\n>  \t}\n>  \n> @@ -1059,7 +1060,7 @@ int V4L2VideoDevice::allocateBuffers(unsigned int count,\n>  \n>  \tmemoryType_ = V4L2_MEMORY_MMAP;\n>  \n> -\tint ret = requestBuffers(count);\n> +\tint ret = requestBuffers(count, V4L2_MEMORY_MMAP);\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>  \n> @@ -1096,7 +1097,7 @@ int V4L2VideoDevice::allocateBuffers(unsigned int count,\n>  \treturn count;\n>  \n>  err_buf:\n> -\trequestBuffers(0);\n> +\trequestBuffers(0, V4L2_MEMORY_MMAP);\n>  \n>  \tbuffers->clear();\n>  \n> @@ -1166,7 +1167,7 @@ int V4L2VideoDevice::importBuffers(unsigned int count)\n>  \n>  \tmemoryType_ = V4L2_MEMORY_DMABUF;\n>  \n> -\tint ret = requestBuffers(count);\n> +\tint ret = requestBuffers(count, V4L2_MEMORY_DMABUF);\n>  \tif (ret)\n>  \t\treturn ret;\n>  \n> @@ -1187,7 +1188,7 @@ int V4L2VideoDevice::releaseBuffers()\n>  \tdelete cache_;\n>  \tcache_ = nullptr;\n>  \n> -\treturn requestBuffers(0);\n> +\treturn requestBuffers(0, memoryType_);\n>  }\n>  \n>  /**\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 70C316041A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Mar 2020 14:40:13 +0100 (CET)","by mail-lj1-x244.google.com with SMTP id w4so3970638lji.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Mar 2020 06:40:13 -0700 (PDT)","from localhost (h-200-138.A463.priv.bahnhof.se. [176.10.200.138])\n\tby smtp.gmail.com with ESMTPSA id\n\ts4sm8198144lfs.54.2020.03.16.06.40.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 16 Mar 2020 06:40:11 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=0anzA4vzOvu/+HJsmY4x2Xla1R89trCXuXTfT14i0xE=;\n\tb=ru7d484Vz6VG80tt4NWVxPDktTrr5LauF7sJAWjMzrFkXWOor0oylRb3avVJcomyvA\n\tr0ZFAbqEm2rhp22Ab7WfhyVEMvvQEW2Ikl0rN702d+YeU3GuK9GBxzvQx2D07xeoA+24\n\tP9romH4ryp9rkmysbgmj6cvSctRUYqV7y5/22gatlt/FGYBns0VN33SJ+tmPdKxchcy+\n\tJWYVsPvZ9PgHVzNwAAXbniYyOchSQ/w6fWEQQwZ7VbhWG7zX8mWrhqkQKBI6y4JiPL3K\n\t2BxK3hAH1D7YTjejfY1GHqLjt1x5GAfXVnSYkuW6KG/zgUmFWbgE01QFxFpn78j5cdVf\n\txyNA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=0anzA4vzOvu/+HJsmY4x2Xla1R89trCXuXTfT14i0xE=;\n\tb=WmhQmuoZw7wJd7a/f0083QVQ2IHBZOmrIMQ7hK24Yf9TfNTkv8xZijfACMqOCSjjwk\n\tmDHJ/yVteRu4UmyLmHclMbF78O5Iz94iak8oYf/X/AwVQEEuA4kyl2ZM49WkoirKRNwt\n\thbY4P1FJALyGwI2V9QcAyOHpE8k4kHyQ8i50qdKeiFN2PKtqTrGKca55xGymmTXFCgPB\n\tBc4PXavls+eeXosDel+tWeg15BW6ynf2pxfr3U7/BkEnKewqRd0/IBRr+WZEkOFWzXnt\n\tFcYhyqsKUEq1koS+cJtVWNBN98V+ybJs2t73Kdv8Aj4TChrY9K1ODt9SAS2lCHf9JNUn\n\tUI/g==","X-Gm-Message-State":"ANhLgQ3vyjhU5X0sPYgQQUR9TRvcrRXlJVNcZb2HD/zySB5d4BIXqBnA\n\tQgr1DDXGZbADQESzjlo8DKEFbi0SLbA=","X-Google-Smtp-Source":"ADFU+vvbxE5m3hNPmLXg6Pj/g7I7eq292U+oZsLtNUo3uCqoAxg688r8pzFKA2+0IkTy6MLBaHPUMg==","X-Received":"by 2002:a2e:9852:: with SMTP id\n\te18mr13443142ljj.249.1584366012765; \n\tMon, 16 Mar 2020 06:40:12 -0700 (PDT)","Date":"Mon, 16 Mar 2020 14:40:11 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200316134011.GC2260535@oden.dyn.berto.se>","References":"<20200314235728.15495-1-laurent.pinchart@ideasonboard.com>\n\t<20200314235728.15495-4-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200314235728.15495-4-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 3/9] libcamera: v4l2_videodevice: Pass\n\tmemory type to reqbufs()","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":"Mon, 16 Mar 2020 13:40:13 -0000"}}]