[{"id":22002,"web_url":"https://patchwork.libcamera.org/comment/22002/","msgid":"<164183321577.10801.15472912419250531733@Monstersaurus>","date":"2022-01-10T16:46:55","subject":"Re: [libcamera-devel] [PATCH v1 5/5] v4l2: v4l2_camera_proxy: Use\n\tfile description in debug messages","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2021-12-28 21:59:51)\n> Debug messages in V4L2CameraProxy print the numerical file descriptor,\n> which isn't very human-friendly. Replace it with the V4L2CameraFile\n> description that includes the full path. While at it, refactor the\n> messages to use __func__ instead of manually copying function names.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThis sounds pretty good to me.\n\nI wonder if libcamera-v4l2 (libcameraify, libcamera-ify?) should have a\nfaciilty for setting these debug levels from the script ...\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/v4l2/v4l2_camera_proxy.cpp   | 74 ++++++++++++++++++++------------\n>  src/v4l2/v4l2_camera_proxy.h     |  7 +--\n>  src/v4l2/v4l2_compat_manager.cpp |  5 ++-\n>  3 files changed, 54 insertions(+), 32 deletions(-)\n> \n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index 80e6624bc9b7..5ccf40b9692c 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -46,7 +46,8 @@ V4L2CameraProxy::V4L2CameraProxy(unsigned int index,\n>  \n>  int V4L2CameraProxy::open(V4L2CameraFile *file)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing open fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         MutexLocker locker(proxyMutex_);\n>  \n> @@ -80,7 +81,8 @@ int V4L2CameraProxy::open(V4L2CameraFile *file)\n>  \n>  void V4L2CameraProxy::close(V4L2CameraFile *file)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing close fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         MutexLocker locker(proxyMutex_);\n>  \n> @@ -94,10 +96,11 @@ void V4L2CameraProxy::close(V4L2CameraFile *file)\n>         vcam_->close();\n>  }\n>  \n> -void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags,\n> -                           off64_t offset)\n> +void *V4L2CameraProxy::mmap(V4L2CameraFile *file, void *addr, size_t length,\n> +                           int prot, int flags, off64_t offset)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing mmap\";\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         MutexLocker locker(proxyMutex_);\n>  \n> @@ -131,9 +134,10 @@ void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags,\n>         return map;\n>  }\n>  \n> -int V4L2CameraProxy::munmap(void *addr, size_t length)\n> +int V4L2CameraProxy::munmap(V4L2CameraFile *file, void *addr, size_t length)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing munmap\";\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         MutexLocker locker(proxyMutex_);\n>  \n> @@ -233,9 +237,10 @@ void V4L2CameraProxy::updateBuffers()\n>         }\n>  }\n>  \n> -int V4L2CameraProxy::vidioc_querycap(struct v4l2_capability *arg)\n> +int V4L2CameraProxy::vidioc_querycap(V4L2CameraFile *file, struct v4l2_capability *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_querycap\";\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         *arg = capabilities_;\n>  \n> @@ -244,7 +249,8 @@ int V4L2CameraProxy::vidioc_querycap(struct v4l2_capability *arg)\n>  \n>  int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_framesizes fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         V4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->pixel_format);\n>         PixelFormat format = v4l2Format.toPixelFormat();\n> @@ -267,7 +273,8 @@ int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_fr\n>  \n>  int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_fmt fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (!validateBufferType(arg->type) ||\n>             arg->index >= streamConfig_.formats().pixelformats().size())\n> @@ -288,7 +295,8 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *\n>  \n>  int V4L2CameraProxy::vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_g_fmt fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (!validateBufferType(arg->type))\n>                 return -EINVAL;\n> @@ -331,7 +339,8 @@ int V4L2CameraProxy::tryFormat(struct v4l2_format *arg)\n>  \n>  int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_s_fmt fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (!validateBufferType(arg->type))\n>                 return -EINVAL;\n> @@ -361,7 +370,8 @@ int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  \n>  int V4L2CameraProxy::vidioc_try_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_try_fmt fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (!validateBufferType(arg->type))\n>                 return -EINVAL;\n> @@ -384,7 +394,8 @@ enum v4l2_priority V4L2CameraProxy::maxPriority()\n>  \n>  int V4L2CameraProxy::vidioc_g_priority(V4L2CameraFile *file, enum v4l2_priority *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_g_priority fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         *arg = maxPriority();\n>  \n> @@ -394,7 +405,7 @@ int V4L2CameraProxy::vidioc_g_priority(V4L2CameraFile *file, enum v4l2_priority\n>  int V4L2CameraProxy::vidioc_s_priority(V4L2CameraFile *file, enum v4l2_priority *arg)\n>  {\n>         LOG(V4L2Compat, Debug)\n> -               << \"Servicing vidioc_s_priority fd = \" << file->efd();\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (*arg > V4L2_PRIORITY_RECORD)\n>                 return -EINVAL;\n> @@ -409,7 +420,8 @@ int V4L2CameraProxy::vidioc_s_priority(V4L2CameraFile *file, enum v4l2_priority\n>  \n>  int V4L2CameraProxy::vidioc_enuminput(V4L2CameraFile *file, struct v4l2_input *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_enuminput fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (arg->index != 0)\n>                 return -EINVAL;\n> @@ -426,7 +438,8 @@ int V4L2CameraProxy::vidioc_enuminput(V4L2CameraFile *file, struct v4l2_input *a\n>  \n>  int V4L2CameraProxy::vidioc_g_input(V4L2CameraFile *file, int *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_g_input fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         *arg = 0;\n>  \n> @@ -435,7 +448,8 @@ int V4L2CameraProxy::vidioc_g_input(V4L2CameraFile *file, int *arg)\n>  \n>  int V4L2CameraProxy::vidioc_s_input(V4L2CameraFile *file, int *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_s_input fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (*arg != 0)\n>                 return -EINVAL;\n> @@ -452,7 +466,8 @@ void V4L2CameraProxy::freeBuffers()\n>  \n>  int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuffers *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_reqbufs fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (!validateBufferType(arg->type) ||\n>             !validateMemoryType(arg->memory))\n> @@ -526,7 +541,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n>  \n>  int V4L2CameraProxy::vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_querybuf fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (arg->index >= bufferCount_)\n>                 return -EINVAL;\n> @@ -544,8 +560,9 @@ int V4L2CameraProxy::vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *a\n>  \n>  int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_qbuf, index = \"\n> -                              << arg->index << \" fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__\n> +               << \"(index=\" << arg->index << \")\";\n>  \n>         if (arg->index >= bufferCount_)\n>                 return -EINVAL;\n> @@ -575,7 +592,8 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n>  int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n>                                   Mutex *lock)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_dqbuf fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (arg->index >= bufferCount_)\n>                 return -EINVAL;\n> @@ -624,7 +642,8 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n>  \n>  int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_streamon fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (bufferCount_ == 0)\n>                 return -EINVAL;\n> @@ -648,7 +667,8 @@ int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg)\n>  \n>  int V4L2CameraProxy::vidioc_streamoff(V4L2CameraFile *file, int *arg)\n>  {\n> -       LOG(V4L2Compat, Debug) << \"Servicing vidioc_streamoff fd = \" << file->efd();\n> +       LOG(V4L2Compat, Debug)\n> +               << \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>         if (!validateBufferType(*arg))\n>                 return -EINVAL;\n> @@ -709,7 +729,7 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long request, void *ar\n>         int ret;\n>         switch (request) {\n>         case VIDIOC_QUERYCAP:\n> -               ret = vidioc_querycap(static_cast<struct v4l2_capability *>(arg));\n> +               ret = vidioc_querycap(file, static_cast<struct v4l2_capability *>(arg));\n>                 break;\n>         case VIDIOC_ENUM_FRAMESIZES:\n>                 ret = vidioc_enum_framesizes(file, static_cast<struct v4l2_frmsizeenum *>(arg));\n> diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\n> index fa0a49e0439b..08f0295a92dd 100644\n> --- a/src/v4l2/v4l2_camera_proxy.h\n> +++ b/src/v4l2/v4l2_camera_proxy.h\n> @@ -29,8 +29,9 @@ public:\n>  \n>         int open(V4L2CameraFile *file);\n>         void close(V4L2CameraFile *file);\n> -       void *mmap(void *addr, size_t length, int prot, int flags, off64_t offset);\n> -       int munmap(void *addr, size_t length);\n> +       void *mmap(V4L2CameraFile *file, void *addr, size_t length, int prot,\n> +                  int flags, off64_t offset);\n> +       int munmap(V4L2CameraFile *file, void *addr, size_t length);\n>  \n>         int ioctl(V4L2CameraFile *file, unsigned long request, void *arg);\n>  \n> @@ -44,7 +45,7 @@ private:\n>         void updateBuffers();\n>         void freeBuffers();\n>  \n> -       int vidioc_querycap(struct v4l2_capability *arg);\n> +       int vidioc_querycap(V4L2CameraFile *file, struct v4l2_capability *arg);\n>         int vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg);\n>         int vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg);\n>         int vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg);\n> diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp\n> index ded568beb60e..0f7575c54b22 100644\n> --- a/src/v4l2/v4l2_compat_manager.cpp\n> +++ b/src/v4l2/v4l2_compat_manager.cpp\n> @@ -194,7 +194,8 @@ void *V4L2CompatManager::mmap(void *addr, size_t length, int prot, int flags,\n>         if (!file)\n>                 return fops_.mmap(addr, length, prot, flags, fd, offset);\n>  \n> -       void *map = file->proxy()->mmap(addr, length, prot, flags, offset);\n> +       void *map = file->proxy()->mmap(file.get(), addr, length, prot, flags,\n> +                                       offset);\n>         if (map == MAP_FAILED)\n>                 return map;\n>  \n> @@ -210,7 +211,7 @@ int V4L2CompatManager::munmap(void *addr, size_t length)\n>  \n>         V4L2CameraFile *file = device->second.get();\n>  \n> -       int ret = file->proxy()->munmap(addr, length);\n> +       int ret = file->proxy()->munmap(file, addr, length);\n>         if (ret < 0)\n>                 return ret;\n>  \n> -- \n> Regards,\n> \n> Laurent Pinchart\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 BB21CBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 10 Jan 2022 16:47:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6B92D60921;\n\tMon, 10 Jan 2022 17:47:00 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0AB6F6021A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Jan 2022 17:46:59 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BC281A50;\n\tMon, 10 Jan 2022 17:46:58 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"L0PTANVK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1641833218;\n\tbh=/0Bum8or1bbdeKKn4mf6LCLtX4pErOBHHPMvGX0x+2w=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=L0PTANVK/6iLqRNzmx20bla2nxHkhnn2PLYnBDP4ZqnvuWWy1e054hXoRJgzwhOVn\n\tDGE+FTSwcMboJPTlwp6CBj/lHr9LGFmPEQhfrHl4Kxpd7i38aJU0a6rI+Ryf9RSRqm\n\tkBuRgrq24tOSQjpnBLngyYH72hHy6137Pcil1pz8=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211228215951.32396-6-laurent.pinchart@ideasonboard.com>","References":"<20211228215951.32396-1-laurent.pinchart@ideasonboard.com>\n\t<20211228215951.32396-6-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 10 Jan 2022 16:46:55 +0000","Message-ID":"<164183321577.10801.15472912419250531733@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v1 5/5] v4l2: v4l2_camera_proxy: Use\n\tfile description in debug messages","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22033,"web_url":"https://patchwork.libcamera.org/comment/22033/","msgid":"<20220114110020.GG4255@pyrite.rasen.tech>","date":"2022-01-14T11:00:20","subject":"Re: [libcamera-devel] [PATCH v1 5/5] v4l2: v4l2_camera_proxy: Use\n\tfile description in debug messages","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Laurent,\n\nOn Tue, Dec 28, 2021 at 11:59:51PM +0200, Laurent Pinchart wrote:\n> Debug messages in V4L2CameraProxy print the numerical file descriptor,\n> which isn't very human-friendly. Replace it with the V4L2CameraFile\n> description that includes the full path. While at it, refactor the\n> messages to use __func__ instead of manually copying function names.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/v4l2/v4l2_camera_proxy.cpp   | 74 ++++++++++++++++++++------------\n>  src/v4l2/v4l2_camera_proxy.h     |  7 +--\n>  src/v4l2/v4l2_compat_manager.cpp |  5 ++-\n>  3 files changed, 54 insertions(+), 32 deletions(-)\n> \n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index 80e6624bc9b7..5ccf40b9692c 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -46,7 +46,8 @@ V4L2CameraProxy::V4L2CameraProxy(unsigned int index,\n>  \n>  int V4L2CameraProxy::open(V4L2CameraFile *file)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing open fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tMutexLocker locker(proxyMutex_);\n>  \n> @@ -80,7 +81,8 @@ int V4L2CameraProxy::open(V4L2CameraFile *file)\n>  \n>  void V4L2CameraProxy::close(V4L2CameraFile *file)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing close fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tMutexLocker locker(proxyMutex_);\n>  \n> @@ -94,10 +96,11 @@ void V4L2CameraProxy::close(V4L2CameraFile *file)\n>  \tvcam_->close();\n>  }\n>  \n> -void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags,\n> -\t\t\t    off64_t offset)\n> +void *V4L2CameraProxy::mmap(V4L2CameraFile *file, void *addr, size_t length,\n> +\t\t\t    int prot, int flags, off64_t offset)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing mmap\";\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tMutexLocker locker(proxyMutex_);\n>  \n> @@ -131,9 +134,10 @@ void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags,\n>  \treturn map;\n>  }\n>  \n> -int V4L2CameraProxy::munmap(void *addr, size_t length)\n> +int V4L2CameraProxy::munmap(V4L2CameraFile *file, void *addr, size_t length)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing munmap\";\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tMutexLocker locker(proxyMutex_);\n>  \n> @@ -233,9 +237,10 @@ void V4L2CameraProxy::updateBuffers()\n>  \t}\n>  }\n>  \n> -int V4L2CameraProxy::vidioc_querycap(struct v4l2_capability *arg)\n> +int V4L2CameraProxy::vidioc_querycap(V4L2CameraFile *file, struct v4l2_capability *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_querycap\";\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \t*arg = capabilities_;\n>  \n> @@ -244,7 +249,8 @@ int V4L2CameraProxy::vidioc_querycap(struct v4l2_capability *arg)\n>  \n>  int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_framesizes fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->pixel_format);\n>  \tPixelFormat format = v4l2Format.toPixelFormat();\n> @@ -267,7 +273,8 @@ int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_fr\n>  \n>  int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_fmt fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (!validateBufferType(arg->type) ||\n>  \t    arg->index >= streamConfig_.formats().pixelformats().size())\n> @@ -288,7 +295,8 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *\n>  \n>  int V4L2CameraProxy::vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_g_fmt fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (!validateBufferType(arg->type))\n>  \t\treturn -EINVAL;\n> @@ -331,7 +339,8 @@ int V4L2CameraProxy::tryFormat(struct v4l2_format *arg)\n>  \n>  int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_s_fmt fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (!validateBufferType(arg->type))\n>  \t\treturn -EINVAL;\n> @@ -361,7 +370,8 @@ int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  \n>  int V4L2CameraProxy::vidioc_try_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_try_fmt fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (!validateBufferType(arg->type))\n>  \t\treturn -EINVAL;\n> @@ -384,7 +394,8 @@ enum v4l2_priority V4L2CameraProxy::maxPriority()\n>  \n>  int V4L2CameraProxy::vidioc_g_priority(V4L2CameraFile *file, enum v4l2_priority *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_g_priority fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \t*arg = maxPriority();\n>  \n> @@ -394,7 +405,7 @@ int V4L2CameraProxy::vidioc_g_priority(V4L2CameraFile *file, enum v4l2_priority\n>  int V4L2CameraProxy::vidioc_s_priority(V4L2CameraFile *file, enum v4l2_priority *arg)\n>  {\n>  \tLOG(V4L2Compat, Debug)\n> -\t\t<< \"Servicing vidioc_s_priority fd = \" << file->efd();\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (*arg > V4L2_PRIORITY_RECORD)\n>  \t\treturn -EINVAL;\n> @@ -409,7 +420,8 @@ int V4L2CameraProxy::vidioc_s_priority(V4L2CameraFile *file, enum v4l2_priority\n>  \n>  int V4L2CameraProxy::vidioc_enuminput(V4L2CameraFile *file, struct v4l2_input *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enuminput fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (arg->index != 0)\n>  \t\treturn -EINVAL;\n> @@ -426,7 +438,8 @@ int V4L2CameraProxy::vidioc_enuminput(V4L2CameraFile *file, struct v4l2_input *a\n>  \n>  int V4L2CameraProxy::vidioc_g_input(V4L2CameraFile *file, int *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_g_input fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \t*arg = 0;\n>  \n> @@ -435,7 +448,8 @@ int V4L2CameraProxy::vidioc_g_input(V4L2CameraFile *file, int *arg)\n>  \n>  int V4L2CameraProxy::vidioc_s_input(V4L2CameraFile *file, int *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_s_input fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (*arg != 0)\n>  \t\treturn -EINVAL;\n> @@ -452,7 +466,8 @@ void V4L2CameraProxy::freeBuffers()\n>  \n>  int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuffers *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_reqbufs fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (!validateBufferType(arg->type) ||\n>  \t    !validateMemoryType(arg->memory))\n> @@ -526,7 +541,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n>  \n>  int V4L2CameraProxy::vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_querybuf fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (arg->index >= bufferCount_)\n>  \t\treturn -EINVAL;\n> @@ -544,8 +560,9 @@ int V4L2CameraProxy::vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *a\n>  \n>  int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_qbuf, index = \"\n> -\t\t\t       << arg->index << \" fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__\n> +\t\t<< \"(index=\" << arg->index << \")\";\n>  \n>  \tif (arg->index >= bufferCount_)\n>  \t\treturn -EINVAL;\n> @@ -575,7 +592,8 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)\n>  int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n>  \t\t\t\t  Mutex *lock)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_dqbuf fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (arg->index >= bufferCount_)\n>  \t\treturn -EINVAL;\n> @@ -624,7 +642,8 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg,\n>  \n>  int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_streamon fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (bufferCount_ == 0)\n>  \t\treturn -EINVAL;\n> @@ -648,7 +667,8 @@ int V4L2CameraProxy::vidioc_streamon(V4L2CameraFile *file, int *arg)\n>  \n>  int V4L2CameraProxy::vidioc_streamoff(V4L2CameraFile *file, int *arg)\n>  {\n> -\tLOG(V4L2Compat, Debug) << \"Servicing vidioc_streamoff fd = \" << file->efd();\n> +\tLOG(V4L2Compat, Debug)\n> +\t\t<< \"[\" << file->description() << \"] \" << __func__ << \"()\";\n>  \n>  \tif (!validateBufferType(*arg))\n>  \t\treturn -EINVAL;\n> @@ -709,7 +729,7 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long request, void *ar\n>  \tint ret;\n>  \tswitch (request) {\n>  \tcase VIDIOC_QUERYCAP:\n> -\t\tret = vidioc_querycap(static_cast<struct v4l2_capability *>(arg));\n> +\t\tret = vidioc_querycap(file, static_cast<struct v4l2_capability *>(arg));\n>  \t\tbreak;\n>  \tcase VIDIOC_ENUM_FRAMESIZES:\n>  \t\tret = vidioc_enum_framesizes(file, static_cast<struct v4l2_frmsizeenum *>(arg));\n> diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\n> index fa0a49e0439b..08f0295a92dd 100644\n> --- a/src/v4l2/v4l2_camera_proxy.h\n> +++ b/src/v4l2/v4l2_camera_proxy.h\n> @@ -29,8 +29,9 @@ public:\n>  \n>  \tint open(V4L2CameraFile *file);\n>  \tvoid close(V4L2CameraFile *file);\n> -\tvoid *mmap(void *addr, size_t length, int prot, int flags, off64_t offset);\n> -\tint munmap(void *addr, size_t length);\n> +\tvoid *mmap(V4L2CameraFile *file, void *addr, size_t length, int prot,\n> +\t\t   int flags, off64_t offset);\n> +\tint munmap(V4L2CameraFile *file, void *addr, size_t length);\n>  \n>  \tint ioctl(V4L2CameraFile *file, unsigned long request, void *arg);\n>  \n> @@ -44,7 +45,7 @@ private:\n>  \tvoid updateBuffers();\n>  \tvoid freeBuffers();\n>  \n> -\tint vidioc_querycap(struct v4l2_capability *arg);\n> +\tint vidioc_querycap(V4L2CameraFile *file, struct v4l2_capability *arg);\n>  \tint vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg);\n>  \tint vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg);\n>  \tint vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg);\n> diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp\n> index ded568beb60e..0f7575c54b22 100644\n> --- a/src/v4l2/v4l2_compat_manager.cpp\n> +++ b/src/v4l2/v4l2_compat_manager.cpp\n> @@ -194,7 +194,8 @@ void *V4L2CompatManager::mmap(void *addr, size_t length, int prot, int flags,\n>  \tif (!file)\n>  \t\treturn fops_.mmap(addr, length, prot, flags, fd, offset);\n>  \n> -\tvoid *map = file->proxy()->mmap(addr, length, prot, flags, offset);\n> +\tvoid *map = file->proxy()->mmap(file.get(), addr, length, prot, flags,\n> +\t\t\t\t\toffset);\n>  \tif (map == MAP_FAILED)\n>  \t\treturn map;\n>  \n> @@ -210,7 +211,7 @@ int V4L2CompatManager::munmap(void *addr, size_t length)\n>  \n>  \tV4L2CameraFile *file = device->second.get();\n>  \n> -\tint ret = file->proxy()->munmap(addr, length);\n> +\tint ret = file->proxy()->munmap(file, addr, length);\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>  \n> -- \n> Regards,\n> \n> Laurent Pinchart\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 D8107BE086\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Jan 2022 11:00:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 793736021A;\n\tFri, 14 Jan 2022 12:00:29 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 257CA6017F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Jan 2022 12:00:27 +0100 (CET)","from pyrite.rasen.tech (h175-177-042-148.catv02.itscom.jp\n\t[175.177.42.148])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CD24BA2A;\n\tFri, 14 Jan 2022 12:00:25 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"uWOSnVkV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1642158026;\n\tbh=Bkn7ELNTQ+QO9onRH7Yq2tKn7L3hR9VGacXps1BdUS0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=uWOSnVkVMNCSc8fEXNvty3rsGbkQtYWGt6oV3jYz97IT2bAE7NyR7GuqkV92DHvmr\n\tDZakxPXmF6ajW9Y+asCs4+20fGW7BPs0ARq/6FtUNgveCADAIEDyHV3EsGd0Pms1Hi\n\todd+LKRTrzOIgQtLyJ1EyeGe4vVCGLDQsXoEd7C8=","Date":"Fri, 14 Jan 2022 20:00:20 +0900","From":"paul.elder@ideasonboard.com","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20220114110020.GG4255@pyrite.rasen.tech>","References":"<20211228215951.32396-1-laurent.pinchart@ideasonboard.com>\n\t<20211228215951.32396-6-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20211228215951.32396-6-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v1 5/5] v4l2: v4l2_camera_proxy: Use\n\tfile description in debug messages","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@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]