From patchwork Tue May 30 14:47:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 18668 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 760DFC31E9 for ; Tue, 30 May 2023 14:47:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E36EE60599; Tue, 30 May 2023 16:47:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685458041; bh=GQdFD88xUq9wH23d+1rHaHWsPWIJlDpej2LH1hNW/N8=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=W+noEERfGS6nBdhd49iFZ7trkNvOyz1LKmANnyH/9zoAZxY42Y1M0s3SF0om+uHzz sLHBvFfJwoWGAzVQCZ/Vd5LX6oPjHL40AzvHkxh7YhGyu+w+bLkHxn/A2gjb3YrC0T ObCu8MWqdzfBAV8uXH3PIAxvsplhNyzQeMulfZ7fkHQxTpcFUJCTA0uEM/SOy2RMI8 lieUgre5n/L/yt9zYk1LcuUZUET6L7IhfKuPQ6sHfe060yelWMCq/wpvKBBghrQvSI n5xZ2Dh49cCAuA2nLqgaApNKuCrj/eK/RxFDZiyfu88AxFNwXkdLihHBb9bwgcP59i 34kBwElE129wA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5B1B260595 for ; Tue, 30 May 2023 16:47:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="epIIjs9M"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (om126205198071.34.openmobile.ne.jp [126.205.198.71]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4A0DD7EC; Tue, 30 May 2023 16:46:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1685458019; bh=GQdFD88xUq9wH23d+1rHaHWsPWIJlDpej2LH1hNW/N8=; h=From:To:Cc:Subject:Date:From; b=epIIjs9M4el6cKL7DPortTY4acQM+mP/cVOeb6sCXT3YNk3CsS+ice86ZMafOyuvG jlVfgE13+L5Bzap9pXdZV8OuYlgtwu+0lshgmfWsK7HaT4NuLZLiO0mOGnNh1UgTC1 LtNW6qFH//7xRYIlam/lvCII/emjc8r6vvTc9qbo= To: libcamera-devel@lists.libcamera.org Date: Tue, 30 May 2023 17:47:19 +0300 Message-Id: <20230530144719.2711-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] android: mm: Stub libhardware for build tests 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: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Commit 66c618f378aa ("android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID") made libhardware a required dependency for the Android camera HAL on non-Chrome OS platforms. This isn't an issue for real devices, as Android provides libhardware, but it prevents compile-testing the camera HAL on traditional Linux systems. To restore the compile-test coverage, stub the libhardware function used by the camera HAL when libhardware isn't found. Signed-off-by: Laurent Pinchart Reviewed-by: Mattijs Korpershoek Tested-by: Mattijs Korpershoek # meson build test Reviewed-by: Kieran Bingham --- src/android/mm/libhardware_stub.c | 17 +++++++++++++++++ src/android/mm/meson.build | 12 ++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/android/mm/libhardware_stub.c base-commit: 76e1cb9f7176b4e7a935295d4e633ee24a0fef67 prerequisite-patch-id: 2e7126df41498860ace9c0cd6b1e2ed748bac2f9 diff --git a/src/android/mm/libhardware_stub.c b/src/android/mm/libhardware_stub.c new file mode 100644 index 000000000000..00f15cd90cac --- /dev/null +++ b/src/android/mm/libhardware_stub.c @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* + * Copyright (C) 2023, Ideas on Board + * + * libhardware_stub.c - Android libhardware stub for test compilation + */ + +#include + +#include + +int hw_get_module(const char *id __attribute__((__unused__)), + const struct hw_module_t **module) +{ + *module = NULL; + return -ENOTSUP; +} diff --git a/src/android/mm/meson.build b/src/android/mm/meson.build index 85f12f910198..e3e0484c3720 100644 --- a/src/android/mm/meson.build +++ b/src/android/mm/meson.build @@ -4,10 +4,14 @@ platform = get_option('android_platform') if platform == 'generic' android_hal_sources += files(['generic_camera_buffer.cpp', 'generic_frame_buffer_allocator.cpp']) - android_deps += [ - libdl, - dependency('libhardware'), - ] + android_deps += [libdl] + + libhardware = dependency('libhardware', required : false) + if libhardware.found() + android_deps += [libhardware] + else + android_hal_sources += files(['libhardware_stub.c']) + endif elif platform == 'cros' android_hal_sources += files(['cros_camera_buffer.cpp', 'cros_frame_buffer_allocator.cpp'])