Commit graph

207 commits

Author SHA1 Message Date
Yifan Hong
7749ef2a4a Merge "Use libgtest_prod_headers." 2021-04-28 20:53:30 +00:00
Yifan Hong
bb1479b00b Use libgtest_prod_headers.
Test: builds
Bug: 185916167
Change-Id: Ifdb71aa9e6e9eeadd4d7c9cb4850832650dd12e8
2021-04-26 16:36:38 -07:00
Bob Badour
d7984ccf02 [LSC] Add LOCAL_LICENSE_KINDS to hardware/libhardware
Added SPDX-license-identifier-Apache-2.0 to:
  modules/audio/Android.bp
  modules/audio_remote_submix/Android.bp
  modules/audio_remote_submix/tests/Android.bp
  modules/camera/3_0/Android.bp
  modules/consumerir/Android.bp
  modules/fingerprint/Android.bp
  modules/gralloc/Android.mk
  modules/hwcomposer/Android.bp
  modules/input/evdev/Android.bp
  modules/local_time/Android.bp
  modules/nfc-nci/Android.bp
  modules/nfc/Android.bp
  modules/power/Android.bp
  modules/radio/Android.bp
  modules/sensors/Android.bp
  modules/sensors/Android.mk
  modules/sensors/dynamic_sensor/Android.bp
  modules/sensors/dynamic_sensor/HidUtils/Android.bp
  modules/soundtrigger/Android.bp
  modules/thermal/Android.bp
  modules/tv_input/Android.bp
  modules/usbaudio/Android.bp
  modules/usbcamera/Android.bp
  modules/vibrator/Android.bp
  modules/vr/Android.bp
  tests/camera3/Android.bp
  tests/fingerprint/Android.bp
  tests/hardware/Android.bp
  tests/hwc/Android.bp
  tests/input/evdev/Android.bp
  tests/nusensors/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  Android.bp
  modules/camera/3_4/Android.mk

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I28924363e6c478f5d0b465b63534c4efd041c770
2021-02-12 20:51:13 -08:00
Changyeon Jo
a8998121ab Fix camera.v4l2 module build error
Undeclared uint8 data types are used in exif_utils.cpp file and this
change corrects their types as uint8_t instead.

Bug: 140885470
Test: mm
Change-Id: I2e48a134c24cd3f17a7b6bafdc815200ca546826
Signed-off-by: Changyeon Jo <changyeon@google.com>
2019-12-13 03:20:34 +00:00
Changyeon Jo
b6f4830d89 Remove libBionicGtestMain
This change removes libBionicGtestMain from the dependency of
camera.v4l2_test target.

Bug: 134488555
Change-Id: Ia719f770b03fa1679bb9467f58806e64b05eb469
Signed-off-by: Changyeon Jo <changyeon@google.com>
2019-06-04 09:18:28 -07:00
Changyeon Jo
7451fc7e50 Fixes incorrect array initialization.
This change fixes an array initialization failure due to recent
resizing of camera_module structure's reserved variable.

Bug: 126418509
Change-Id: Ifda61b5427f317192976aee788d0e6849f7d189f
Signed-off-by: Changyeon Jo <changyeon@google.com>
2019-02-26 14:35:33 -08:00
Sergii Piatakov
79facac0f7 Merge "camera: add info about current status into README" am: 3d7f02b0ee am: 11f257623b
am: af36e97a4b

Change-Id: I95f2896055e353060c1a3395520aeb719e986832
2019-01-28 23:38:14 -08:00
Treehugger Robot
3d7f02b0ee Merge "camera: add info about current status into README" 2019-01-28 21:20:03 +00:00
Ivan Lozano
f2ce75ef3b Merge "Revert "Disable XOM in camera.v4l2."" am: 06ea58579b am: 36de427e99
am: ac77fa8c78

Change-Id: Ia803f91a5487bb0d42ecc73163c34c151795d1c3
2019-01-15 18:02:30 -08:00
Treehugger Robot
06ea58579b Merge "Revert "Disable XOM in camera.v4l2."" 2019-01-16 00:41:52 +00:00
Ivan Lozano
2bf3340e78 Revert "Disable XOM in camera.v4l2."
This reverts commit 7c7c62db25.

Reason for revert: libjpeg-turbo has been updated with XOM compatibility.

Change-Id: If1daae895f9cfe08c03169ed2546c81c51a94117
2019-01-15 22:17:46 +00:00
Ari Hausman-Cohen
662b32fcf2 Merge "camera: add a lock for the request tracker" am: 8c3812f639 am: 421cd310cf
am: 7bac9b0e96

Change-Id: Ie4877dd1169e99fe8e2dcfa64cc9a77de44492ae
2019-01-10 12:19:52 -08:00
Ari Hausman-Cohen
8c3812f639 Merge "camera: add a lock for the request tracker" 2019-01-10 19:01:26 +00:00
Sergii Piatakov
f16950bbf2 Merge "camera: remove redundant and unnecessary includes" am: 9dae907ea0 am: 547abc4ae4
am: eb83d293ff

Change-Id: I38c53a926e1cabd67c194714ca52e4f5f0b417e3
2019-01-09 17:22:16 -08:00
Treehugger Robot
9dae907ea0 Merge "camera: remove redundant and unnecessary includes" 2019-01-10 00:39:43 +00:00
Sergii Piatakov
807028ce53 Merge "camera: allow to get size of JPEG after conversion" am: 3664a25aa7 am: 18033cb5d5
am: ddcd9c949f

Change-Id: I00e6cba64605a7669b7fc127bb70cc2b83dda4bc
2019-01-08 17:49:39 -08:00
Treehugger Robot
3664a25aa7 Merge "camera: allow to get size of JPEG after conversion" 2019-01-09 01:23:12 +00:00
Ivan Lozano
3fac49442d Merge "Disable XOM in camera.v4l2." am: 1908ba0732 am: 6ca60bc346
am: c334599dfe

Change-Id: I730f62bfb2f28cf919614af3a5f7e0b8445079b0
2018-12-13 10:40:14 -08:00
Ivan Lozano
7c7c62db25 Disable XOM in camera.v4l2.
Disable execute-only memory layouts in camera.v4l2.

This relies on libjpeg_static_ndk, which contains some data mixed into
code and thus requires a readable .text.

Bug: 77958880
Test: Built the library, checked the program headers with readelf.

Change-Id: I5646b8c5e9a0ad151663df29f019b5a84db4b15c
2018-11-29 14:37:38 -08:00
Ari Hausman-Cohen
efc1372b00 Merge "camera: initialize smart pointer before usage" am: 8f89886dad am: b893b0cedb
am: c8083cac38

Change-Id: I11bdbcdb80fa772d17c9088f43c01581d00e7851
2018-10-31 11:59:00 -07:00
Sergii Piatakov
688d3bf720 camera: allow to get size of JPEG after conversion
The member function `ImageProcessor::GetConvertedSize` is called by the
`ImageProcessor::ConvertFormat` every time when conversion is performed.
But for JPEG destination format it leads to error. It is proposed to add
the handling of the JPEG format with postponed size calculation.

Test: try to take a picture via camera with YUYV output format.
Change-Id: I1ec564e2434361c82b5d93348511116494249f06
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-10-22 09:37:07 +03:00
Sergii Piatakov
16d9135088 camera: initialize smart pointer before usage
Test: try to scale image and get SIGSEGV crash of the `cameraserver`
      in the `CachedFrame` class.
Change-Id: I17ab13f7c9e7fc84cd38f89dce30e6e5e0535cc7
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-10-22 08:59:57 +03:00
Sergii Piatakov
b8f073fb8a camera: remove redundant and unnecessary includes
Remove unused or already included headers. Sort and format includes
accordind to the "Google C++ Style Guide". Replace C-headers by C++
analog when it's possible.

Test: build
Change-Id: I19fa6abb5bb68e0257c9c933e68f42f92b394ce7
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-10-18 13:39:48 +03:00
Sergii Piatakov
082a87bc0b camera: add info about current status into README
Test: n/a.
Change-Id: I9e62a8a6d8c04dac2c36bc483f011cb75ce20b2e
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-10-17 10:12:31 +03:00
Sergii Piatakov
48ac84b8be camera: add a lock for the request tracker
The request tracker manages "in flights" buffers and frames. These
two containers are modified by calling the tracker's member functions.
Such functions are called from at least three threads: (see
`v4l2_camera.cpp` for more details):
 - "main" thread;
 - separate buffer enqueue thread ("Enqueue buffers");
 - separate buffer dequeue thread ("Dequeue buffers").
It is proposed to introduce additional mutex for the request tracker
to prevent a race condition.

An alternative approach is introducing an additional mutex for the
shared containers inside the `RequresTracker` class. But such approach
requires more changes and may lead to problems with design in the
future.

This commit contains a few additional changes which are not directly
related to the topic:
 - as far as more than one local lock is used all of them are renamed;
 - the `mFlushLock` member is removed because it is completely covered
   by the new mutex.

Test: try to use a camera with more than one buffer and get SIGSEGV
      crash of the `cameraserver` in the `RequestTracker` class.
Change-Id: I2c1901722289cee9f0cb05a11a4dabe70d18f2ba
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-10-17 09:52:09 +03:00
Ari Hausman-Cohen
81b19617db Merge "camera: avoid narrowing of the ioctl request" am: eef57caed9 am: 3d22b204f2
am: 00d9bf50ec

Change-Id: Idfca5de8347a38c3ab2cf0da002e3a2e4657d5e2
2018-10-11 18:32:18 -07:00
Sergii Piatakov
028763d929 camera: avoid narrowing of the ioctl request
The `ioctl` take request of the `unsinged long` type but current
implementation narrows it up to `int`.

Test: if add something like this into `IoctlLocked`:
      ```
      switch (request) {
        case VIDIOC_QBUF: break;
        default:;
      }
      ```
      the following error is appears: "error: case value evaluates
      to 3227014671, which cannot be narrowed to type 'int'
      [-Wc++11-narrowing]".
Change-Id: Icb1c99e082feb0c019393205a4b0b717ddc09c05
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-10-10 17:49:02 +03:00
Steve Fung
b665e095a7 Fix v4l2 camera HAL to compile with version 2.5
The camera module API version 2.5 added a new function,
dropping the number of reserved to 4.

Bug: None
Test: Builds
Change-Id: Ib3df07481ba54509a1215e642ccf70d0b1d4dd2c
2018-09-18 12:27:44 -07:00
Sergii Piatakov
628e9d98e7 camera: replace -Wno-error flag with -Werror
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: Ib7227f189cdcd52698ef1a70b1ad03b2351cb55f
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-13 09:00:05 +03:00
Sergii Piatakov
de617f0677 camera: fix -Wunused-function compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: I96926932e7b11230d6c22fb081a89946f670511e
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:39:32 +03:00
Sergii Piatakov
21583568a8 camera: fix -Wpessimizing-move compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: I464761128a09d90415ee6ac1ef1244391edb0b54
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:39:32 +03:00
Sergii Piatakov
6a4d4d59bc camera: fix -Wmissing-field-initializers compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: I2c17b1e40b29ac400e0a950a9cd96d7f9404ea32
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:39:32 +03:00
Sergii Piatakov
64e7f2013b camera: fix -Wsign-compare compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: I47ee9e39c3bfee7927f4e57dfec459714c959e14
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:39:23 +03:00
Sergii Piatakov
416b6d263f camera: fix -Wunused-variable compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: I2755278b739db0bb746a78d0b66e1f644a44ff19
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:37:02 +03:00
Sergii Piatakov
752836d7a6 camera: fix -Wunused-private-field compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: I113e14a4296e098a6a04068262186aa8cb81fba7
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:37:02 +03:00
Sergii Piatakov
1bd0addfc9 camera: fix -Wreorder compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: I02cbe738fb7484e3a1d55712b0f0a55037e181e1
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:37:02 +03:00
Sergii Piatakov
4d3eb7a33f camera: fix -Wunused-parameter compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: I1bfd688902c78fe69bfbee3bacc73c25a5ef6c5c
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:37:02 +03:00
Sergii Piatakov
a01d1f8233 camera: fix -Wformat compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: Ib1d1fc2de98436dd7e9d15ab324789725bb2002e
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:36:42 +03:00
Sergii Piatakov
2ad591f9ea camera: fix -Wmacro-redefined compiler warnings
Test: add `USE_CAMERA_V4L2_HAL := true` to
      hardware/libhardware/modules/camera/3_4/Android.mk and build
      mmm hardware/libhardware/modules/camera/3_4
Change-Id: Ida00d842007e2a589907bc4fd1887076fd8b5b2a
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-08-10 14:16:05 +03:00
Dmitry Shmidt
9df082e933 camera 3_4: Fix compilation errors
Compile Error:
hardware/libhardware/modules/camera/3_4/camera.cpp:502:9: error: non-constant-expression cannot be narrowed from type 'std::__1::vector<camera3_stream_buffer, std::__1::allocator<camera3_stream_buffer> >::size_type' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
        request->output_buffers.size(),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Test: Add to device.mk
        USE_CAMERA_V4L2_HAL := true
        PRODUCT_PACKAGES += camera.v4l2
      mma

Change-Id: Ia6bbd6bac06540214d2c6167a8826f3f4c946e57
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2018-01-24 12:34:00 -08:00
Prashanth Swaminathan
28e0f76353 v4l2 camera: port ARC++ image processing code
Utiltizes ARC++ image processing code to perform the conversion between
the camera format and the requested format from the framework. In order
to support USB devices which may not implement the required formats,
conversion between YUYV/MJPEG to the request format is done on-the-fly.

TEST: All existing unit tests pass. Tested manually with the camera
sample APK, preview/video/capture in both JPEG and YUV formats. Tested
on the RPi v2 Camera, the Logitech C270 and the 180 degree Fisheye USB
camera.
Bug: 37708856, Bug: 69983918
Exempt-From-Owner-Approval: This HAL is owned by AT team.
Change-Id: I1a54581d1170fa3270036ec366fb613fe587a094
2018-01-10 12:39:23 +09:00
TreeHugger Robot
f78d716b89 Merge "Support native camera resolutions" 2018-01-04 06:31:28 +00:00
Josh Gao
9eb0a7b073 Merge "Don't TEMP_FAILURE_RETRY on close." am: e1c003dc11 am: 7f4b73fb1a
am: 619653d7b1

Change-Id: I1f896a59da33be27a5d81362a6a1897f0ec277cf
2017-12-29 00:29:48 +00:00
Treehugger Robot
e1c003dc11 Merge "Don't TEMP_FAILURE_RETRY on close." 2017-12-29 00:19:21 +00:00
Josh Gao
09a3af5e11 Don't TEMP_FAILURE_RETRY on close.
close always succeeds, even if it was interrupted and "fails" with
EINTR. Retrying will either close a nonexistent fd or stomp on another
thread's newly opened file descriptor.

Bug: http://b/20501816
Test: treehugger
Change-Id: I706d5e8027e60b13f23f9488fdf5cf7cef7b3d3b
2017-12-28 14:21:32 -08:00
Dan Willemsen
844c74a750 Merge "Convert to Android.bp" am: 90e0a80af3 am: 243ba5e7b2
am: 90955e6a6a

Change-Id: I8e4e8c784b4e6630b7d062c4238d8c885111df30
2017-12-28 19:38:41 +00:00
Dan Willemsen
86e247ae89 Convert to Android.bp
See build/soong/README.md for more information

Test: mmma hardware/libhardware
Change-Id: Ibb7e2af9d55f581e951d8996cea5e52cd0766b04
2017-12-27 11:05:29 -08:00
Jaesung Chung
932d4dddd9 Support native camera resolutions
This CL makes camera HAL support native camera resoultions up to
3280x2464, which is the maximum camera resolution of RPi3's camera
module version two.

Bug: 69983703
Test: Verified with ThingsCameraQA.apk
Exempt-From-Owner-Approval: V4L2 camera HAL is owned by iot team.
Change-Id: I303e763e87bdfc5ae81d398aac8be0730e57b05d
2017-12-26 03:09:59 +00:00
Chih-hung Hsieh
fbb4c361fb Merge "Allow warnings in modules/camera/3_4." am: 1d83294190 am: 37724db429
am: 94202cf12e

Change-Id: I714a5fcd60d00f2811d15be614229fa25d50ef85
2017-12-20 02:06:55 +00:00
Chih-Hung Hsieh
87ef6ef33d Allow warnings in modules/camera/3_4.
* This directory still has many warnings to fix.

Bug: 66996870
Test: normal build
Change-Id: I0e05b78eca9d58dc9081bb3810f5ccabadfc21a7
Exempt-From-Owner-Approval: quick fix for broken build
2017-12-19 17:52:51 -08:00