{"id":4005,"url":"https://patchwork.libcamera.org/api/1.1/covers/4005/?format=json","web_url":"https://patchwork.libcamera.org/cover/4005/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20200609232323.29628-1-laurent.pinchart@ideasonboard.com>","date":"2020-06-09T23:23:16","name":"[libcamera-devel,v2,0/7] Introduce formats:: namespace for libcamera pixel formats","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/cover/4005/mbox/","series":[{"id":982,"url":"https://patchwork.libcamera.org/api/1.1/series/982/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=982","date":"2020-06-09T23:23:16","name":"Introduce formats:: namespace for libcamera pixel formats","version":2,"mbox":"https://patchwork.libcamera.org/series/982/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/4005/comments/","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 012846002B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jun 2020 01:23:47 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EDFC9291\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jun 2020 01:23:46 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"i7KWI/NM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591745027;\n\tbh=9JYggqNsg4n/VoJ7aNLf6wnkadTwgGpMP9vG9Xp7Wn4=;\n\th=From:To:Subject:Date:From;\n\tb=i7KWI/NMg24mOmgH8IrvWvIAJgmOMmpQCGUygYAGphq8urQ44DokOpzfNNvtHmzT1\n\tjHik5Tce7SLo2pEx65MBrRfo7Avz3p849vAYsA0D6d1l1YCPZ+hWGM+81YZidKKzDN\n\tmvYHj00U8kaM9+H8O0ImpjZ61w6AhtQnTjp0Dl38=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 10 Jun 2020 02:23:16 +0300","Message-Id":"<20200609232323.29628-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 0/7] Introduce formats:: namespace for\n\tlibcamera pixel formats","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":"Tue, 09 Jun 2020 23:23:48 -0000"},"content":"Hello,\n\nThis patch series is an attempt to fix a problem caused by a direct\ndependency on drm_fourcc.h in the libcamera public API.\n\nlibcamera specifies pixel formats using the DRM pixel format FourCC and\nmodifiers. This requires both internal code and applications to include\ndrm_fourcc.h. For internal code, we carry a copy of the header to avoid\nexternal dependencies. For third-party applications, however,\ndrm_fourcc.h needs to be accessible from system includes. It turns out\nthat the file is shipped by two different packages:\n\n- libdrm, which typically installs it in /usr/include/libdrm/\n- kernel headers or libc headers, which typically installs it in\n  /usr/include/drm\n\nWe don't want to make libdrm a dependency for applications using\nlibcamera. Unfortunately, depending on drm_fourcc.h being provided by\nthe distribution kernel headers or libc headers package causes issues,\nas not all distributions install the header in /usr/include/drm/. Ubuntu\nand Gentoo do, but Debian and Arch don't.\n\nThe best option may be to remove the dependency on the macros provided\nby drm_fourcc.h, while keeping the pixel format numerical values\nidentical. This is what this patch series attempts to do.\n\nPatch 1/7 creates a new libcamera::formats:: namespace and populates it\nwith constants (in the form of constexpr) for all supported pixel\nformats. The values are automatically generated from a list of formats,\nstored in formats.yaml, and the numerical values for the DRM FourCCs and\nmodifiers are extracted from drm_fourcc.h.\n\nPatches 2/7 to 7/8 then replace usage of the DRM_FORMAT_* macros through\nthe code.\n\nLaurent Pinchart (7):\n  libcamera: Define constants for pixel formats in the public API\n  gst: Replace explicit DRM FourCCs with libcamera formats\n  qcam: Replace explicit DRM FourCCs with libcamera formats\n  v4l2: Replace explicit DRM FourCCs with libcamera formats\n  test: Replace explicit DRM FourCCs with libcamera formats\n  libcamera: pipeline: Replace explicit DRM FourCCs with libcamera\n    formats\n  libcamera: Replace explicit DRM FourCCs with libcamera formats\n\n include/libcamera/formats.h.in                |  44 ++++++\n include/libcamera/gen-formats.py              | 118 ++++++++++++++\n include/libcamera/meson.build                 |  22 +++\n include/libcamera/pixel_format.h              |   2 -\n src/android/camera_device.cpp                 |   9 +-\n src/gstreamer/gstlibcamera-utils.cpp          |  62 ++++----\n src/libcamera/formats.cpp                     | 148 +++++++++---------\n src/libcamera/formats.yaml                    | 124 +++++++++++++++\n src/libcamera/pipeline/ipu3/ipu3.cpp          |  16 +-\n .../pipeline/raspberrypi/raspberrypi.cpp      |  10 +-\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  19 +--\n src/libcamera/pipeline/vimc/vimc.cpp          |  11 +-\n src/libcamera/pixel_format.cpp                |   4 +-\n src/libcamera/v4l2_pixelformat.cpp            |  83 +++++-----\n src/qcam/dng_writer.cpp                       |  17 +-\n src/qcam/format_converter.cpp                 |  36 +++--\n src/qcam/viewfinder.cpp                       |  10 +-\n src/v4l2/v4l2_camera_proxy.cpp                |  29 ++--\n test/v4l2_videodevice/buffer_cache.cpp        |   3 +-\n 19 files changed, 540 insertions(+), 227 deletions(-)\n create mode 100644 include/libcamera/formats.h.in\n create mode 100755 include/libcamera/gen-formats.py\n create mode 100644 src/libcamera/formats.yaml"}