Commit Graph

365 Commits

Author SHA1 Message Date
Jayant Chowdhary
2d51f59db5 Merge "camera: Add boolean to HalStream for stream specific HAL buffer manager" into main 2024-01-06 07:15:44 +00:00
Jayant Chowdhary
4869ae7838 camera: Add boolean to HalStream for stream specific HAL buffer manager
Whether the HAL buffer manager is used or not is decided
based on the presence of a static camera characteristics key -
ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION. This behavior cannot
be toggled depending on stream configuration / session parameters.

The HAL buffer manager does reduce memory consumption at the cost of
extra IPC calls, which may not be always desirable.

Therefore, HalStream.aidl - the parcelable returned by the camera HAL
for each stream configured now holds a boolean value, specifying
whether output buffers must be managed by the HAL or the camera
framework for the particular session configured.

Bug: 311263114

Test: builds

Test: Run Camera CTS on HAL supporting
      ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_SESSION_CONFIGURABLE

Test: VTS

Change-Id: Id6bda31eab3d66361991e2f883231a5a55a2ef82
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
2024-01-04 18:32:19 +00:00
Treehugger Robot
15cafadf28 Merge "Camera: Add missing characteristics for using buffermanager in ExternalCamera" into main am: 4103ef0c5a am: 5151c1f477 am: 36af76605f
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2884368

Change-Id: I3523501e297d5b4c61ae6760b3f25782c8654bec
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-03 20:29:11 +00:00
Bharatt Kukreja
48c35ba72a Add VTS test for getSessionCharacteristics
Test: atest VtsAidlHalCameraProvider_TargetTest
Bug: 314386872
Change-Id: I3f838fd041e6aca4b12fad512f57287a94149c6e
2023-12-21 18:59:48 +00:00
Sangheum
aa9d8dce11 Camera: Add missing characteristics for using buffermanager in ExternalCamera
Buffer manager is used in the external camera, but the key is not included in the aidl.
Add a buffermanger key according to the key definition.

Test: Test with USB Camera
Change-Id: I8c8c35d933fecb14dcf39996c709b643db3ee3e3
2023-12-20 17:37:47 +09:00
Bharatt Kukreja
ac1e3152ca Camera: Add getSessionCharacteristics API
Add API to fetch characteristics for a given session configuration.

Test: Build
Bug: 303645857
Change-Id: I07cb6eb3b0d63454899b2df1497ba120aa762142
2023-12-05 18:21:23 +00:00
Shuzhen Wang
df89cb9c21 Camera: Add new function to query for SessionConfiguration
- The new isStreamCombinationSupported takes into consideration
  the session parameters.
- In order to create CaptureRequest in ICameraDevice, a
  createDefaultRequestSettings function is needed.

Test: Run camera VTS with session_configuration_with_parameters_query flag enabled
Bug: 309627704
Change-Id: Ib344e6991484b834aa8483ed8637ce5cd02ede87
2023-12-05 03:48:51 +00:00
Jayant Chowdhary
644676a583 camera: Add support for toggling HAL buffer manager as a result of session configuration
Currently, whether the HAL buffer manager is used or not is decided
based on the presence of a static camera characteristics key -
ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION. This behavior cannot
be toggled depending on stream configuration / session parameters.

The HAL buffer manager does reduce memory consumption at the cost of
extra IPC calls, which may not be always desirable.

Therefore, a new API - 'configureStreamsV2()' is introduced to give the
camera HAL the ability to inform the camera framework whether it must
use the HAL buffer manager for the particular session configured.

Bug: 311263114

Test: VtsAidlHalCameraProvider_TargetTest on cuttlefish
Test: builds

Change-Id: Ibce6d64c3c9cc8e0ebc40522369291d03053cce2
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
2023-12-01 00:59:01 +00:00
Avichal Rakesh
56d9580dcf Merge "ExternalCameraHAL: Fix memory leak when copying buffer fence" into main am: 634ecd5da0 am: aba897e523 am: a11d57f607
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2817883

Change-Id: I168257bac3466f67fdb90da573402c0775a20f28
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 23:47:47 +00:00
Avichal Rakesh
1fa4142e1a ExternalCameraHAL: Fix memory leak when copying buffer fence
Pointer to native_handle_t created using native_handle_create should
be cleaned up using native_handle_delete even if the fds in the
native_handle is no longer managed by it. ExternalCameraDeviceSession
creates native_handle_t as an intermediate to convert to AIDL
NativeHandle but doesn't call native_handle_delete on the
intermediate object which led to memory leaks.

This CL removes the intermediate object and copies the fence fd
directly.

Bug: 305638723
Test: No functional change. Compilation successful.
Change-Id: Ie3c558ee1ae6d2e84053b65eed7db179118395bb
2023-11-03 16:16:57 -07:00
Treehugger Robot
ecf3a1503a Merge "ExternalCameraHAL: Check for empty native handle instead of null." into main am: 7e4037cf01 am: b6452b7ad8 am: a75bf4a77a
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2787022

Change-Id: I8cc9bec724e89264483b8f2754af83e06e38dc0e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-03 02:50:33 +00:00
Avichal Rakesh
e6a88a8119 ExternalCameraHAL: Check for empty native handle instead of null.
AIDL cannot send nullptr when parceling NativeHandles. Instead, it
sends an empty  handle. Logic which previously relied on null
checks should now rely on checking if the native_handle is
empty or not.

This CL updates ExternalCameraUtils to check for empty handles
instead.

Bug: 299170474
Test: CameraAidlTest#processCaptureRequestInvalidBuffer passes
Change-Id: Id4ba928defaa061708a3c1cd68aa510b376f6cb3
2023-11-02 17:27:43 -07:00
Sergiu Ferentz
31b637fd90 Merge "Bump android.hardware.graphics.common V4->V5" into main 2023-10-09 08:27:26 +00:00
sergiuferentz
7d7a24d5f6 Bump android.hardware.graphics.common V4->V5
Test: Build
Bug: 291142745
Change-Id: Ib0002feb982ffcc37fa7b69493c644b7a835cf4f
2023-10-03 16:14:03 +00:00
Devin Moore
523660cd87 Revert "Revert "Convert from HIDL mapper to libui GraphicBufferM..."
Revert submission 24913374-revert-24747509-camera_fail2-OVHUVTAXRP

Reason for revert: 32-bit TV build is fixed with `%zu` instead of `%lu` for size_t argument.

Reverted changes: /q/submissionid:24913374-revert-24747509-camera_fail2-OVHUVTAXRP

Change-Id: I16287ce2dbea034db41450a3a5e9c3f729e76335
2023-10-02 15:55:11 +00:00
Michael Stokes
49ba82ce11 Revert "Convert from HIDL mapper to libui GraphicBufferMapper"
Revert submission 24747509-camera_fail2

Reason for revert: DroidMonitor-triggered revert due to breakage
b/302990858.

This may cause CtsAppOpsTestCases b/300115646 to fail again,
unfortunately (b/300115646).

Bug: 302990858
Reverted changes: /q/submissionid:24747509-camera_fail2

Change-Id: I0191b3ee88846f5b2c6e37ebd6be6d1369d9dba9
2023-10-02 09:56:59 +00:00
Devin Moore
5e154097aa Convert from HIDL mapper to libui GraphicBufferMapper
HIDL mapper HAL is deprecated and instead of adding more support for the
new replacement explicitly, we can move the GraphicBufferMapper which
handles all of the backwards compatbility with the HIDL HALs for us.

Test: atest CtsCameraTestCases CtsAppOpsTestCases
Bug: 285605852
Bug: 300115646

Change-Id: Ib97e429a0f3dd1c66ec008fbf3860c9c5667bddd
2023-09-19 21:56:38 +00:00
Tang Lee
65382f6a50 Fix external camera HAL crashes
External USB camera hal service crashes when disconnecting the camera.
ExternalCameraDeviceSession's desctructor is called and deletes mLock,
but mBufferRequestThread is still running and waiting on the same
mLock, which causes the "pthread_mutex_lock called on a destroyed
mutex" error.

Fix the issue by stopping the thread in destructor. Also refactors the
functions and remove unused conditions.

Bug: 289741662
Test: Test with USB camera
Change-Id: I06b1ff6e192a4bca16822785d65d68a6aae53414
2023-08-01 10:32:46 +00:00
Sally Qi
3def856602 Use android.hardware.graphics.common wrap.
Bug: 291745893
Test: builds
Change-Id: I4de7ecf4593957d4ef76ff3d66b1b7daa0d3f11a
2023-07-20 16:56:07 +08:00
Alex Buynytskyy
ec1198d941 UpsideDownCake is now 34
Ignore-AOSP-First: UpsideDownCake Finalization
Bug: 275409981
Test: build
Change-Id: I832ab7a8b5445ba85e27bbcf5be64906bfa0e5be
2023-04-07 23:41:20 +00:00
Austin Borger
7d601ebfb6 Camera: Update documentation for dataSpace/colorSpace in Stream.aidl.
Bug: 271350569
Test: N/A
Change-Id: I3f853cece53d102c231a8de1cfcab5ed1fdb0dc0
2023-04-05 11:13:30 -07:00
Avichal Rakesh
8f4111ca7d camera: Add logId to StreamConfiguration
For data analysis from HAL logs, it is helpful to get some higher level
information of the camera usage (such as the client's package name).
HALs are denied access to this higher level information at runtime.

To help data with data analysis, cameraservice will now pass a session
identifier when configuring streams. This identifier can be used to
correlate HAL logs with cameraservice logs at the time of log
consumption. However this correlation cannot be made at runtime. This
identifier is randomly generated and has no functional purpose and can
be safely disregarded by HAL implementations that don't want to
correlate their logs to cameraservice logs.

Bug: 271171714
Test: Manually verified that cameraservice sends correct logId to the
      HAL.
Change-Id: Ib0823a9de8f573233a6e037c178a4398eb26e7ef
2023-03-14 14:45:53 -07:00
Shuzhen Wang
80e67aedf2 Camera: Document limitation on private reprocessing
For private reprocessing, the ImageReader used to produce images into
the ImageWriter isn't aware of the overridden format. If the HAL decides
to override the input IMPLEMENTATION_DEFINED format, reprocessing will
fail.

Document this limitation in the HAL interface.

Test: Build
Bug: 266954992
Change-Id: I9bd05e9682e4d11870bf9bd25763f28291faef75
2023-02-23 22:24:09 +00:00
Devin Moore
e1ffa0ca4e Remove rust backend from camera AIDL interface
FMQ is not supported in rust yet.

Test: m
Bug: na
Change-Id: Icfd804f9b30a6c9feffc839dac80ff1cdbe688d2
2023-02-15 21:24:57 +00:00
Steven Moreland
7387c88980 Merge "cleanup camera OWNERS" 2023-01-20 20:48:35 +00:00
Steven Moreland
0d1d685860 cleanup camera OWNERS
I wrote a script for this, see my email
"introducing: ownersfix.py - basic cleaning script for simple OWNERS files"

Bug: 265168485
Test: N/A
Change-Id: I47ab60785b193764a96d7b63820c87ec4fa81f7f
2023-01-18 21:05:44 +00:00
TreeHugger Robot
5566b8e7a9 Merge changes I3e5d0cd7,I645f8164
* changes:
  External Camera HAL: Fix prefix length
  Clean up external HAL reference implementation.
2023-01-13 20:47:05 +00:00
Avichal Rakesh
740c256079 Clean up external HAL reference implementation.
This CL cleans up the reference external HAL implementation.
Specifically, it makes the following changes:

  - Removes mSupportBufMgr from ExternalCameraDeviceSession as it never
    needed to be used.
  - Makes ExternalCameraOfflineSession final to prevent other classes
    from accidentally inheriting from it. ExternalCameraOfflineSession
    calls the virtual function `close()` on destruction which depends on
    the implementation details of other virtual functions.

Bug: 219974678
Test: Builds successfully
Change-Id: I645f8164cd2426219943d9407f0c282c468c90d3
2023-01-05 01:51:01 -08:00
Ravneet Dhanjal
2f6f874e17 Validate request metadata before coverting to camera metadata
- Backport similar fix from AIDL to HIDL to protect
from malformed metadata

Bug: 256166626
Test: CTS test
Change-Id: If8f83520144824e38ed102b7468d6d5ee2e6d963
2023-01-04 21:06:52 +00:00
Steven Moreland
65ee297ef9 Merge "Mark modules frozen explicitly." 2022-12-12 18:27:49 +00:00
Steven Moreland
edff13e314 Mark modules frozen explicitly.
Makes it easier to see which versions are available.

Bug: 188871598
Test: N/A
Change-Id: Ica76a8225fec8dc5267362cbfd43e06e65ad3f1e
2022-12-08 18:02:08 +00:00
Vadim Caen
79ee3e0e97 Merge "Enable Rust backend for Camera HAL" 2022-12-07 20:15:33 +00:00
Greg Kaiser
9b77fd1272 Fix NULL check
We were checking 'info' twice and not checking 'msgs'.  So we
fix that up, and fix a typo in the message.

Bug: 219974678
Test: TreeHugger
Change-Id: Ia52178b758dc3d9753731b043da01743ff59e10c
2022-12-05 17:06:02 -08:00
Avichal Rakesh
e1857f8dbd Migrate reference external HAL implementation to AIDL
Android T migrated the HAL interface to AIDL, but the reference HAL
was never updated to use AIDL. This CL migrates the reference
HAL implementation for external cameras to use AIDL as well. The
external HAL uses V4L2 standard to expose USB cameras to the
cameraserver.

The reference HAL implementation for internal camera was dropped
because it is not possible to write a generic HAL that works with some
large percentage of internal cameras.

Bug: 219974678
Test: Existing CTS tests pass with external camera connected.
Change-Id: I35f3dc32c16670eca7735a4ac00fed3daf36aa65
2022-12-01 05:09:18 -08:00
Vadim Caen
60741ed7a2 Enable Rust backend for Camera HAL
Change-Id: I70ee4b41d887a9e9b1345020df9d591abdba5c65
2022-11-24 09:15:48 +00:00
Steven Moreland
ed27779d14 graphics.common V3 -> V4
Bug: 251177105
Test: builds
Change-Id: I1cb84ec85f98789d0737207a1661b39a25538c96
2022-10-29 00:51:21 +00:00
Austin Borger
3ab0c3acf5 Merge "Create API for reporting color space support to Camera2 framework consumers." 2022-10-24 17:25:11 +00:00
Austin Borger
4728fc48cc Create API for reporting color space support to Camera2 framework consumers.
Test: Ran CtsCameraTestCases.
Test: Ran VtsAidlHalCameraProvider_TargetTest.
Test: Created app to test display P3 camera, switching between color spaces
Bug: 238359088
Change-Id: I382dea5d13582817959001246240141e83d8172d
2022-10-21 11:01:18 -07:00
Steven Moreland
eea598ddce camera aidl: 'empty' native handles not 'null' native handles am: 29b87463f4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2250554

Change-Id: I2148508663f577884f2352d6de5580f277b968e9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-12 01:35:06 +00:00
Steven Moreland
29b87463f4 camera aidl: 'empty' native handles not 'null' native handles
Bug: N/A
Change-Id: I789d90e2c3d73a57658fbcc7a87723251f9c9096
Test: N/A
2022-10-11 22:45:18 +00:00
Rucha Katakwar
69f0be42b6 Update the HAL side about torch max level safety. am: 87a2e092ae am: 2ca2d808e0
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/19347559

Change-Id: Iad6bb25369c6e193c8247b832d3d698ae69b14b2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 00:03:11 +00:00
Rucha Katakwar
87a2e092ae Update the HAL side about torch max level safety.
Bug: 239492786
Change-Id: I59dc2acc89c617be4551a4d92494a47b782d5e13
2022-07-19 15:42:35 -07:00
Jooyung Han
c0b24f4f13 Remove AIDL-libs from VNDK
Some are still in VNDK because they are used in other VNDK libs.

Ignore-AOSP-First: some libs are still in internal master only.

Bug: 234181591
Test: m
Merged-In: If999df9c78a20df931177da11742b1c5de19bc08
Change-Id: If999df9c78a20df931177da11742b1c5de19bc08
(cherry picked from commit 5527adfd7f)
2022-06-14 14:08:59 +09:00
Jayant Chowdhary
9ab187f118 Delete HIDL 3.8
- HIDL camera device@3.8, metadata@3.8 were temporary interfaces

Bug: 221108824

Test: GCA
Test: Camera CTS

Merged-In: I44cd1ac0e2f6647e3e9d5c60a535faf716d5ed93
Change-Id: I44cd1ac0e2f6647e3e9d5c60a535faf716d5ed93
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit 406da44909)
2022-05-25 23:43:33 +00:00
Jayant Chowdhary
406da44909 Delete HIDL 3.8
- HIDL camera device@3.8, metadata@3.8 were temporary interfaces

Bug: 221108824

Test: GCA
Test: Camera CTS

Change-Id: I44cd1ac0e2f6647e3e9d5c60a535faf716d5ed93
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
2022-05-25 04:15:23 +00:00
Jiyong Park
703e97920e Freeze AIDL APIs for TM
Bug: 225941299
Test: m
Change-Id: Ie41cc0797710f813f92c65c387f247c7806d8394
2022-03-31 12:01:39 +09:00
TreeHugger Robot
49175a3732 Merge "Added annotations to prevent misapply of this interface by OEM partners" into tm-dev 2022-03-02 05:08:52 +00:00
Cliff Wu
ba362a8c19 Added annotations to prevent misapply of this interface by OEM partners
- This interface is only suitable for special camera injection hal,
  general camera hal does not need to implement it.

Test: Camera VTS
Bug: 219684073
Change-Id: I9b70e4640dff205008f3d6270f402b720b6b4434
2022-02-24 15:39:36 +08:00
Jayant Chowdhary
cb4853941b camera: Address ANAPIC review comments and additional cleanup
Bug: 218911443

Test: build

Change-Id: Ia6d3f4d73e9ff29fa5fca2e11e0b9cb5a8d1e2ac
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
2022-02-22 23:35:25 +00:00
Bob Badour
13cb922a05 [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces
Added SPDX-license-identifier-Apache-2.0 to:
  camera/common/aidl/Android.bp
  camera/device/aidl/Android.bp
  camera/metadata/aidl/Android.bp
  usb/aidl/Android.bp
  usb/aidl/default/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: Ie530a51faa37d782428a20238e78573658697be8
2022-02-10 13:39:55 -08:00