Commit graph

247 commits

Author SHA1 Message Date
Steven Moreland
913c071391 Update comments for doc comments.
Doc comments look like "/** ... */" and they
can only be in certain places.

Bug: 79865343
Test: m
Change-Id: Ic15c08ff7dc6e4f9827c1dbe7f7236c11a572ec1
Merged-In: Ic15c08ff7dc6e4f9827c1dbe7f7236c11a572ec1
2018-05-21 14:36:29 -07:00
Dan Stoza
9f20633e6c HWC2On1Adapter: Fix fd leak in Layer::dump
Removes the fence dump from Layer::dump, since:
  a) It was leaking (a dup() without a close())
  b) It's not that useful anyway since it wasn't displaying the actual
     fence fd

Test: Manual
Bug: 73979009
Change-Id: I8f7446a05a1bab8c3ca781610ebeb98d17fa483b
2018-04-26 12:52:35 -07:00
Chia-I Wu
34dc4ddd4b graphics: add libhwc2on{1,fb}adapter
Moved from frameworks/native.

Test: build
Change-Id: I03bf1d073306aaa2ce155aee50fb9ac056906323
Merged-In: I03bf1d073306aaa2ce155aee50fb9ac056906323
2018-03-30 11:03:15 -07:00
Yuexi Ma
fa7f2bc917 Merge "Update vts test module bp files to use VtsHalTargetTestDefaults" 2018-03-26 21:57:41 +00:00
Lloyd Pique
56375fda7c Fix crash on hotplug disconnect
ComposerClient destroys its internal model of the display while handling
the onHotPlug event from the Hwc. Subsequently SurfaceFlinger destroys
its model of the display, and destroys all Hwc layers associated with
the display.

This fixes the code for destroying layers to not dereference an invalid
iterator if the display does not exist, allowing destruction to
continue.

It also fixes a similar issue which could occur if a HWC layer is being
created for a display at around the same time as the disconnect event.

Test: hotplug disconnect no longer crashes
Bug: 38464421
Change-Id: I0f2d28fe89fccf997b4bbb9fa6b5c0e6a6e49b93
Merged-In: I0f2d28fe89fccf997b4bbb9fa6b5c0e6a6e49b93
(cherry picked from commit 2765f9d406)
2018-03-23 22:30:46 +00:00
Yuexi Ma
d56539e62a Update vts test module bp files to use VtsHalTargetTestDefaults
Test: make vts
Change-Id: I3c0dab52dc894e1a1fc9b99be1351ed7bd380502
Merged-In: I3c0dab52dc894e1a1fc9b99be1351ed7bd380502
2018-03-22 23:36:10 +00:00
Chia-I Wu
5255c35a70 graphics: move libVtsHalGraphicsMapperTestUtils
Move libVtsHalGraphicsMapperTestUtils from 2.0/vts/functional/ to
2.0/utils/vts/.  Run clang-format.

Test: VTS
Change-Id: I1e87129cbdc12167160f7e2f1cd76478e88bbf41
2018-01-31 15:11:50 -08:00
Chia-I Wu
821c4c4a9d graphics: make mapper default impl a header library
Reimplement the default impl as a header-only library,
android.hardware.graphics.mapper@2.0-passthrough, based on the HAL
support library.

Effectively, this renames Gralloc[01]Mapper to Gralloc[01]Hal, and
make adjustments here and there to meet the requirements of the HAL
support library.  This also adds GrallocLoader to load either of
Gralloc[01]Hal and create an IMapper instance.

libgrallocmapperincludes is renamed to follow the new naming and
include path conventions.

Test: boots and VTS
Change-Id: I924cadce9a10a6e544f99ceba63aadc38ec431ac
2018-01-31 15:11:50 -08:00
Chia-I Wu
fd1924f6f5 graphics: add mapper HAL support library
Add a header-only support library
android.hardware.graphics.mapper@2.0-hal that can be used by
implementations.  There are two classes in the support library.
MapperHal is an abstract class to be implemented by implementations.
Mapper is an implementation of HIDL IMapper interface on top of
MapperHal.

An implementation can

  class VendorHal : public MapperHal { ... };

  auto mapper = std::make_unique<Mapper>();
  mapper->init(std::make_unique<VendorHal>(...));

Or, if vendor extensions are to be added to the IMapper,

  class MapperHalExt : public MapperHal { ... };
  class VendorHal : public MapperHalExt { ... };
  class MapperExt : public MapperImpl<IMapperExt, MapperHalExt> { ... };

  auto mapper = std::make_unique<MapperExt>();
  mapper->init(std::make_unique<VendorHal>(...));

Test: builds
Change-Id: Ib23c1f5977744f7e116bb93db53e882e2dad7ce3
2018-01-31 15:11:50 -08:00
Chia-I Wu
422b94e002 graphics: make allocator passthrough library header-only
android.hardware.graphics.allocator@2.0-passthrough should be a
header-only library to be fully reusable by vendor HALs.

This also allows us to switch from virtual inheritance to templates,
which is more straightforward.  This changes nothing to the users
and we still have these relations

 - AllocatorHal is an abstract class to be implemented by vendors or
   the default implementations
 - Gralloc[01]Hal are our default implementations
 - Allocator implements HIDL IAllocator interface on top of
   AllocatorHal

What we do not like about virtual inheritance is that, given

  // abstract class B and D
  class B {
    virtual void foo() = 0;
    virtual void bar() = 0;
  };
  class D : public virtual B {
    // foo is superceded by fooEnhanced in D
    void foo() { fooEnhanced(); }
    virtual void fooEnhanced() = 0;
  };

  // an implementation of B
  class BImpl : public virtual B {
    void foo() {}
    void bar() {}
  };

  // an implementation of D on top of BImpl
  class DImpl : public virtual D, public virtual BImpl {
    void fooEnhanced() {}
  };

we get "no unique final overrider" becase both D and BImpl implement
foo.  With non-virtual inheritance, on the other hand, we get "DImpl
is abstract" because foo is still pure virtual implemented in DImpl.
Templates solve the issue by allowing

  namespace detail{
  template<typename T>
  class BImpl : public T { ... };

  template<typename T>
  class DImpl : public BImpl<T> { ... };
  } // namespace detail

  using BImpl = detail::BImpl<B>;
  using DImpl = detail::DImpl<D>;

Test: boots
Change-Id: Iccb513e4fc751e9a687a1ed2d9fb2192c8324a50
2018-01-31 15:11:50 -08:00
Chia-I Wu
699df2167a graphics: use allocator HAL support library in default impl
Rename Gralloc0Allocator to Gralloc0Hal and make it inherit from
AllocatorHal.  Do the same to Gralloc1Allocator.  Add GrallocLoader
to load either of Gralloc[01]Hal and create a IAllocator instance.

Test: boots and VTS
Change-Id: I09ae680c0086ca9e73e412a34d7cd2f3665d3bc2
2018-01-14 21:39:38 -08:00
Chia-I Wu
864c9f8234 graphics: clang-format allocator default impl
Test: builds
Change-Id: I01cee2e7bc778f2e3e540a9856c25f1a0e390186
2018-01-14 21:39:38 -08:00
Chia-I Wu
b511645d99 graphics: make allocator default impl a static library
Convert the default impl into a static library,
android.hardware.graphics.allocator@2.0-passthrough.

Test: boots and VTS
Change-Id: I8ec8b30766462ecb3fb789af7c6dbb3c088ccf57
2018-01-14 21:39:38 -08:00
Chia-I Wu
d6daa8ddf9 graphics: add allocator HAL support library
Add a header-only library
android.hardware.graphics.allocator@2.0-hal that can be used by
implementations.  An imlpementation can

  class VendorHal : public AllocatorHal { ... };

  auto allocator = std::make_unique<Allocator>();
  allocator->init(std::make_unique<VendorHal>(...));

Or, if vendor extensions are to be added to the IAllocator,

  class AlocatorHalExt : public AllocatorHal { ... };
  class VendorHal : public AllocatorHalExt { ... };
  class AllocatorExt : public AllocatorImpl<IAllocatorExt, AllocatorHalExt> { ... };

  auto allocator = std::make_unique<AllocatorExt>();
  allocator->init(std::make_unique<VendorHal>(...));

Test: builds
Change-Id: I7cb7a4888316b871e5c49d96524b1642fc708f2d
2018-01-14 21:39:38 -08:00
Chia-I Wu
d6695d5bdc graphics: move libgralloc1-adapter
Move libgralloc1-adapter from 2.0/default/ to
2.0/utils/gralloc1-adapter/.  Fix build issues after the move.

Test: builds
Change-Id: I674fe60c724a4ffc1540c796b92209a1dbf36438
2018-01-14 21:39:38 -08:00
Chia-I Wu
f43ab227a5 Merge "graphics: improve PRESENT_OR_VALIDATE_DISPLAY support" 2017-12-21 06:54:22 +00:00
Jiyong Park
e514a4b8a8 android.hardware.graphics.allocator@2.0 is no longer VNDK-SP
The interface lib has been in VNDK-SP because
android.hardware.graphics.mapper@1.0 was using it. However, since the
dependency has gone [1], there is no need keep it in VNDK-SP. The
VNDK-SP set should be kept as small as possible because libs in VNDK-SP
are subject to double-loading.

Unmark the 'support_system_process' property to exclude the lib from
VNDK-SP.

This commit re-lands I8722c1ac15ddf56a627a12a0c649b4d734e5e5cd because
it was reverted during O-MR1 push to AOSP-master.

Bug: 69480083
Test: walleye boots to the UI
Change-Id: I0af8115dceb9711c6c451ffaeedda6c823ec2905
Merged-In: I8722c1ac15ddf56a627a12a0c649b4d734e5e5cd
(cherry picked from commit ec44d18dbe)
2017-12-13 11:58:24 +08:00
Chia-I Wu
cdc287ba06 graphics: improve PRESENT_OR_VALIDATE_DISPLAY support
There is no cap defined for PRESENT_OR_VALIDATE_DISPLAY in HIDL so
it must always work.  Make sure it does not call HWC2 presentDisplay
when the underlying HWC2 does not support
HWC2_CAPABILITY_SKIP_VALIDATE.

Bug: 70407085
Test: boots
Change-Id: I54a4400e09e669c5064f05739f595ed978dcc713
2017-12-12 09:37:19 -08:00
Steven Moreland
e5c6548346 Remove subdirs
Removing whenever I see these in code reviews.

Test: none
Merged-In: I4322f533a837d55618ec2ed2125e8966ace9d61d
Change-Id: I4322f533a837d55618ec2ed2125e8966ace9d61d
2017-11-28 14:23:43 -08:00
Zhuoyao Zhang
c8c5001b00 Convert GraphicsMapper Hal test to test against each of the service names.
am: 94b11ca19f

Change-Id: I067c835282bdd84571f3e57ab61073ed2fd54b15
2017-11-15 01:35:13 +00:00
Xin Li
bb9e38fef9 Merge commit '1a06284b24f5eb7bb9c1fea0817da8898b3b1bff' from
oc-mr1-dev-plus-aosp into stage-aosp-master

Change-Id: I2a044eb8c9981d0a8198ffe2df55559afbd76341
Merged-In: I4fb9f18884f7ef21162015a0032c4431444f7025
2017-11-14 12:08:38 -08:00
Zhuoyao Zhang
94b11ca19f Convert GraphicsMapper Hal test to test against each of the service
names.

Bug:64203181
Test: vts-tradefed run vts -m VtsHalGraphicsMapperV2_0Target
Change-Id: Icbef0f0575183033c069d8ec097ab774207c40de
2017-11-13 17:10:25 -08:00
Steven Moreland
a1169dd600 Update makefiles for hidl_interface.
Bug: 35570956
Test: manual
Change-Id: I7a220b78ee081240e1dc30ef5672ba39e3e98375
2017-11-10 09:06:55 -08:00
Chia-I Wu
e3b1836d90 graphics: add OWNERS file to default implementations
Test: none
Change-Id: I76a3c84a1fcb61dffa4641ec2120e484752bdf5b
2017-11-07 08:53:12 -08:00
Chia-I Wu
16e8ed254d graphics: support FB HAL using HWC2OnFbAdapter
FB (framebuffer) HAL has been replaced by HWC HAL for 5+ years, but
we still support the legacy path in SurfaceFlinger.  Devices using
the legacy path cannot be Treblized.

This change allows such devices to use HIDL IComposer, by adding
support for FB HAL in the default implementation.

Test: boots hikey960
Change-Id: Ie9050bbcaac0fd5b134786f4f9f0f5075f4ebd0c
2017-11-06 15:08:07 -08:00
Chia-I Wu
8101b24ca7 graphics: require validateDisplay after onRefresh
After initialization or onRefresh, we want to make sure
validateDisplay is called before presentDisplay.

Bug: 67505273
Test: manual
Change-Id: Id876d9251586aaaf552ca82c52f8f902af364251
2017-11-06 15:08:07 -08:00
Steven Thomas
bc67a6a8fb Guard against racy ComposerClient reconnection
The hardware composer service has a rule that only one client can be
connected at a time. The surface flinger process, when transitioning
composer ownership from surface flinger to vr flinger, will destroy the
current client on one thread and create a new client on another
thread. Although surface flinger ensures that these events happen in the
expected sequence (delete then create), the requests sometimes land in
the hardware composer service in inverted order, causing the creation
request to fail with an error.

Instead of failing with an error, block for a brief period (1 second)
until the existing client is removed, then proceed to initialize the new
client. This gives us enough time to ensure an inverted
creation/destruction order doesn't cause client creation to fail, while
avoiding a deadlock if the existing client is never destroyed.

Bug: 62925812

Test: - Transitioned to/from vr flinger hundreds of times, and confirmed
I no longer see sporadic composer client creation failure due to an
already existing client.

- Ran the vts graphics composer tests and confirmed they all pass.

Change-Id: I40be1fb0cb3d42ddb5a9fc159188886e9f5b6267
2017-11-06 15:08:07 -08:00
Steven Moreland
116161d94e Update for Soong java makefiles. am: c3e80fa01e am: 0fff75dee1
am: 6c811964a1

Change-Id: I85ccbb4a15cd18938607f5bca4e065b9d7e0182b
2017-10-11 16:31:07 +00:00
Steven Moreland
0fff75dee1 Update for Soong java makefiles.
am: c3e80fa01e

Change-Id: Ia8835f9c95bd98a96f5fd3aff11191e7d3726fb9
2017-10-11 16:23:54 +00:00
Steven Moreland
c3e80fa01e Update for Soong java makefiles.
Test: pass
Bug: 33420795
Change-Id: Id9b1919a19b8ff682738cfb0869a479b4dbb4293
2017-10-10 23:07:20 +00:00
Steven Moreland
0653f3b212 Merge "Remove useless Android.mk files." am: 75d5cf515a am: f27cfa15d7
am: 33dc30ce49

Change-Id: Ia35d20e0fc1df6f7c46b5581537d7ed387965899
2017-10-05 21:51:13 +00:00
Steven Moreland
f27cfa15d7 Merge "Remove useless Android.mk files."
am: 75d5cf515a

Change-Id: I8c0918c4a787cc3f4c7c69f52737d3a0d9d64426
2017-10-05 21:44:26 +00:00
Treehugger Robot
75d5cf515a Merge "Remove useless Android.mk files." 2017-10-05 21:40:27 +00:00
Steven Moreland
4b60470f1a Remove useless Android.mk files.
These have been c/p'd all over the place.

Test: m -j nothing
Bug: 33420795
Change-Id: I77979866dbb2345a41a873c84ec3fccd7b127510
2017-10-04 15:52:40 -07:00
Steven Moreland
9a17f41f6f Merge "Update for hidl adapter module defaults." am: 988c977079 am: 861651985f
am: b53e6ad535

Change-Id: I23269fb7a9bdd352e670a80f390527d9eef31412
2017-10-04 21:51:00 +00:00
Steven Moreland
861651985f Merge "Update for hidl adapter module defaults."
am: 988c977079

Change-Id: I289818be1b30397391847ba1c532d1014fdbed27
2017-10-04 21:45:09 +00:00
Steven Moreland
527fd76a0e Update for hidl adapter module defaults.
Test: pass
Change-Id: Idc6a943149a279bf17cfcfd0f2571473e53bbbbf
2017-10-04 12:47:03 -07:00
Steven Moreland
9fdd241905 Merge "Fix typo in update makefiles." am: 9960148420 am: f07e364ce3
am: 71a193a425

Change-Id: I45ae43f07323254212532acbf0f891d11143b05f
2017-09-26 23:58:51 +00:00
Steven Moreland
f07e364ce3 Merge "Fix typo in update makefiles."
am: 9960148420

Change-Id: I949634e72f817f3a5411130e968acd8efd1d7725
2017-09-26 23:51:07 +00:00
Steven Moreland
a5299ee739 Fix typo in update makefiles.
Bug: 37518178
Test: pass
Change-Id: Ic401b3a473f15ca4c01e58b3072e19db7c31b653
2017-09-26 21:59:43 +00:00
Steven Moreland
97228c0b7d Update makefiles for hidl adapter. am: 26a0bb2762 am: 73949c1d7e
am: b94d0c7290

Change-Id: If766cffbcc003cc0cc5eb98969b924aa918fff44
2017-09-26 12:53:13 +00:00
Steven Moreland
73949c1d7e Update makefiles for hidl adapter.
am: 26a0bb2762

Change-Id: I3a811f5cd49bd4e81e8fcd5c8e88922115812539
2017-09-25 23:14:44 +00:00
Steven Moreland
26a0bb2762 Update makefiles for hidl adapter.
Bug: 37518178
Test: manual
Change-Id: I50e999907d3c64d2b039272b823971998da64d1b
2017-09-25 18:35:56 +00:00
Chia-I Wu
481885c52d Merge "graphics: discard stale data from message queue" into oc-mr1-dev
am: 710b7085f9

Change-Id: I2a2e69edf9e822b4bd44344163f79b7d036d95c3
2017-09-08 22:39:16 +00:00
Chia-I Wu
48ffe289b0 graphics: discard stale data from message queue
Our use of message queues is synchronous.  If there are already data
in the queue when writeQueue is called, we know they are stale and
can be discarded.

Bug: 65449888
Test: manual
Change-Id: Ie29b8a7386c9733c183a6c3569e3572efa62cbc2
2017-09-08 11:51:57 -07:00
Zhuoyao Zhang
3b77b81ead Merge "Fix VtsHalGraphicsComposerV2_1TargetTest" into oc-mr1-dev
am: 8d2d1d08a1

Change-Id: I88b1726621257074e9b4c3bc415d255d9fb3a74f
2017-09-05 18:54:22 +00:00
Zhuoyao Zhang
425e9672d5 Fix VtsHalGraphicsComposerV2_1TargetTest
Bug: 65252969
Test: make vts
Change-Id: Id4543b385ca9dce532bbf08ef206897924d66acb
2017-08-31 19:57:17 +00:00
Zhuoyao Zhang
4cf8cc0348 Merge "Update vts test to use the updated test template." into oc-mr1-dev
am: 69270ce30f

Change-Id: I6c34ee4d363c3d485abc8e71d938c1e3a98e6f51
2017-08-30 22:19:55 +00:00
Zhuoyao Zhang
6afb992759 Update vts test to use the updated test template.
* For registerTestService/getServiceName, no need to pass
  any hard coded string of HAL service FQName.
* Affect test: VtsHalCameraProviderV2_4TargetTest,
               VtsHalGraphicsComposerV2_1TargetTest,
               VtsHalNeuralnetworksV1_0TargetTest

Bug: 62946472
Bug: 64203181

Test: make vts
      vts-tradefed run vts -m VtsHalCameraProviderV2_4Target

Merged-In: If365ab2ed9a91eb4013d71769804b9d4bf089d66
Change-Id: Id0bddbc2949337147557f45cc60dbfaa114ce25e
(cherry picked from commit d71b654d6d)
2017-08-29 17:44:10 +00:00
Steven Moreland
dfd8287506 Updating all makefiles.
Bug: 64487114
Test: none
Merged-In: I8608c8f636c35f21e4246a805a9eff6d14124e0a
Merged-In: I2fa89b6661c39859ec4fb62c4bb0a05a35e645f0
Merged-In: Ifdc3c17cb2b85c18b37dac2d03bb5c8935c23180
Change-Id: I170fa1c4fe39f8109b1670db58ef99bb11afc0be
2017-08-14 20:25:09 +00:00