{"id":19079,"url":"https://patchwork.libcamera.org/api/covers/19079/?format=json","web_url":"https://patchwork.libcamera.org/cover/19079/","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":"<20230923-gralloc-api-v4-v3-0-9a9e039284ba@baylibre.com>","date":"2023-09-23T16:23:30","name":"[libcamera-devel,v3,0/4] android: switch over to modern gralloc API via libui","submitter":{"id":153,"url":"https://patchwork.libcamera.org/api/people/153/?format=json","name":"Mattijs Korpershoek","email":"mkorpershoek@baylibre.com"},"mbox":"https://patchwork.libcamera.org/cover/19079/mbox/","series":[{"id":4035,"url":"https://patchwork.libcamera.org/api/series/4035/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4035","date":"2023-09-23T16:23:30","name":"android: switch over to modern gralloc API via libui","version":3,"mbox":"https://patchwork.libcamera.org/series/4035/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/19079/comments/","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 D9BB2C326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 23 Sep 2023 16:23:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 49B4962947;\n\tSat, 23 Sep 2023 18:23:41 +0200 (CEST)","from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 777FE61DE7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 23 Sep 2023 18:23:39 +0200 (CEST)","by mail-wr1-x42a.google.com with SMTP id\n\tffacd0b85a97d-323168869daso1227400f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 23 Sep 2023 09:23:39 -0700 (PDT)","from [192.168.0.39] ([2a01:e0a:324:38a0:25d4:3d10:65f9:654e])\n\tby smtp.gmail.com with ESMTPSA id\n\ty7-20020adfd087000000b00317f70240afsm7200595wrh.27.2023.09.23.09.23.37\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 23 Sep 2023 09:23:38 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1695486221;\n\tbh=CJkd4/HujH4MapyzLNa+a40lqOK5UpUqGXZkWwwUKO4=;\n\th=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=OlqnRSKPtGtFcbG924tH1nKmRmET5k4uQlUzsl8x/Xlz3cgsjQEHBOdKIFDc5Guso\n\tz4JOFbl0smLVgUocNmcPSzNAQO9yw1tqe9d9tPau0zXNKpOEV/TCSeEtHulx7A9SzB\n\tlWcNBZ5eo+Ueyez4Rc0KwcVknJvZpPEZ98OpwlYRD8z7Q21cyLMlpUy7xDuc4CoD23\n\tXFASGURwEsjzHwl6DmSpkGFB24FdyHjrjn0qnBEt5MmGVmG+6kLVDTYbLgzPLtu8ys\n\tC7GIBSCjd8yM+Bs79B7k/JdRacTmRDF1ZC3yai0o3qliGxHN5fRgis8bLP+hJXcsPK\n\ttfS8wtF8nNy6A==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695486219;\n\tx=1696091019; darn=lists.libcamera.org; \n\th=cc:to:content-transfer-encoding:mime-version:message-id:date\n\t:subject:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=A/5JxLmrioJouv3/xjm/uew22LyMRzLC4kxO1jZLlUQ=;\n\tb=yD9pm47paP2c6/1fmHYqEngKTFSXbC5fyRl5XI3F4hLVN2YwZXOq2wEPAFfGq44J7u\n\tuOdauhn3NmJpGB5ggZtWHKYBqo0uQKXiqHNrp/hDZdUjnYZdYdNX7Wm1uRvZ5xDEcrBI\n\tXrWNaVpQNQV7pXvBB7qYrSstfbcGDwqsH0KAeMPWlj/g6OhaRl4bOWVHqprsIivcYeGh\n\tr2TfKwo6J4kfDiM6NC/45prxO+/2xlLJdEW2sEfyJKjOT+XEcKB04v6m01PyHZQzO477\n\t1Kf7TC6FrKE8Qi2yDL05A3HhrmJJ1gw0iHOKbRocESEIK+Z1Q6JbsM4BIjA/r4RRHw5i\n\tzqFQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20230601.gappssmtp.com\n\theader.i=@baylibre-com.20230601.gappssmtp.com header.b=\"yD9pm47p\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1695486219; x=1696091019;\n\th=cc:to:content-transfer-encoding:mime-version:message-id:date\n\t:subject:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=A/5JxLmrioJouv3/xjm/uew22LyMRzLC4kxO1jZLlUQ=;\n\tb=gz6ZTUNVT5YKRj3Cpg121R5b+3PAkkj44HHXsVjkaYJsVlGiRRuPkaud91XscYeKpe\n\tm7MhurnSBUqDNg9b9ciegaMEyuqRkVC5cOXicfzuQaLezgwJqE0pU+pRHLFS091RQoLe\n\txwGlT+wS6f95mV8zFawFWvLdhtClN2dTkFGEiUqFFlKHTXbTcOEHbOdvPWV/z+NlGh+L\n\tH0M9fpgx2RT21gttrp5OK87NvqpCKeciXiliR1aHVXYA+qEx0k4sx+1x0McRWyZLlDIb\n\tscjCGvxMqTJ+gVzFVf/6BcjAMOSaxpch/wKY/FR0TXlp8rzRvViC/muHlEHM/nrXRNI8\n\tpJHA==","X-Gm-Message-State":"AOJu0Yyf9Cgec6TxkugKikF9rd5z0KEhACBY7c3h9KepADxvt1lHBl2v\n\tpxnJOdRrjUTolFiOYFhQZsCX4Q==","X-Google-Smtp-Source":"AGHT+IEduaww7mhnWDvSFWGTP9dr1wy5kY397W15gg/tYK/djyClyT6860Wouz2Fi/GuL5ROq4baaQ==","X-Received":"by 2002:a5d:4dc3:0:b0:31f:fc6c:8b75 with SMTP id\n\tf3-20020a5d4dc3000000b0031ffc6c8b75mr2063512wru.7.1695486218363; \n\tSat, 23 Sep 2023 09:23:38 -0700 (PDT)","Date":"Sat, 23 Sep 2023 18:23:30 +0200","Message-Id":"<20230923-gralloc-api-v4-v3-0-9a9e039284ba@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","X-B4-Tracking":"v=1; b=H4sIAAIRD2UC/32NQQ6DIBBFr2JYdxoEarGr3qPpYsRRSVQMGFJjv\n\tHvR7lx0+Wby31tZIG8psEe2Mk/RBuvGBPKSMdPh2BLYOjETXEiuhYLWY987AzhZiApISq2bWhb\n\tKFCyNKgwElcfRdPtswDCT3x+Tp8Z+jtLrnbizYXZ+OcIx36+/RpmLcyPmwIE3misuak13fFa49\n\tLbydDVuYLstiv8GkQykb2WNhWxKbU6Gbdu+Xu8usgoBAAA=","To":"libcamera-devel@lists.libcamera.org","X-Mailer":"b4 0.12.4-dev-6aa5d","Subject":"[libcamera-devel] [PATCH v3 0/4] android: switch over to modern\n\tgralloc API via libui","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>","From":"Mattijs Korpershoek via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Mattijs Korpershoek <mkorpershoek@baylibre.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tGuillaume La Roque <glaroque@baylibre.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"gralloc.h is a very old API that has been deprecated at least since\nAndroid P (9).\n\nDevices are encouraged to switch over to HIDL interface named\nandroid.hardware.graphics.allocator@<VERSION>, where <VERSION> can be\n2.0 ,3.0 or 4.0.\n\nThis is mandatory since Android Q (10) [1]\n\nFortunately, Android provides an abstraction on top of\nandroid.hardware.graphics.allocator which is compatible with each\nversion.\nThis abstraction is implemented in libui, which is available in the\nVNDK.\n\nImport all necessary headers from AOSP and switch over the\ngeneric_frame_buffer_allocator to use GraphicBufferAllocator.\n\nThis series has been build-tested on a linux host and functionally\ntested on an AM62x SK EVM with Android 13. (preview and capture).\n\n[1] https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/main/compatibility_matrices/compatibility_matrix.4.xml#195\n\nSigned-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n---\nChanges in v3:\n- Fixed patch 3 missing whitespace (Jacopo)\n- Added libui meson import build in patch 3 (more consistent) (Jacopo)\n- Removed member reference to GraphicBufferAllocator in patch 4 (Jacopo)\n- Link to v2: https://lists.libcamera.org/pipermail/libcamera-devel/2023-September/038942.html\n\nChanges in v2:\n- Dropped additional ; in graphic_buffer_allocator_stub.cpp. (Kieran)\n- Surrounded problematic includes with #pragma to avoid clang compile\n  errors related to -Wextra-semi. (Kieran)\n- Link to v1: https://lists.libcamera.org/pipermail/libcamera-devel/2023-September/038927.html\n\nTested on linux with:\nCC=clang CXX=clang++ meson setup build -Dandroid=enabled -Dandroid_platform=generic\nninja -C build\nAnd clang version clang++ (clang 16.0.6 \"clang version 16.0.6 (Fedora 16.0.6-2.fc38)\")\n\n---\nMattijs Korpershoek (4):\n      android: Import libutils/libui headers from vndk v33\n      android: Import GraphicBufferAllocator header from vndk v33\n      android: Stub GraphicBufferAllocator for build tests\n      android: mm: generic: Use GraphicBufferAllocator instead of gralloc.h\n\n .../libs/ui/include/ui/GraphicBufferAllocator.h    |  81 ++++++++\n .../native/libs/ui/include/ui/PixelFormat.h        |  75 +++++++\n include/android/meson.build                        |   2 +\n .../system/core/libutils/include/utils/Compat.h    |  94 +++++++++\n .../system/core/libutils/include/utils/Errors.h    |  78 ++++++++\n .../system/core/libutils/include/utils/Mutex.h     | 219 +++++++++++++++++++++\n .../system/core/libutils/include/utils/Singleton.h | 102 ++++++++++\n .../system/core/libutils/include/utils/Timers.h    | 103 ++++++++++\n src/android/mm/generic_frame_buffer_allocator.cpp  |  68 +++----\n src/android/mm/graphic_buffer_allocator_stub.cpp   |  54 +++++\n src/android/mm/libhardware_stub.c                  |  17 --\n src/android/mm/meson.build                         |  11 +-\n 12 files changed, 835 insertions(+), 69 deletions(-)\n---\nbase-commit: 1d616141420d1f51e5999d758e3e0cc721a46290\nchange-id: 20230824-gralloc-api-v4-e3388fd364c6\n\nBest regards,"}