From patchwork Tue Sep 12 14:15:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 18995 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 3D7D0BE080 for ; Tue, 12 Sep 2023 14:15:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5FD2A628F2; Tue, 12 Sep 2023 16:15:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1694528128; bh=WeDDjC9Ta/6i57FELiBQHaFTq+PKA0NeCkBz9KXq0FY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=EnwkxWDO+e2mo6cpeqhXTwWRi1BRQNbZBhhnb9UUaS0UhTzYsI9MZqKohSmjXfL05 ClqNWU8tw6dkBbaBRvDzU3XTciYG1q6KApxRO8Fl37aMMlqi90Nr/RP7UVMNWQ91dn CsbQiuXANWBioVEZivvRS2fBLntRL/JJveA5nKoYSI0NcCguDo298IKrvjgXzB07Eq V/EWjsoIkIAAkxWJ4QRrDmidDGv/1MvVgSAHg54Bp2+OpD6OdmY5XKevRn/P8BqlCF Wp1c7a51nKqV/5x3+YVk3rZoQdMwQNPdp3He4TBd+pC9TrWLrYrsjCYK60pM9Qkbie kN1tDm4dNJXuQ== Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E1A5A61DEF for ; Tue, 12 Sep 2023 16:15:26 +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="13dUi/fy"; dkim-atps=neutral Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-401b3ea0656so60100425e9.0 for ; Tue, 12 Sep 2023 07:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1694528126; x=1695132926; 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=dAc6/KPU3BKzQueorNnLN0aKP7EgvmuEuApqtgnAFvI=; b=13dUi/fyCKXx6lcOghm8T+IBhs7YrvJNdZw7vh0hTZ6JcjucvC4xvyMP3ZPtTzc/ca T1xKyjQfJYsBCHwsoUzA7mMi7adQibh6Z5amI2X/c0PF/VgPp05Xq0IZq1DmDad35Tsq I1MGdWo5rh+W/5fPwFd87Yxuy9oN5/ivhYVl+l+HQ1I5m5m2E6C7tYTHes4OqipUYgBh 46e6Nwr2cOeZh0+HW0dweefjM/yVysYarQQjtilenKdgGNhMfrdFs2Qw5Oz8lFARV8s7 xMR2oWrLo7SD6ZNLlvCKK7QbtMvbTU36jdDaB2n5K3JO9ykOX6SknmlOgl+1ImST8aJF Sc3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694528126; x=1695132926; 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=dAc6/KPU3BKzQueorNnLN0aKP7EgvmuEuApqtgnAFvI=; b=S3eBoqX+mYNwBjRTLc/pyZBTF/vPQSg8nIPO/eK9inYwn1QXrFTpsGjXX6O2uQNTus 5p/waaEc5qoDZJdu285rHnZxHnttfGrP5085IpmxpgT2te1xrs962CFPgx1kSsjk5Q7A YsNwK6Zx/eziFiDjXbob9FSH3dsVm/xVzeqIssqdr0SLEW9qqKWRNVNFsV+3o4POhuAn HfYqGuRGfoFjeq4O1enZhAncz+kUXJHJMKnph9NWb0gksfE9UgZ9LJ9fyIkQU9PhbfmG m4EdW8bH5UktIg9boBrBquIuGcTKQfmw6tZPrcMVj7XoCp9pPYRZ9Br2h8N0pUIShuBN Z7Aw== X-Gm-Message-State: AOJu0YzQV5RAVZtba1IdWNGTU3Xt8J+FSO37OSrAVHCEVmJPMwi6jfyK X0CFwAbnfrLbS61Fvx5mz+PfzsyUpumwpFuioWw= X-Google-Smtp-Source: AGHT+IGaDolJGzenuwsjKrh7j5fLetz6KyyrMi/rsmQCob02hsxlWqRJlZgkD8qNsaWF0VdNr5koNQ== X-Received: by 2002:a05:600c:6028:b0:402:f55e:ac11 with SMTP id az40-20020a05600c602800b00402f55eac11mr10633928wmb.20.1694528126286; Tue, 12 Sep 2023 07:15:26 -0700 (PDT) Received: from [192.168.2.39] ([82.66.159.240]) by smtp.gmail.com with ESMTPSA id y9-20020a7bcd89000000b003fed630f560sm12996380wmj.36.2023.09.12.07.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 07:15:25 -0700 (PDT) Date: Tue, 12 Sep 2023 16:15:19 +0200 Message-Id: <20230912-gralloc-api-v4-v2-0-e859da63f98c@baylibre.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAHdyAGUC/12NywqDMBBFf6Vk3SkxCTbtqv9RXEziqAO+SCRUx H9vtLsuz70cziYiBaYonpdNBEoceRozqOtF+A7HloDrzEJJpaVVBtqAfT95wJkhGSCtrW1qXRp fiiw5jAQu4Oi7QxswLhSOYw7U8OcsvavMHcdlCusZTsWx/hqPQv03UgESZGOlkaq2dMeXw7VnF +jmp0FU+75/AZ4ATvjIAAAA To: libcamera-devel@lists.libcamera.org X-Mailer: b4 0.12.3 Subject: [libcamera-devel] [PATCH v2 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: 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 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 | 61 ++---- src/android/mm/graphic_buffer_allocator_stub.cpp | 53 +++++ src/android/mm/libhardware_stub.c | 17 -- src/android/mm/meson.build | 9 +- 12 files changed, 831 insertions(+), 63 deletions(-) --- base-commit: 58e501c71c47e57f02afde1bd296a037038cd6d5 change-id: 20230824-gralloc-api-v4-e3388fd364c6 Best regards,