From patchwork Tue Sep 12 09:36:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 18984 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 02D7FBD160 for ; Tue, 12 Sep 2023 09:36:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 61789628F7; Tue, 12 Sep 2023 11:36:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1694511381; bh=6WoQUjkU6/UoLxK9X+DG9B9lDf407cfBW5oJ9LzwY+4=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=GhTOim+M6t18lt9UI8T9mUGZopCxO6menBWh9nA3v8Ibx7oHB+IYQvwL55PoSwoM0 lLl1r5ZqYJEQcb+E3WOsQWh4z6+JGwc8oVu0JKaK8r7h53Z3KOS6uxq1shIplkCB1D hCptZNNCsRUnZ0DpGHq9WDTqEBs/4Su+WsDDFc5ZhmkJyrEVs1EHwrXkCBuzJ+lCun K5wAwFneYNhlx9vGKYz1sD+Cpna1UGiwx2Ydd0PFvNsyZycj3SXfjkvJqs3j1fqh97 g1fGNPyyh14ax+AtOtss9FBC52Zc598xIyFTsgeoU84fIwcHnzhVpR0Z2n5PgQuIeS dx6+6+QzHcjLA== Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 68C0B61DF2 for ; Tue, 12 Sep 2023 11:36:19 +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="bUH+xhRb"; dkim-atps=neutral Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40078c4855fso57023335e9.3 for ; Tue, 12 Sep 2023 02:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1694511379; x=1695116179; 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=6gJ37YjxryuONu7pc/M52+6Oj1TMA3BWxJdRCMJDgz4=; b=bUH+xhRbrB2ZtvBkzaPETVIwgaALhs/t2pSmrkumxCwHxTEVZVmMkvjT5V+vErOlsH rzjKhMm2axmAuMqgI1RKo5Q/XRTNNE014aPYlae9p1yTCTPv/2fR4+A86hmVg2I3tpxP 1ssfzESj5FBiyBRR6O8Tv9/l5NnqH1sl0ww7g7roEAnc9U3vDp/DIC16Hy6NY+8h7mt+ vrgACXeKGIogE7Xw/S/1N+6esfgQ01MaDV3je1bEaz34/YJj8E2IDOuyWzo2STzyOrA2 9spy2nHsEJfVhghfR8mN64fJty0seYkmzET8y8ZVKjqTUV3j3QQtpVxlR/ZSdUetqvdG gm/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694511379; x=1695116179; 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=6gJ37YjxryuONu7pc/M52+6Oj1TMA3BWxJdRCMJDgz4=; b=cYS6bk6qEU6AvOAyLhzEXa3MKgovw0PN7J2hcLzGHwkQDPfxMA8K+YHD68fp1drCVS 5LyREyLrFLg20+Q/ms55eX2OkfOq4nnbXVOXkMCV7DXfpzdU7vQpvQRNFFT3I5B1sGWy PYK+y9Nf67X+X2H6XtuOzZVvqecgPmi78pbDY5m36EA3wdWGOliOIk+gUvFYcZsTBRNY ueEQdbHKkkunYu/99loB5WK3czwNd+308Mi/L1+SBjeb6JAiuBw2+4EAPw9/o6s7X59M pLB7yEFl5jCiZz7f5e9d6QuUubA0UkzU6ria8yflBtxcXjA8UXxKMn8MzsEP+5SOejay Z9Pg== X-Gm-Message-State: AOJu0YxP9IMek2JzXA2lzYh31MkSRFMUpZ9C1Yf7TAjpENgxMvNxTUgs ZtcvEGgSRm+jFayXVm7JLZLmuA== X-Google-Smtp-Source: AGHT+IGuNdoCvHEH5m4jh7e0BECI8VTbGmX4YW8yIztMNNDJGK0YZm5yxVFQyV/PG2Row9gO4vEOFQ== X-Received: by 2002:a05:600c:3b1f:b0:401:b204:3b85 with SMTP id m31-20020a05600c3b1f00b00401b2043b85mr9674461wms.36.1694511378475; Tue, 12 Sep 2023 02:36:18 -0700 (PDT) Received: from [192.168.2.39] ([82.66.159.240]) by smtp.gmail.com with ESMTPSA id y10-20020a05600c364a00b00401b242e2e6sm15578253wmq.47.2023.09.12.02.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 02:36:18 -0700 (PDT) Date: Tue, 12 Sep 2023 11:36:09 +0200 Message-Id: <20230912-gralloc-api-v4-v1-0-0f80402d8e7a@baylibre.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAAkxAGUC/x2N0QqDMAwAf0XyvIBri5T9ythDWqMGXJVkiCD+u 3WPx3HcAcYqbPBqDlDexGQpFZ6PBvJEZWSUvjK41vk2uoCj0jwvGWkV3AKy9zEOve9C7qBGiYw xKZU83dmX7Md6i1V5kP1/en/O8wIavZOAeQAAAA== To: libcamera-devel@lists.libcamera.org X-Mailer: b4 0.12.3 Subject: [libcamera-devel] [PATCH 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 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 --- 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 | 58 ++---- src/android/mm/graphic_buffer_allocator_stub.cpp | 50 +++++ src/android/mm/libhardware_stub.c | 17 -- src/android/mm/meson.build | 9 +- 12 files changed, 825 insertions(+), 63 deletions(-) --- base-commit: 58e501c71c47e57f02afde1bd296a037038cd6d5 change-id: 20230824-gralloc-api-v4-e3388fd364c6 Best regards,