From patchwork Sat Sep 23 16:23:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 19079 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D9BB2C326B for ; Sat, 23 Sep 2023 16:23:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 49B4962947; Sat, 23 Sep 2023 18:23:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1695486221; bh=CJkd4/HujH4MapyzLNa+a40lqOK5UpUqGXZkWwwUKO4=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=OlqnRSKPtGtFcbG924tH1nKmRmET5k4uQlUzsl8x/Xlz3cgsjQEHBOdKIFDc5Guso z4JOFbl0smLVgUocNmcPSzNAQO9yw1tqe9d9tPau0zXNKpOEV/TCSeEtHulx7A9SzB lWcNBZ5eo+Ueyez4Rc0KwcVknJvZpPEZ98OpwlYRD8z7Q21cyLMlpUy7xDuc4CoD23 XFASGURwEsjzHwl6DmSpkGFB24FdyHjrjn0qnBEt5MmGVmG+6kLVDTYbLgzPLtu8ys C7GIBSCjd8yM+Bs79B7k/JdRacTmRDF1ZC3yai0o3qliGxHN5fRgis8bLP+hJXcsPK tfS8wtF8nNy6A== Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 777FE61DE7 for ; Sat, 23 Sep 2023 18:23:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="yD9pm47p"; dkim-atps=neutral Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-323168869daso1227400f8f.2 for ; Sat, 23 Sep 2023 09:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695486219; x=1696091019; darn=lists.libcamera.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=A/5JxLmrioJouv3/xjm/uew22LyMRzLC4kxO1jZLlUQ=; b=yD9pm47paP2c6/1fmHYqEngKTFSXbC5fyRl5XI3F4hLVN2YwZXOq2wEPAFfGq44J7u uOdauhn3NmJpGB5ggZtWHKYBqo0uQKXiqHNrp/hDZdUjnYZdYdNX7Wm1uRvZ5xDEcrBI XrWNaVpQNQV7pXvBB7qYrSstfbcGDwqsH0KAeMPWlj/g6OhaRl4bOWVHqprsIivcYeGh r2TfKwo6J4kfDiM6NC/45prxO+/2xlLJdEW2sEfyJKjOT+XEcKB04v6m01PyHZQzO477 1Kf7TC6FrKE8Qi2yDL05A3HhrmJJ1gw0iHOKbRocESEIK+Z1Q6JbsM4BIjA/r4RRHw5i zqFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695486219; x=1696091019; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A/5JxLmrioJouv3/xjm/uew22LyMRzLC4kxO1jZLlUQ=; b=gz6ZTUNVT5YKRj3Cpg121R5b+3PAkkj44HHXsVjkaYJsVlGiRRuPkaud91XscYeKpe m7MhurnSBUqDNg9b9ciegaMEyuqRkVC5cOXicfzuQaLezgwJqE0pU+pRHLFS091RQoLe xwGlT+wS6f95mV8zFawFWvLdhtClN2dTkFGEiUqFFlKHTXbTcOEHbOdvPWV/z+NlGh+L H0M9fpgx2RT21gttrp5OK87NvqpCKeciXiliR1aHVXYA+qEx0k4sx+1x0McRWyZLlDIb scjCGvxMqTJ+gVzFVf/6BcjAMOSaxpch/wKY/FR0TXlp8rzRvViC/muHlEHM/nrXRNI8 pJHA== X-Gm-Message-State: AOJu0Yyf9Cgec6TxkugKikF9rd5z0KEhACBY7c3h9KepADxvt1lHBl2v pxnJOdRrjUTolFiOYFhQZsCX4Q== X-Google-Smtp-Source: AGHT+IEduaww7mhnWDvSFWGTP9dr1wy5kY397W15gg/tYK/djyClyT6860Wouz2Fi/GuL5ROq4baaQ== X-Received: by 2002:a5d:4dc3:0:b0:31f:fc6c:8b75 with SMTP id f3-20020a5d4dc3000000b0031ffc6c8b75mr2063512wru.7.1695486218363; Sat, 23 Sep 2023 09:23:38 -0700 (PDT) Received: from [192.168.0.39] ([2a01:e0a:324:38a0:25d4:3d10:65f9:654e]) by smtp.gmail.com with ESMTPSA id y7-20020adfd087000000b00317f70240afsm7200595wrh.27.2023.09.23.09.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 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 X-B4-Tracking: v=1; b=H4sIAAIRD2UC/32NQQ6DIBBFr2JYdxoEarGr3qPpYsRRSVQMGFJjv HvR7lx0+Wby31tZIG8psEe2Mk/RBuvGBPKSMdPh2BLYOjETXEiuhYLWY987AzhZiApISq2bWhb KFCyNKgwElcfRdPtswDCT3x+Tp8Z+jtLrnbizYXZ+OcIx36+/RpmLcyPmwIE3misuak13fFa49 LbydDVuYLstiv8GkQykb2WNhWxKbU6Gbdu+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 gralloc API via libui X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Mattijs Korpershoek via libcamera-devel From: Mattijs Korpershoek Reply-To: Mattijs Korpershoek Cc: Jacopo Mondi , Guillaume La Roque Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" gralloc.h is a very old API that has been deprecated at least since Android P (9). Devices are encouraged to switch over to HIDL interface named android.hardware.graphics.allocator@, where can be 2.0 ,3.0 or 4.0. This is mandatory since Android Q (10) [1] Fortunately, Android provides an abstraction on top of android.hardware.graphics.allocator which is compatible with each version. This abstraction is implemented in libui, which is available in the VNDK. Import all necessary headers from AOSP and switch over the generic_frame_buffer_allocator to use GraphicBufferAllocator. This series has been build-tested on a linux host and functionally tested on an AM62x SK EVM with Android 13. (preview and capture). [1] https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/main/compatibility_matrices/compatibility_matrix.4.xml#195 Signed-off-by: Mattijs Korpershoek --- Changes in v3: - Fixed patch 3 missing whitespace (Jacopo) - Added libui meson import build in patch 3 (more consistent) (Jacopo) - Removed member reference to GraphicBufferAllocator in patch 4 (Jacopo) - Link to v2: https://lists.libcamera.org/pipermail/libcamera-devel/2023-September/038942.html Changes in v2: - Dropped additional ; in graphic_buffer_allocator_stub.cpp. (Kieran) - Surrounded problematic includes with #pragma to avoid clang compile errors related to -Wextra-semi. (Kieran) - Link to v1: https://lists.libcamera.org/pipermail/libcamera-devel/2023-September/038927.html Tested on linux with: CC=clang CXX=clang++ meson setup build -Dandroid=enabled -Dandroid_platform=generic ninja -C build And clang version clang++ (clang 16.0.6 "clang version 16.0.6 (Fedora 16.0.6-2.fc38)") --- Mattijs Korpershoek (4): android: Import libutils/libui headers from vndk v33 android: Import GraphicBufferAllocator header from vndk v33 android: Stub GraphicBufferAllocator for build tests android: mm: generic: Use GraphicBufferAllocator instead of gralloc.h .../libs/ui/include/ui/GraphicBufferAllocator.h | 81 ++++++++ .../native/libs/ui/include/ui/PixelFormat.h | 75 +++++++ include/android/meson.build | 2 + .../system/core/libutils/include/utils/Compat.h | 94 +++++++++ .../system/core/libutils/include/utils/Errors.h | 78 ++++++++ .../system/core/libutils/include/utils/Mutex.h | 219 +++++++++++++++++++++ .../system/core/libutils/include/utils/Singleton.h | 102 ++++++++++ .../system/core/libutils/include/utils/Timers.h | 103 ++++++++++ src/android/mm/generic_frame_buffer_allocator.cpp | 68 +++---- src/android/mm/graphic_buffer_allocator_stub.cpp | 54 +++++ src/android/mm/libhardware_stub.c | 17 -- src/android/mm/meson.build | 11 +- 12 files changed, 835 insertions(+), 69 deletions(-) --- base-commit: 1d616141420d1f51e5999d758e3e0cc721a46290 change-id: 20230824-gralloc-api-v4-e3388fd364c6 Best regards,