Commit graph

1083 commits

Author SHA1 Message Date
Treehugger Robot
419aa1a845 Merge "Camera: Fix processCaptureRequestBurstISO" into main 2024-05-07 17:45:42 +00:00
Fang Hui
f097c4d9bc Camera: Fix processCaptureRequestBurstISO
android_convertGralloc1To0Usage() is used to convert gralloc1_usage(uint64_t) to gralloc_usage (int32_t),
then passed as a para in allocateGraphicBuffer(). But definition of allocateGraphicBuffer() is as
void CameraAidlTest::allocateGraphicBuffer(uint32_t width, uint32_t height, uint64_t usage, PixelFormat format, buffer_handle_t* buffer_handle).
The type of "usage" is uint64_t. So the convert (uint64_t -> int32_t -> uint64_t) will change usages(31 bit is 1)
such as 0x0000000080020b00 to 0xffffffff80020b00. It's unexpected.

Use ANDROID_NATIVE_UNSIGNED_CAST to fix the issue.

Bug: https://issuetracker.google.com/issues/330051542

Change-Id: I23dfd603be0da6864d1021a57c3c3ce76cb78bda
Signed-off-by: Fang Hui <hui.fang@nxp.com>
2024-05-07 16:49:45 +00:00
Tang Lee
45d7a9e1b4 ExternalCameraHAL: fix CTS failures with callback for errors
For every request, either requestStreamBuffers fails or
handling of the requested buffer fails, always trigger
the processCaptureResult callback by notifying the request
is ready. This avoids the errors like the service side
receives fewer results than the requests and waits until
timeout.

Bug: 299182874
Test: cts
cts-tradefed run cts \
  --include-filter  "CtsCameraTestCases android.hardware.camera2.cts.RobustnessTest" \
  --include-filter "CtsCameraTestCases android.hardware.camera2.cts.PerformanceTest" \
  --include-filter "CtsCameraTestCases android.hardware.camera2.cts.StillCaptureTest" \
  --include-filter "CtsCameraTestCases android.hardware.camera2.cts.SurfaceViewPreviewTest" \
  --include-filter "CtsCameraTestCases android.hardware.cts.CameraGLTest" \
  --include-filter "CtsCameraTestCases android.hardware.cts.LegacyCameraPerformanceTest" \

Merged-in: I86ba422524e79af6b318b50bd6eebe2cb27fa50a
Change-Id: I86ba422524e79af6b318b50bd6eebe2cb27fa50a
2024-03-25 17:28:06 -07:00
Tang Lee
895f5bbddc ExternalCameraHAL: improve buffer and error handling
After enabling HALL Buffer Management, it requires more careful
error handling and syncing. Process the buffer request error correctly.
Handle the lock and states correctly.

Bug: 299182874
Test: CTS passed, expecially
./cts-tradefed run cts -m CtsCameraTestCases -t android.hardware.camera2.cts.NativeCameraDeviceTest
./cts-tradefed run cts -m CtsCameraTestCases -t android.hardware.camera2.cts.RobustnessTest

Merged-in: I04d8e19a2ee78580e54340378122c724a3de8edb
Change-Id: I04d8e19a2ee78580e54340378122c724a3de8edb
2024-03-25 17:27:59 -07:00
Avichal Rakesh
a52542e856 ExternalCameraHAL: Skip importing buffer from capture request
ExternalCameraHAL supports HAL buffer management which means
cameraservice will not send it an output buffer along with the
capture request, and the HAL has the freedom to request an
output buffer when an output buffer is needed.

As a remnant of migration from HIDL to AIDL, the
ExternalCameraHAL still attempted to import buffers that
the cameraservice has sent with the CaptureRequest. However,
with HAL buffer manager enabled, this buffer is always null and
results in the HAL failing to process the capture request.

This CL removes the logic for importing output buffers when
processing capture requests from the cameraservice, and lets
the HAL call requestStreamBuffers when it needs an output buffer.

Bug: 299182874
Test: VTS Tests now pass
Merged-in: I00654836b7ae91a91a2afa4b149712977e07dcc5
Change-Id: I00654836b7ae91a91a2afa4b149712977e07dcc5
2024-03-25 17:27:47 -07:00
Avichal Rakesh
b3b02babbb ExternalCameraHAL: Prevent memory leak when manipulating native_handle
native_handle objects created by makeFromAidl need to be deleted
with native_handle_delete. Not doing so leads to a memory leak
every time makeFromAidl is called.

This CL ensures that native_handle_delete is called on the
return value of makeFromAidl wherever it is used.

Bug: 305638723
Test: n/a. No functional change.
Merged-in: Ia99ba6e3abbdf7dec75383450a60c944b92a9c74
Change-Id: Ia99ba6e3abbdf7dec75383450a60c944b92a9c74
2024-03-25 17:27:32 -07:00
Avichal Rakesh
ea30826bf3 ExternalCameraHAL: dup fd when creating AIDL NativeHandle
AIDL's NativeHandle do not have a concept of unowned file
descriptors. If a NativeHandle object is created with an
fd, NativeHandle implicitly assumes ownership of the fd.
When passing fds over binder, ExternalCameraHAL used
makeToAidl which which accidentally transferred ownership
to the AIDL objects. Additionally, NativeHandles close
owned fds on destruction, which led to multiple closure
of fences.

This CL changes the logic to use dupToAidl to ensure that
NativeHandle objects are given ownership of a duped fds
and don't interfere with any of the fds used for internal
bookkeeping.

Bug: 313115623
Test: Verified by partner that ExternalCameraHAL no longer double closes fds.
Merged-In: Ic406634de6f22a290abb414e80a7747927368b68
Change-Id: Ic406634de6f22a290abb414e80a7747927368b68
2024-03-25 21:59:11 +00:00
Treehugger Robot
74dc4cc5d7 Merge "[DON'T BLOCK] Test ownership migration rules" into main am: 27e97308c4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2950589

Change-Id: Ie4f36b193820490e606e7f5100ca29200f832fa2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-07 01:45:21 +00:00
Treehugger Robot
27e97308c4 Merge "[DON'T BLOCK] Test ownership migration rules" into main 2024-02-07 00:55:34 +00:00
Jayant Chowdhary
d5fb309d31 Merge "Camera VTS: Test only CROPPED_RAW use case for RAW_SENSOR streams" into android14-tests-dev am: e51dca227c am: 02cb71bd4d
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2944865

Change-Id: Ib74ae9c579d503933012c28080a87312122fa45e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 19:12:23 +00:00
Jayant Chowdhary
02cb71bd4d Merge "Camera VTS: Test only CROPPED_RAW use case for RAW_SENSOR streams" into android14-tests-dev am: e51dca227c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2944865

Change-Id: I7e8bd1591f4520c63f3fe7449353a55961014334
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 18:30:10 +00:00
Jayant Chowdhary
e51dca227c Merge "Camera VTS: Test only CROPPED_RAW use case for RAW_SENSOR streams" into android14-tests-dev 2024-02-05 17:45:14 +00:00
Aditya Choudhary
ad2ba1b851 [DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
go/new-android-ownership-model

Bug: 304529413
Test: N/A
Change-Id: Ic8c4bd6ac246e7efa98bbdaf822d12ae8e1230a5
2024-02-05 15:45:22 +00:00
Jayant Chowdhary
7a9ee22a51 Camera VTS: Test only CROPPED_RAW use case for RAW_SENSOR streams
There are no mandatory stream combinations for RAW_SENSOR streams that
do not involve the CROPPED_RAW stream use case. So we don't need to test
stream non CROPPED_RAW stream use cases with the RAW_SENSOR format,
since we don't have a definite answer to whether they will be supported or not.

Bug: 317773720

Test: Camera VTS on cf
Test: Vendor testing

Merged-In: I0870e90ae68a5e35196f0ba0afaa6b8bf7fbfbd8
Change-Id: I0870e90ae68a5e35196f0ba0afaa6b8bf7fbfbd8
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit 6847115a00)
2024-02-01 18:51:13 +00:00
Xin Li
763c473c3d Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I976f80006aeb88bde2ae34ca4f9be72cea727d9e
Change-Id: Id94b25af52bd2e2847b6858697ab21cc6ce27aa3
2024-01-30 10:36:50 -08:00
Jayant Chowdhary
df5baff289 camera vts: Remove redundant capabilities fetch am: 23f338bac4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2912754

Change-Id: I13e49647cc7f340fa18265dac415c83a2850d025
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-17 22:31:52 +00:00
Jayant Chowdhary
331ac42624 Check for stream use case capability before stream use case test am: 5554de2fa8
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2913463

Change-Id: I41668e65f44bebddc4b82ac2e030a0a5d8cf75d6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-17 22:31:33 +00:00
Jayant Chowdhary
23f338bac4 camera vts: Remove redundant capabilities fetch
Bug: 299202800

Test: build

Merged-In: Ia6ca1ee0fb65e357398ba62c6a787c6530b989e4
Change-Id: Ia6ca1ee0fb65e357398ba62c6a787c6530b989e4
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit 571cbf1b4c)
2024-01-17 18:48:49 +00:00
Jayant Chowdhary
5554de2fa8 Check for stream use case capability before stream use case test
Bug: 299202800

Test: Vendor testing

Merged-In: If30ead47072dc1f950b8fb6384072cc38cd51c58
Change-Id: If30ead47072dc1f950b8fb6384072cc38cd51c58
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit da59822642)
2024-01-17 18:33:57 +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
Shuzhen Wang
0aa6542a42 Merge "Camera: Fix mandatory stream combination links" into udc-dev am: 8afead698e am: 54aff2d536
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/25548794

Change-Id: I26b5881ce4d7d9e723696e327e777907f6a826a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-09 04:06:55 +00:00
Shuzhen Wang
8afead698e Merge "Camera: Fix mandatory stream combination links" into udc-dev 2023-12-09 03:05:02 +00:00
Jag Saund
b8a3f97884 Merge "Camera: Low Light Boost AE Mode" into main 2023-12-08 00:45:00 +00:00
Jag Saund
41498278a3 Camera: Low Light Boost AE Mode
Auto-generated file from changes in metadata_definitions.xml

Bug: 312803148
Test: Build Successful
Change-Id: I7e29a6a9351da9fa03cbaea21286ca7fe1aa910f
2023-12-07 17:20:13 +00: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
Shuzhen Wang
ee06de115e Camera: Fix mandatory stream combination links
Some recent change in doclava resulted in broken link for {@link...}
with href's that are not class/method.

Use direct href instead.

Test: read docs
Bug: 303582215
Change-Id: I57ee60d73fe70fc2e0cd5cbf7ea73c59af398c72
2023-12-04 15:01:55 -08:00
Jayant Chowdhary
0215d98751 Merge "camera: Add support for toggling HAL buffer manager as a result of session configuration" into main 2023-12-04 20:55:07 +00:00
Emilian Peev
9e21e0f74a Camera: Add physical camera crop metadata tag
Allow CameraHal implementations to report the physical
camera source crop.
Additionally extend the capture results with
intra-frame lens intrinsics samples.

Bug: 297083874
Test: atest VtsAidlHalCameraProvider_TargetTest
Change-Id: Ib2ad0a3b8f51813dc1aaa52f110a2946ab8787ce
2023-12-01 02:46:08 +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
Rucha Katakwar
ed9d677454 Merge "Camera: Vts test for manual flash control." into main 2023-11-14 20:56:50 +00:00
Shuzhen Wang
8ba70cc275 Camera: Update API docs
run metadata-generate to keep docs updae to date

Bug: N/A
Test: Build and read docs
Change-Id: I278de69618cfbba3a6fcd65defb2e3e28c373b31
2023-11-10 19:12:43 +00:00
Rucha Katakwar
d08a015239 Camera: Vts test for manual flash control.
Test to verify configurations for manual flash strength level
control feature.

Test: Tested on an emulator with flag enabled/disabled.

Bug: 238348881

Change-Id: Iba492fe626c2fb74aa2107cec3969a04ea52eac0
2023-11-08 14:50:35 -08: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
Treehugger Robot
7e4037cf01 Merge "ExternalCameraHAL: Check for empty native handle instead of null." into main 2023-11-03 01:10:16 +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
Xin Li
11ee4fea87 Merge android14-tests-dev
Bug: 263910020
Merged-In: I770dc5620648df2eab608e030c5e76cf190f315d
Change-Id: If4fe726d538386d70061e8051299d8fb393ef5df
2023-10-10 16:17:14 -07:00
Sergiu Ferentz
31b637fd90 Merge "Bump android.hardware.graphics.common V4->V5" into main 2023-10-09 08:27:26 +00:00
Treehugger Robot
b6863cf979 Merge "Revert "Revert "Convert from HIDL mapper to libui GraphicBufferM..."" into main 2023-10-04 01:56:09 +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
Tang Lee
cc29bdd2d3 Merge "Return ILLEGAL_ARGUMENT for setting null callback" into main 2023-10-03 03:14:52 +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
f9fcfe3794 Merge "Revert "Convert from HIDL mapper to libui GraphicBufferMapper"" into main 2023-10-02 10:21:06 +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
Tang Lee
4be4471d46 Return ILLEGAL_ARGUMENT for setting null callback
Bug: 299182872
Test: Run VTS with external USB camera
vts-tradefed
> run vts -m VtsAidlHalCameraProvider_TargetTest -t \
    PerInstance/CameraAidlTest#setCallback/0_android_hardware_camera_provider_ICameraProvider_external_0 \
    --logcat-on-failure --logcat-on-failure-size 8192000 \
    --bugreport-on-failure --screenshot-on-failure

Change-Id: I013e3770ddbdcf6475e0927449af6183dcc37a8e
2023-10-02 07:18:16 +00:00
Devin Moore
b22961072f Merge "Convert from HIDL mapper to libui GraphicBufferMapper" into main 2023-09-29 14:57:02 +00:00
Rucha Katakwar
5d0f9d16e3 Camera: Flash strength control during camera use.
Auto-generated file from changes in metadata_definitions.xml

Bug: 238348881
Test: Build Successful
Change-Id: Ic6aec9b2135b0b2a2d24d8204900b8bad52d6725
2023-09-20 11:43:03 -07: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