Commit graph

3009 commits

Author SHA1 Message Date
Ari Hausman-Cohen
cb11a4df53 Add request tracking.
RequestTracker keeps track of how many buffers are in flight for
each stream, and what frame numbers correspond to what requests/buffers.

BUG: 31044638
TEST: unit tests pass

Change-Id: I8ef3fcacdf8171514ea7f7eaf77301a641bff61e
2016-09-21 16:42:57 -07:00
Ari Hausman-Cohen
ffb9b72e4e Add configs & validation to static properties
Static properties read and validate stream configurations,
stall durations, and reprocess formats.

Static properties can be used to validate a given
camera3_stream_configuration_t to check if the streams
all work together as defined by the metadata properties.

BUG: 31044638
TEST: unit tests pass
Change-Id: I2c8eecb680cd86fbe0340c07e4d73bd25429b4e9
2016-09-20 18:03:04 -07:00
Ari Hausman-Cohen
737cfd31a6 Add stream capabilites to metadata reader
Read configs, stall durations, and reprocess formats.

BUG: 31044638
TEST: unit tests pass

Change-Id: I9089de0d51b7c4d8ef940a3737785177f257382f
2016-09-20 15:28:27 -07:00
Ari Hausman-Cohen
f45f8d4fa1 Add StaticProperties and MetadataReader
MetadataReader provides a clean wrapper around getting
and translating certain metadata values in a nice form.

StaticProperties will be used by Camera as the source of
truth for metadata properties, extracted directly from a reader,
rather than calling down into the device again.

BUG: 31044638
TEST: unit tests pass
Change-Id: I712a80f87e629a7288c678637de0eae0225acf96
2016-09-16 14:34:28 -07:00
Ari Hausman-Cohen
e7e93ca678 Move V4L2 camera HAL work to libhardware
BUG: 31117512
2016-09-01 14:55:17 -07:00
Ari Hausman-Cohen
d77917bde2 Move Camera HAL 3.0 reference implementation.
Moved files to a subdir to allow reference implementations
of other versions to join this same space without conflict.

Chery picked from master.

BUG: b/31117512
TEST: lunch bullhead-eng, make -j32, m -j32 camera.default
Change-Id: I9bc3047bd3c00c53ce4d4e4f2070d8ee1453c936
2016-08-31 13:42:54 -07:00
Ari Hausman-Cohen
9430ad946f Clean up format of V4L2Camera and V4L2CameraHAL.
BUG: 30224839
TEST: unit tests pass
Change-Id: I0d41927fb6e56cf32f5e04a3fe98be1139e6c4a8
2016-08-30 18:19:31 -07:00
Ari Hausman-Cohen
abbf9cc0bd Plug in metadata refactor.
Replaces metadata usage in Camera/V4L2Camera with the
new Metadata class.

Switches Camera from camera_metadata_t to android::CameraMetadata
where appropriate for ease of use/clarity of ownership.

Also cleaned up some "error" logs that were potentially expected,
leaving it to the caller to log if something goes wrong, since
they were numerous and cluttering the log feed.

BUG: https://b/30140438, https://b/29335262
TEST: unit tests pass, test picture program still works,
  tested setting a V4L2 control to a non-default value.
Change-Id: I24e50c9b71736dfc576debf8d09dbe36b9bbf23a
2016-08-30 18:18:28 -07:00
Ari Hausman-Cohen
cf5f57f263 Add states to metadata.
States are dynamically changing values. For now
none of them have implementations; they're all fixed
values.

BUG: 30140438
TEST: unit tests pass
Change-Id: I60f97fce5db4542e6b77694bb323934e32eab9f6
2016-08-29 17:24:58 -07:00
Ari Hausman-Cohen
784bc68d3c Added default metadata entries.
Default entries for controls/properties that could theoretically
be queried from/controlled by V4L2, but are not yet implemented
in this HAL.

BUG: 30140438
TEST: unit tests pass
Change-Id: I78264f3f0d37b41614b24ef71000fee175a3bb17
2016-08-24 17:14:40 -07:00
Ari Hausman-Cohen
1026477818 Add default template initialization.
Adds a flow for Metadata to initialize templates.
PartialMetadataInterfaces expose another populate method,
which use a default value getter from ControlOptionsInterfaces.

BUG: 30140438
TEST: unit tests pass

Change-Id: I1c01469dcf4d06f7c4c62ebe2acd3d9b2294a161
2016-08-24 17:14:40 -07:00
Ari Hausman-Cohen
ffdc628720 Add V4L2 Format Metadata Factory.
This factory queries the device for the properties detailing
what formats it supports. Since this may fail, Metadata/V4L2Metadata
was moved from the weird inheritance/constructor stuff it was doing
to Metadata having a better constructor and V4L2Metadata being a
factory.

BUG: 30140438
TEST: unit tests pass

Change-Id: Id4bcb27fbd8b517e3a9a8e9fb8a984af139254b3
2016-08-24 17:14:36 -07:00
Ari Hausman-Cohen
6cd3fe9b14 Add V4L2 Control Factory
Also moves all control factory methods into a separate file.

BUG: 30900438
TEST: unit tests pass
Change-Id: I885903d8e23a548b63fd20006568145a233c0316
2016-08-22 15:56:18 -07:00
Ari Hausman-Cohen
fd0ecb791c Switch to composition over inheritance.
Switches v4l2_metadata over to the updated controls/properties
using inheritance over composition. Slight regression
in that the V4L2-based control factory method was removed,
will be replaced (and improved) in a CL soon.

BUG: 30140438
TEST: unit tests pass
Change-Id: I636fef67cd3ceeb3ebf9853d04b068988c4c4944
2016-08-17 10:59:51 -07:00
Ari Hausman-Cohen
9bd94f5581 Add tagged control delegates/options.
Simple wrappers that associate a control delegate
or set of control options with a corresponding
metadata tag.

BUG: 30140438
TEST: unit tests pass

Change-Id: Ib4d769f4a860d661128c8af47d317937d96feb96
2016-08-17 10:59:51 -07:00
Ari Hausman-Cohen
899426f581 Add control delegates.
Part of moving towards composition over inheritance.

Ignored: Requests to set are ignored.
NoEffect: Tracks a value but does nothing.
V4L2: Goes through a V4l2 device.

TEST: unit tests pass
BUG: 30140438
Change-Id: I9ca636556f4a6ddfe4b8ddfbd042371ed56343b9
2016-08-17 10:59:42 -07:00
Ari Hausman-Cohen
e2a9a01296 Add menu and slider options.
ControlOptionsInterfaces for lists and ranges.

BUG: 30140438
TEST: unit tests pass
Change-Id: I7bcb63777600cff18347c8eae54112025b6556b3
2016-08-16 18:20:35 -07:00
Ari Hausman-Cohen
8c13aaf1ac Add Control/State Interfaces.
These interfaces will be used to increase composition
and decrease inheritance in the metadata controls.

ControlDelegates are responsible for getting/setting values,
While ControlOptions are responsible for validating values
(breaking these two apart allows, for example, unused sliders
and unused enums to share the same ControlDelegate, but have different
options, with minimal code duplication).

StateDelegates are for read-only values that may change.
ControlDelegate inherits from this because it will allow
the State interface to be passed around, while one owner
maintains control of updating it behind the scenes.

BUG: 30140438
TEST: unit tests pass. Interfaces only so no new tests
Change-Id: I8042c1ccf97655558f45a1f8411e3a4a36de7506
2016-08-16 18:20:16 -07:00
Ari Hausman-Cohen
1760aa2912 Add scaling converters and secondary converters.
Scaling converters scale, as the name implies.

The two wrapping converters, map & ranged sanitize
data for sending to V4L2, either converting a value
to be within a map, or within a range, respectively.
(These are intended for use with V4L2 int menu and int
controls, respectively).

TEST: Unit tests pass
BUG: 30140438
Change-Id: Ie7d86118e00c0b59e6457fc16449228706098952
2016-08-16 14:08:52 -07:00
Ari Hausman-Cohen
f60dcc25c3 Add enum converter.
Converts between two different enumerations.

BUG: 30140438
TEST: Unit tests pass
Change-Id: I0976c440f0a48491fa52d26e173808917d53ebe7
2016-08-15 18:41:45 -07:00
Ari Hausman-Cohen
61399b5945 Merge "Use extended get/set controls." into nyc-jaqen-dev 2016-08-15 22:00:14 +00:00
Ari Hausman-Cohen
872ec62e0f Adds a simple conversion interface.
Using composition for conversion will allow more
code to be shared by different V4L2 controls.

BUG: 30140438
TEST: unit tests pass
Change-Id: I467efc72d71b9593d2476a61615fa44f7a975649
2016-08-12 15:49:09 -07:00
Ari Hausman-Cohen
7a1fba6127 Use extended get/set controls.
The normal G_CTRL and S_CTRL ioctls are only intended
for the basic user control interface. For the HAL,
we want access to quite a few extended controls as well.

BUG: 30140438
Change-Id: I750e9b1dc5e9e18cf5ad25daf1e1c1e34e756169
2016-08-10 14:38:42 -07:00
Ari Hausman-Cohen
5d7532337a Style fixes.
Was previously running the clang-format command incorrectly;
was not using the .clang-format file, and so was formatting
in some different style.

Change-Id: I09e81b919d1e6d40a56eb4f3f519aaed281a0c86
TEST: unit tests pass
2016-08-10 14:27:36 -07:00
Ari Hausman-Cohen
c7abfe7448 Add V4L2EnumControls to V4L2Metadata.
Add all current enum controls and their mappings
to the metadata constructor.

BUG: https://b/30140438

Change-Id: Ie4a5b89d8bc4bc75531425e5fc8bfb4a181b0a03
2016-08-09 13:52:12 -07:00
Ari Hausman-Cohen
3a4c3bba32 Add v4l2 enum controls.
Some V4L2 controls are simple enum menus, and are directly
analagous to metadata controls. The new V4L2EnumControl class
is a generalized converter between the two.

BUG: https://b/30140438, https://b/29394024
TEST: unit tests pass

Change-Id: I9f8bed200e21cb7e3f3336608fe210f094b7aa42
2016-08-09 13:52:02 -07:00
Ari Hausman-Cohen
e55f0c795c Refactor static functions.
Common static functions for manipulating metadata moved
from patial_metadata_interface to metadata_common.h

Common static functions for comparing equivalence with
metadata for tests moved to test_common.h

BUG: 30140438
TEST: Unit tests pass

Change-Id: I4310b4ff05bdd68f7f92f533028989914d0f4c82
2016-08-09 13:43:08 -07:00
Ari Hausman-Cohen
9e6fd98945 Add format querying.
Query formats, sizes, and frame rates.

BUG: https://b/29394024, https://b/30605346
TEST: Test java program shows a bunch of formats & rates,
can take pictures in different sizes now.

Change-Id: I203fd8f200dda79cf6946c58f130548b05269fbd
2016-08-08 16:29:21 -07:00
Ari Hausman-Cohen
183ffc3cde Add ignored controls to v4l2_metadata.
BUG: 30140438
Change-Id: If3891e4c59bb8e510e626fdc13a5e1d7e2f29ba9
2016-08-04 18:47:09 -07:00
Ari Hausman-Cohen
b03fabba70 Add ignored controls metadata.
Ignored controls are optioned controls where the value
set by the user is tracked, but doesn't actually matter.

BUG: 30140438
Change-Id: I45819c3c6c855922418f76fd34309a44660fc3f0
TEST: unit tests pass
2016-08-04 18:47:09 -07:00
Ari Hausman-Cohen
5b7968ce61 Add abstract optioned control class.
An optioned control is a control with a fixed list of
accepted options.

BUG: 30140438
Change-Id: Ibf82840629cb23f9082889058f7d11350beffb2a
TEST: unit tests pass
2016-08-04 18:47:09 -07:00
Ari Hausman-Cohen
6c63b50e3a Add abstract control class.
Partial implementation of tagged_partial_metadata. A control
is a value that can be changed.
Implements supported/get/set of parent class, abstracting
into simpler supported/get/set methods for children to implement.

BUG: 30140438
Change-Id: Iaba6fc2f54f6a8786c5ca379972ee1da9604c7a3
TEST: unit tests pass
2016-08-04 18:47:02 -07:00
Ari Hausman-Cohen
ab3a0a4620 Add fixed properties to v4l2_metadata constructor.
BUG: 30140438
Change-Id: I371d00a19d89b439e72805a1bd9b23fc42ee8400
2016-08-04 18:40:44 -07:00
Ari Hausman-Cohen
5156c2d1c9 Add metadata class for fixed properties.
Fixed properties are, as the name implies, just a single
value that doesn't change.

BUG: 30140438
Change-Id: I2d8d10f16a3665532946a8abca17d01f5c022fdc
TEST: unit tests pass
2016-08-04 18:35:58 -07:00
Ari Hausman-Cohen
407cca9753 Add abstract property class.
Partial implementation of tagged partial metadata.
Has a single static tag and implements the populate/supports/set
methods. Adds Value() virtual method that must be overriden.

BUG: 30140438
Change-Id: I2b4927e0d3550235106593cc1ba501c95ba9d2c4
2016-08-04 18:35:52 -07:00
Ari Hausman-Cohen
980bc399c1 Add tagged metadata subclass.
Partial implementation of partial_metadata_interface.
Implements a fixed set of tags at constructor time.

BUG: 30140438
Change-Id: Ie5bde7abf822191ee643d663705f39ba12147ba3
2016-08-04 18:32:57 -07:00
Ari Hausman-Cohen
bb99e02dcc Add helper functions to update metadata.
Templated to fit various types of metadata.

BUG: 30140438
Change-Id: I9c22be63eacbaddf465cf3b98d6fb7ea95abeabf
TEST: unit tests pass
2016-08-04 18:27:05 -07:00
Ari Hausman-Cohen
99f3ea02d0 Change v4l2_wrapper set control to accept null.
User does not need to pass a result pointer if they
don't care about the result.

BUG: 30140438

Change-Id: Ia98870f24df82464a3f00aad63a599063b98f03a
2016-08-04 15:33:50 -07:00
Ari Hausman-Cohen
b1af4ff795 Have Metadata use android::CameraMetadata.
Ownership is much more clear than with the various double
raw metadata pointers.

BUG: 30140438
TEST: unit tests pass

Change-Id: Ib0de3bb4b9e6dc30594230e46f40ffaea06df51d
2016-08-04 15:33:33 -07:00
Ari Hausman-Cohen
10481a3ec9 Separated v4l2_metadata into two pieces.
v4l2_metadata and metadata/metadata. The previous design did not work
as intended for testing (it incorrectly assumed that a constructor
would call an overridden method of a child class), plus this way
makes more sense.

BUG: 30140438
Change-Id: I1293535932fed6daed766682421b1215739e17dd
TEST: Unit tests pass
2016-08-02 11:15:50 -07:00
Ari Hausman-Cohen
b41aade35e Move array_vector.
Once refactor is complete, it will only be used by metadata.

Change-Id: Ie1e203f558f2f9a12c3be949d98454341648ee9d
2016-08-02 11:15:39 -07:00
Ari Hausman-Cohen
d318ed9b30 Changes some partial metadata methods to const.
Methods that should have been marked const were not.

BUG: 30140438
Change-Id: If73e1249dcf328fdde2d3b64d0bc2c200da45e8f
TEST: Unit tests pass
2016-08-02 11:15:30 -07:00
Ari Hausman-Cohen
cd9fef66f9 Add metadata helper class.
Breaks metadata down into distinct pieces (to be added later).

BUG: 29330282
TEST: unit tests pass

Change-Id: I7156e420e7cdb14b5c3155006ecefd8ff2a49500
2016-07-28 18:33:11 -07:00
Ari Hausman-Cohen
3841a7f495 Style fix: renaming and include guards.
Fixes file name style and include guard style, before
even more and more files get added.

BUG: 30224839
Change-Id: Ie5ebcf14672c7e9d3faae86b88d4f62b516ae00d
TEST: test program that takes a picture still works.
2016-07-25 11:00:34 -07:00
Ari Hausman-Cohen
660f8b858d Replace V4L2 calls in V4L2Camera with wrapper.
Also updates naming of max streams to be in line with what they
technically are, not what they usually are (i.e. a non-stalling
processed stream is usually YUV, but not necessarily).

BUG: 30140438

Change-Id: Idb78c466a41c9c0e5957200fc7c8afc0cfdb88a6
2016-07-25 10:59:59 -07:00
Ari Hausman-Cohen
4ab4962420 Add buffer management to V4L2 wrapper.
Functions to enqueue and dequeue buffers.
Extended gralloc helper with a mass-unlock function.

Change-Id: I72c83138fd37463d314bf02b5df5befc68bc05af
2016-07-25 10:58:29 -07:00
Ari Hausman-Cohen
681eaa283f Refactor camera initialization support of gralloc.
Switch to a factory model so that initialization can
fail when the gralloc module can't be found or isn't supported.

BUG: 30140438
Change-Id: I6e0a62a207797aef96c532cff7632c1a4da8818f
2016-07-25 10:52:10 -07:00
Ari Hausman-Cohen
24e541c925 Revert "Revert "Paint buffers, basic result metadata.""
This reverts commit a147f83c8c58f078fad95f99a19ac4441bcb5914.
Was reverted originally due to an issue in a parent CL. Now
that has been fixed, and this CL can be reinstated.

Change-Id: Ie281b6cc80705d8843572f21edde2398c892e35b
2016-07-21 13:24:14 -07:00
Ari Hausman-Cohen
3eece6ffdc Add helper class for dealing with gralloc.
This reverts commit a485a7e60db95039df5de82119e47878372550ac
(which reverts the original version of this CL).

Fixed build errors - put reinterpret_cast around delete [] in
V4L2Gralloc destructor, and fixed missing parens around another
reinterpret cast.

BUG: 29335262
Change-Id: Iaa5a71afef8850ba499cb1a7159a831da4f7014a
2016-07-21 11:17:52 -07:00
Ari Hausman-Cohen
c17fd09be8 Abstract V4L2 controls into wrapper class.
This abstraction will both clean up the code in V4L2Camera.cpp, and make it
easier to implement tests in the future (by mocking over the class).

This CL only adds the class and implementation, it does not yet replace
the logic in V4L2Camera.cpp.

Also gates building the module, to prevent checkbuilds without the
proper v4l2 kernel headers from trying to build it.

BUG: 30140438
Change-Id: I4e5feee30fdf896b1f71f0df492ca313f5581e78
2016-07-20 15:48:51 -07:00