Commit graph

18 commits

Author SHA1 Message Date
Caroline Tice
24340057e9 Eliminate false positive static analyzer warnings.
The compiler static analyzer is issuing several false positive
warnings for the file system/core/libadf/adf.cpp:
line 134: warning: Attempt to free released memory
line 240: warning: Use of memory after it is freed
line 454: warning: Use of memory after it is freed
line 553: warning: Attempt to free released memory
line 568: warning: Use of memory after it is freed
line 645: warning: Potential leak of memory pointed to by 'engs'
line 653: warning: Potential leak of memory pointed to by 'filtered_engs'

After careful analysis of the source I have come to the conclusion
that these are false warnings.  This CL annotates the source so the
static analyzer won't issue these warnings any more.

Bug: None
Test: The warnings are no longer being issued.
Change-Id: I158756b3f1eeb66f346be3cd2ffe10ebde236c80
2017-09-26 15:27:37 -07:00
Jiyong Park
4729da4c8a libadf is a new member of VNDK
The library is used by both platform (e.g. libminui) and vendors (for
theor HW composer HAL impl).

Bug: 64050301
Test: 2017 pixel devices build
Test: libadf.so is in /system/lib[64]/vndk directory
Change-Id: I20b8b9728cdc56a7491266070740c3330d4324dc
2017-09-06 13:31:12 +09:00
Greg Hackmann
dc80973726 libadf: convert to C++
Both humans and the clang static analyzer find libadf's error handling
confusing.

Now that the platform has better C++ support, we can clean up things up
by switching to C++ and using STL + RAII in targeted parts of the code.
This isn't a complete rewrite in idiomatic C++, but it's enough to get
rid of all the "goto" statements (and the false-positive memory leaks
found by clang's static analyzer).

Bug: 27125399

Test: WITH_STATIC_ANALYZER=1 mmm system/core/adf/libadf
Test: /data/nativetest/adf-unit-tests/adf-unit-tests (on Nexus 9)
Test: /data/nativetest64/adf-unit-tests/adf-unit-tests (on Nexus 9)
Change-Id: Ie9dd5d5dc424d1a3ddcc3cba836fce04190f46fd
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-02-22 21:18:48 +00:00
Greg Hackmann
52ae36ed57 libadf: adf_test: fix crash on adf.devices failure
If devs is uninitialized and adf_devices() fails, we'll end up passing
the uninitialized pointer to free().

Test: /data/nativetest64/adf-unit-tests/adf-unit-tests (on Nexus 9 w/o root)
Change-Id: Ifc6038c1da14d32ee564675bac54fc7df2623c1d
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-02-22 11:07:15 -08:00
Greg Hackmann
095da6fb73 libadf: support ADF_{POST,SIMPLE_POST}_CONFIG_V2 ioctls
adf_{device,interface_simple}_post_v2 let the client choose what kind of
fence is returned from the kernel:

* ADF_COMPLETE_FENCE_NONE: no fence is returned
* ADF_COMPLETE_FENCE_PRESENT: the returned fence fires when the
  specified configuration appears on the screen
* ADF_COMPLETE_FENCE_RELEASE: the returned fence fires when the
  specified configuration is removed from the screen

The "V2" calls with fence type ADF_COMPLETE_FENCE_RELEASE are functionally
equivalent to "V1" calls.

Test: included gtest (on Nexus 9)
Change-Id: I36190d1b6cea0fbaed2af3ad64fa4729200c5520
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-02-14 16:06:05 -08:00
Greg Hackmann
fe79bcbef8 libadf: move ADF uapi header out of bionic
ADF isn't a candidate for upstreaming and isn't (directly) usable from
unprivileged NDK code, so it makes more sense to keep video/adf.h as a
private header inside libadf, where it'll still be usable by HWC
implementations without shipping in the NDK.

libadf exports its entire include/ directory, so this shouldn't have
any impact on HWC implementations that already link against libadf.

Test: mmm system/core/adf/libadf
Test: /data/nativetest64/adf-unit-tests/adf-unit-tests (on Nexus 9)
Change-Id: I14532d59005196e002f7465474ac3c7cc9e59bd3
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-01-31 23:08:26 +00:00
Greg Hackmann
09f8f986a9 libadf: adf_test: fix clang + kati build
kati needs us to add "tests" as a subdir of the libadf Android.bp.
clang also requires an explicit definition of AdfTest::dev_id where
g++ does not.

Test: mmm system/core/adf/libadf
Test: /data/nativetest64/adf-unit-tests/adf-unit-tests (on Nexus 9)
Change-Id: I1fc371af1b5b115f088edd963a87e6647a52882b
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-01-31 22:55:46 +00:00
Dan Willemsen
45f05240c2 Convert more Android.mk files to Android.bp
These modules have their dependencies satisfied, and aren't doing
anything strange.

Change-Id: I72039a15256cbd5e5eee0d79a15d66d74a6c087d
2016-07-13 17:41:45 -07:00
Andreas Gampe
a9f0a80c52 Adf: Remove unused variable
For build-system CFLAGS clean-up.

Bug: 18632512
Change-Id: Iaacfc08aeaf1a3f27771a136f2c977e54971257b
2015-07-27 22:08:16 -07:00
Greg Hackmann
e6b793c7b0 libadf: enable -Werror
Bug: 19606869

Change-Id: If2ea55732e71e8288641b6b34d229b367fd3fb3b
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2015-03-10 15:14:38 -07:00
Greg Hackmann
39b0c1c67d libadf: tests: fix signed/unsigned comparison warnings
Bug: 19606869

Change-Id: I29cfa363b6640cc13973c1023d2f4ea1a97e3af2
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2015-03-10 15:14:38 -07:00
Elliott Hughes
3d74d7a739 Add missing includes.
Change-Id: Iaa130c0a7eb2cbc0c8486546e5b622661b6d9e23
2015-01-29 21:31:23 -08:00
Greg Hackmann
bfdbb2fcf0 libadf: add tests for various failure modes
Change-Id: I1b13e84c6663cb73af2829bedd3514119a01764c
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2014-05-07 15:28:05 -07:00
Greg Hackmann
29925dcc89 libadf: add tests
Change-Id: I353099bf194d4d566c720e44190ad34f407f3dce
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2014-05-07 15:28:05 -07:00
Greg Hackmann
20fcb78e58 libadf: silence false positive warning
Some versions of gcc warn that intfs may be used uninitialized

Change-Id: I3b8d7e919e9c2902ac56adeabd09a45ececfb3c4
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2014-05-07 15:27:59 -07:00
Greg Hackmann
1832635319 libadf: add helper to set up a simple post
Change-Id: I381b47f924b02c208ea6f20cf887abdef1035830
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-11-26 15:40:02 -08:00
Greg Hackmann
47e0c8d849 libadf: filter overlay engines by a list of acceptable formats
Change-Id: Ibb294f0520a7a7a6a2a89e1e3eb3c335906d3e66
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-11-26 15:40:02 -08:00
Greg Hackmann
b85d12a307 add libadf
Helper library to enumerate ADF objects, wrap ADF ioctls, and read event
data

Change-Id: I7aa7f88935174e650a40b2f9db3212280121f760
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-11-26 15:39:50 -08:00