[{"id":1609,"web_url":"https://patchwork.libcamera.org/comment/1609/","msgid":"<20190517185136.GD15535@bigcity.dyn.berto.se>","date":"2019-05-17T18:51:36","subject":"Re: [libcamera-devel] [PATCH v4 00/11] libcamerea: Add support for\n\texclusive access to cameras between processes","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"I addressed Laurents comments and pushed this series.\n\nOn 2019-05-17 02:54:36 +0200, Niklas Söderlund wrote:\n> Hi,\n> \n> This series aims to solve mutably exclusive access to a  camera between\n> two or more processes by the use of lockf(). In the process of adding\n> support for this the MediaDevice implementation is cleaned up a bit and\n> stricter call patterns are enforced. At the same time a small load is\n> taken of pipeline handler implementations.\n> \n> As a camera might share resources with other cameras from the same\n> pipeline handler instance I have chosen to put the granularity of the\n> lock at the media device level. When a camera is acquired by an\n> applications all media devices the pipeline handler it belongs to have\n> claimed are locked and becomes unavailable to other processes. Other\n> process can still enumerate locked media devices and list all cameras\n> they provide but they can't use any of the cameras who are backed by a\n> locked media device.\n> \n> Patches 1/11 -- 7/11 deals with tidying up and adding more restrictions\n> to the MediaDevices and how they handled inside pipeline handlers. While\n> patches 8/11 -- 11/11 adds the new locking scheme which depends on the\n> new stricter handling of media devices.\n> \n> * Changes since v3\n> - Renamed media_device_basic.cpp to media_device_acquire.cpp.\n> - Improved documentation.\n> - Minor code improvements.\n> \n> * Changes since v2\n> - Moved cleanup from 2/11 into 1/11 hence dropping all tags from 1/11 as\n>   it was a big move.\n> - Iterate of MediaDevice references in 10/11.\n> - Fixed spelling in commit messages.\n> \n> * Changes since v1\n> - Spelling in commit messages.\n> - Explicitly prohibit nested locking inside the same libcamera instance,\n>   thanks Kieran for spotting this!\n> \n> Niklas Söderlund (11):\n>   libcamera: Always check return value of MediaDevice::acquire()\n>   libcamera: media_device: Open and close media device inside populate()\n>   libcamera: media_device: Only read device information in populate()\n>   libcamera: media_device: Handle media device fd in acquire() and\n>     release()\n>   test: media_device: Create a common MediaDeviceTest base class\n>   test: media_device: Add test for acquire() and release()\n>   libcamera: media_device: Make open() and close() private\n>   libcamera: media_device: Add functions to lock device for other\n>     processes\n>   libcamera: pipeline_handler: Keep track of MediaDevice\n>   libcamera: pipeline_handler: Add functions to lock a whole pipeline\n>   libcamera: camera: Lock the pipeline handler in acquire()\n> \n>  src/libcamera/camera.cpp                      |  16 +-\n>  src/libcamera/device_enumerator.cpp           |   8 +-\n>  src/libcamera/include/media_device.h          |  10 +-\n>  src/libcamera/include/pipeline_handler.h      |   7 +\n>  src/libcamera/media_device.cpp                | 243 +++++++++++-------\n>  src/libcamera/pipeline/ipu3/ipu3.cpp          |  71 +----\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  58 ++---\n>  src/libcamera/pipeline/uvcvideo.cpp           |  24 +-\n>  src/libcamera/pipeline/vimc.cpp               |  19 +-\n>  src/libcamera/pipeline_handler.cpp            |  68 +++++\n>  test/media_device/media_device_acquire.cpp    |  33 +++\n>  test/media_device/media_device_link_test.cpp  |  74 ++----\n>  test/media_device/media_device_print_test.cpp |  17 --\n>  test/media_device/media_device_test.cpp       |  36 +++\n>  test/media_device/media_device_test.h         |  34 +++\n>  test/media_device/meson.build                 |  10 +-\n>  test/pipeline/ipu3/ipu3_pipeline_test.cpp     |   5 -\n>  test/v4l2_device/v4l2_device_test.cpp         |   4 -\n>  test/v4l2_subdevice/v4l2_subdevice_test.cpp   |  17 +-\n>  19 files changed, 422 insertions(+), 332 deletions(-)\n>  create mode 100644 test/media_device/media_device_acquire.cpp\n>  create mode 100644 test/media_device/media_device_test.cpp\n>  create mode 100644 test/media_device/media_device_test.h\n> \n> -- \n> 2.21.0\n>","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","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 5B0F260DE9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 May 2019 20:51:39 +0200 (CEST)","by mail-lf1-x142.google.com with SMTP id n134so6010663lfn.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 May 2019 11:51:39 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\te19sm1155211ljj.62.2019.05.17.11.51.36\n\tfor <libcamera-devel@lists.libcamera.org>\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 17 May 2019 11:51:37 -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:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=yqznTbDufg/+vRKIr+xLtE4O24vRF2QGMPbdLjJdWp0=;\n\tb=N8y2Jc2cnZqev2NSpU9GhV47StI5tT5A4SNXmZ5xybgNmRW4wS4wC4ARdViMlOeTm0\n\tiXj062asHxjQW0eV47fJXeugjAV49rpRCKIQJ7g2n66Hj1n32wsy4p0VNWaKUMQYkWRk\n\tBC6TMRRdzMikh7AR9drycT1SBQ5LJgtZ+pSURZ301caiL964nB7o0z3TObPpvupCStKU\n\tO7JoE86n2++QlO6bE0P4PQaxxrIAVHnXMU6xnZPUnMnZNfi0bHfPSy7mm8Y2NnQ+Vq8k\n\t4Z9fVzLMjOh7tgI240IFr0klRTRR2TiXcXr/IyDIq1cyR5eHWIgDSDASL0JWkQcU8rS4\n\tCL+Q==","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:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=yqznTbDufg/+vRKIr+xLtE4O24vRF2QGMPbdLjJdWp0=;\n\tb=bROhW/anVHuXVXgBHKHRIrvD7QnEIqpf88CTGcasGzGZdAJ71pilbvQNXuYw0Q2/C5\n\tI4fq6YOsHuH5FglVXgbjofSovKoTat5ej7rDm6mYf7HvCgizRbJsWrcmL5W7DKGEjxcg\n\tdA5znysOqD3M4SdqKt4W+VmfegPUwmzCYXxNt2iSNlbLSGM17QSB1d9MU71JWXNR90wR\n\t8YEBJt2jDeji9WsGMr5koU/zPZRiscoKK19dKyd+NnrQszhnuAZqsWSG/S2daxFDLqrW\n\t5x9l07n0wzQdOVM4CQcZz+vaz0F7f2HjErinqT5JQ7JmEeGyMPgKIrAZNrogU2YZAhTW\n\t46qA==","X-Gm-Message-State":"APjAAAVx/cWhv8rbfTQvuo0hTMzAeLg2xiMdQVqsF22j9Qfub2KO7ckb\n\tsk7SdLc9eTCc433M9SlF6Edx+CRaxjo=","X-Google-Smtp-Source":"APXvYqygeK/gZH5aQ4d83QqjP6cx3Oa3jeg6YydiXdq2UEXRNXSIL5nNl+lt8JJsoP6ClJMEeURj6g==","X-Received":"by 2002:ac2:528f:: with SMTP id\n\tq15mr10764293lfm.37.1558119098327; \n\tFri, 17 May 2019 11:51:38 -0700 (PDT)","Date":"Fri, 17 May 2019 20:51:36 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190517185136.GD15535@bigcity.dyn.berto.se>","References":"<20190517005447.27171-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190517005447.27171-1-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v4 00/11] libcamerea: Add support for\n\texclusive access to cameras between processes","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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, 17 May 2019 18:51:39 -0000"}}]