Commit graph

341 commits

Author SHA1 Message Date
Chia-I Wu
0eafa742c6 graphics: composer@2.2 does not require mapper@2.1
Fix composer@2.2 VTS to not require mapper@2.1.  We will need a
better test infra before things get too complex.

Bug: 112248843
Test: manual
Change-Id: Ia71a102742fd26f14e8edf3f43f3351786350ccd
Merged-In: Ia71a102742fd26f14e8edf3f43f3351786350ccd
2018-10-18 11:22:09 -07:00
TreeHugger Robot
308d390720 Merge "SetColorMode is not available for vendor hwc less than 1.4" into pi-dev 2018-06-06 04:48:34 +00:00
huans
f579ea47aa SetColorMode is not available for vendor hwc less than 1.4
Bug: 90510785
Test: VTS VtsHalGraphicsComposerV2_1Target SetColorMode(default) pass
Change-Id: Ia295b3ef2f0f433a7e1b5179eb230b8f7c649400
2018-06-01 14:33:30 -07:00
Chia-I Wu
8f5a17d1e8 graphics: COLORIMETRIC is optional for HDR modes
Bug: 80030364
Test: VTS
Change-Id: I2180f18e8742850f728491887475f16b1cad4791
Merged-In: I2180f18e8742850f728491887475f16b1cad4791
2018-05-30 11:52:57 -07:00
Chia-I Wu
09782444e3 graphics: fix readback buffer tests
Make readback buffer support optional.  Fix incorrect use of
setReadbackBuffer and getReadbackBufferFence.

Bug:  80030364
Test: VTS
Change-Id: I278a031c3c086ac38c460b7076a2952db57a91a4
Merged-In: I278a031c3c086ac38c460b7076a2952db57a91a4
2018-05-22 15:17:50 -07:00
Steven Moreland
4ee4582230 Update comments for doc comments.
Doc comments look like "/** ... */" and they
can only be in certain places.

Bug: 79865343
Test: m
Change-Id: Ic15c08ff7dc6e4f9827c1dbe7f7236c11a572ec1
2018-05-18 10:10:32 -07:00
Dan Stoza
e7bd22299a Composer 2.2: Fix readback docs
Fixes a couple of problems with the return codes in the readback
documentation and adds a paragraph of clarification about when
getReadbackBufferAttributes will be called.

Bug: 67048889
Test: N/A, doc fix only
Change-Id: Ic91b8db207c1b4b1f18777bd316279747506149b
2018-05-16 14:18:08 -07:00
Marissa Wall
c357006160 Merge "graphics: add new gralloc1 functions to passthrough" into pi-dev 2018-05-03 22:45:45 +00:00
Marissa Wall
facec957e3 graphics: add new gralloc1 functions to passthrough
Add calls to the new gralloc1 functions: import, validateBufferSize
and getTransportSize. These new gralloc1 functions are used for
security hardening.

Bug: 66876469
Test: Manual
Change-Id: I18e485c48e1a24352208753144d936e1117d4ccb
2018-05-03 13:48:59 -07:00
Chia-I Wu
c75e0f0bf9 graphics: allow re-saturation for any legacy dataspace
While our intention is to only re-saturate legacy sRGB, the
re-saturation is usually performed globally by the composer.  To
avoid GPU fallback when, for example, video plays, allow the
re-saturation to be applied on any legacy dataspace.

This also removes the clamping after applying the re-saturation
matrix, allowing the output dataspace to be scRGB.

Bug: 78303195
Bug: 78025845
Test: manual
Change-Id: Ic221401894789fbaf6bad944b49006163238237c
2018-04-25 11:35:39 -07:00
Peiyong Lin
a2acfa2219 [Graphics] Update CommandWriter APIs to common::V1_1::* enum.
Previously we introduced Dataspace V1.1 and PixelFormat V1.1, thus APIs
accepting Dataspace should also be updated to accept V1_1::Dataspace and
V1_1::PixelFormat.

BUG: 77156734
Test: adb shell /data/nativetest/VtsHalGraphicsComposerV2_2TargetTest/VtsHalGraphicsComposerV2_2TargetTest
Change-Id: I00d00749f2895b727a18a28903256128a33e8b97
2018-04-02 15:56:45 -07:00
Chia-I Wu
6c8257feca graphics: add RenderIntent and better HDR support
This adds

  ColorMode::BT2020
  ColorMode::BT2100_PQ
  ColorMode::BT2100_HLG
  Dataspace::BT2020_HLG
  Dataspace::BT2020_ITU_HLG
  RenderIntent::COLORIMETRIC
  RenderIntent::ENHANCE
  RenderIntent::TONE_MAP_COLORIMETRIC
  RenderIntent::TONE_MAP_ENHANCE

and fixes per-frame metadata to be per-layer.  It also clarifies how
the composer should treat certain dataspaces and makes the
corresponding composer changes.

Bug: 73824924
Bug: 32148660
Test: manual
Change-Id: I5d12f50190522103c2ac97ee8dc2d5f6a2dabffe
2018-04-02 13:04:33 -07:00
Nathan Harold
c893754c0d Update Makefiles Missed In Previous Commits
When calling update-makefiles.sh there are
some unrelated changes that were missed in
previous commits.

Bug: 8675309
Test: compilation
Change-Id: I5bf67fbcc809de36bde1869ada7b835566a5198b
2018-03-19 16:37:46 -07:00
Daniel Solomon
399a5b8d60 graphics: restart HWC when SurfaceFlinger stops
Currently display stays on when SurfaceFlinger is stopped, since HWC
runs as a separate service. There's no reason for display to remain on
in this state, and can be confusing to developers.

Restarting HWC when SurfaceFlinger stops causes display to turn off,
matching expected behavior. HWC is then ready to service SurfaceFlinger
when SurfaceFlinger starts back up.

Bug: 74199279
Change-Id: Ic772c29b362b3e8b2d6bc674a0bd237440880492
2018-03-12 18:55:06 -07:00
Carmen Jackson
36e146d6fc Add hwcomposer to the system-background cpuset.
Little cores should be fast enough to handle hwcomposer work, so
avoiding using big cores for this is a potential opportunity to save
battery.

Bug: 73543056
Test: Verified using dumpsys gfxinfo that TouchLatency doesn't drop
frames.
Test: Took 10s systraces of TouchLatency and a Youtube VR video and saw
no frames dropped in SurfaceFlinger.

Change-Id: If96e13a2bacc9541f4d69a5736254817f20cacdd
2018-03-08 12:58:13 -08:00
Chia-I Wu
de0bd95d57 graphics: add composer 2.2 default impl
This adds

  android.hardware.graphics.composer@2.2-hal
  android.hardware.graphics.composer@2.2-passthrough
  android.hardware.graphics.composer@2.2-service

The -hal module makes it easier to write composer 2.2 HAL and is
reusable by vendors.  The -passthrough module provides a HwcHal
class that implements ComposerHal 2.2 on top of hwcomposer2, and is
also resuable by vendors.  Finally, the -service module provides a
(stub) default implementation.

Test: boots and VTS
Change-Id: I4f940a9dea656abc7d9d485bf48d852c13d2ed56
2018-02-21 12:23:41 -08:00
Chia-I Wu
be99ad6e75 graphics: convert composer default impl to a library
Convert composer default impl to a header-only library,
android.hardware.graphics.composer@2.1-passthrough.

Test: builds and VTS
Change-Id: I9251aadc28816fc4c1d9326e09e297f30e9c25fe
2018-02-21 12:23:41 -08:00
Chia-I Wu
a41e726b8b graphics: add Composer to HAL support library
Extract IComposer implementation from HwcHal and move it to the HAL
support library.  This requires removal of

  ComposerHal::removeClient
  ComposerHal::enableCallback

and addition of

  ComposerHal::dumpDebugInfo
  ComposerHal::registerEventCallback
  ComposerHal::unregisterEventCallback

since HwcHal does not own a client to send the events to anymore.

Test: boots and VTS
Change-Id: I491e3d2c31d686661d4d3a44842bcac62cc2b2dc
2018-02-21 11:03:04 -08:00
Chia-I Wu
da5fdd4494 graphics: move ComposerClient to HAL support library
libhwcomposer-client is empty and can be removed.  Note that
ComposerClient::initialize is renamed and can fail now.

Test: boots and VTS
Change-Id: Iacd3f995bc094c7dd6b7f91ae64aad0522b3f3d3
2018-02-21 11:03:04 -08:00
Chia-I Wu
78211cf7d0 graphics: add ComposerCommandEngine
Add ComposerCommandEngine to the HAL support library to replace
ComposerClient::CommandReader and ComposerClient::mWriter.

Test: boots and VTS
Change-Id: I2d1281d37180497cbd5c623ef005cee44bce377e
2018-02-21 11:03:04 -08:00
Chia-I Wu
2d894af0c7 graphics: add ComposerResources
Add ComposerResources to the HAL support library to replace
HandleImporter, DisplayData, and BufferCache in ComposerClient.
ComposerResources tracks the current displays and layers, as well as
managing buffer caches for them.

This is more than refactoring.  HandleImporter used to be a static
object, but we want ComposerResources to be self-contained rather
than depending on a static object.  This needs to be fixed.  It also
becomes obvious that we used to treat sideband streams as buffers in
BufferCacheEntry destructor incorrectly.  That needs to be fixed as
well (as a trivial consequence of making HandleImporter non-static).

Test: boots and VTS
Change-Id: I8e3014cb233e2a6d1a71cc244eff80f126c58a94
2018-02-21 11:03:04 -08:00
Chia-I Wu
bbd9545732 graphics: move ComposerBase to HAL support library
Create android.hardware.graphics.composer@2.1-hal and add
ComposerHal, which is heavily based on ComposerBase, to it.

There are two bigger TODOs.  One is to remove the concept of
"clients" from the class and the other is to remove hwcomposer2.h
dependency.

Test: boots and VTS
Change-Id: I37b4fb3ae2239bf11aa87a56d1e2ebfe0b8c6b54
2018-02-21 11:03:04 -08:00
Chia-I Wu
501cc23259 graphics: add libhwc2on{1,fb}adapter
Moved from frameworks/native.

Test: build
Change-Id: I03bf1d073306aaa2ce155aee50fb9ac056906323
2018-02-21 11:03:04 -08:00
Chia-I Wu
96a098a80d graphics: more reusable libVtsHalGraphicsComposerTestUtils
Versioned library names, versioned include paths, and others.

Test: make VtsHalGraphicsComposerV2_1TargetTest
Change-Id: Ic266763c9ef25e09bc2c97026f2e1324609f48c6
2018-02-21 11:03:04 -08:00
Chia-I Wu
8b20c5c881 graphics: clang-format composer VTS
Test: make VtsHalGraphicsComposerV2_1TargetTest
Change-Id: I8df7090dd3cebbf36257f3df76f0e8aced0c60bd
2018-02-21 11:03:04 -08:00
Chia-I Wu
5ff97474de graphics: move libVtsHalGraphicsComposerTestUtils
Move libVtsHalGraphicsComposerTestUtils from vts/functional to
utils/vts.

Test: make VtsHalGraphicsComposerV2_1TargetTest
Change-Id: Ic3042aa7f2578d099fbe79039b60892bd0e87f25
2018-02-21 11:03:04 -08:00
Chia-I Wu
15d22137ac graphics: add a default impl for IMapper 2.1
This is for reference only.  It almost only has stub implementations
for the new 2.1 methods.

Test: boots and VTS
Change-Id: I60499f3094df1975ccbbcda7b5c03d4a0dc57c39
2018-02-02 07:31:37 +00:00
Chia-I Wu
3ceef47c41 graphics: add mapper 2.1 HAL support library
Add android.hardware.graphics.mapper@2.1-hal to make it easier to
write 2.1 HALs.

Test: builds
Change-Id: I36d6b2c85ec623240582788505f29e635960dc0e
2018-02-02 07:31:28 +00:00
Chia-I Wu
efd99206d0 graphics: make mapper 2.1 VTS utils more reusable
Move V2_1::vts::Gralloc to android.hardware.graphics.mapper@2.1-vts.

Test: VTS
Change-Id: Iecb7fc3cb90b886ad2d9c23a5cab8aef2da6367f
2018-02-02 07:30:38 +00:00
Chia-I Wu
98923fccad graphics: make mapper VTS utils more reusable
Better include path (#include <mapper-vts/2.0/MapperVts.h>), better
library naming, and move GraphicsMapperHidlEnvironment to where
tests are defined.

Test: VTS
Change-Id: I9fbf6515993ac11852b11ca6b8194a58afe5579a
2018-02-02 07:29:25 +00:00
Chia-I Wu
7d510c91f0 Merge changes from topic "gralloc-mapper-cleanup" am: 779a7aa37a am: 3b1e1fdac1
am: 979b233827

Change-Id: Ic42426c1f31bbc8732995eb8e744bd093d1c2071
2018-02-02 06:56:55 +00:00
Chia-I Wu
979b233827 Merge changes from topic "gralloc-mapper-cleanup" am: 779a7aa37a
am: 3b1e1fdac1

Change-Id: I4b2f10410049b05689b71b29a892703797ecdcd0
2018-02-02 04:21:58 +00:00
Chia-I Wu
3b1e1fdac1 Merge changes from topic "gralloc-mapper-cleanup"
am: 779a7aa37a

Change-Id: Ia48ae7515fac374a5a99efcb8b230b4f3dca57f0
2018-02-02 00:14:12 +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
Peiyong Lin
ab505aaf90 [HWC] Add setLayerFloatColor API into HAL.
This patch:

1. Adds setLayerFloatColor API into HAL to enable setting more bits of color on
ColorLayer;
2. Adds VTS tests for setLayerFloatColor.

BUG: 69970838
Test: adb shell /data/nativetest/VtsHalGraphicsComposerV2_2TargetTest/VtsHalGraphicsComposerV2_2TargetTest
Change-Id: I439e35cb2505ee47b8e9a8dd1c19a3f3f2cf9c2f
2018-01-25 05:58:32 +00:00
TreeHugger Robot
c133b9087a Merge "Add new HWC HAL methods for Android P." 2018-01-25 05:55:38 +00:00
Courtney Goeltzenleuchter
be92bb9fae Add new HWC HAL methods for Android P.
Add new methods to support HDR, video readback mechanism and
additional power mode.

Test: adb shell /data/nativetest/VtsHalGraphicsComposerV2_2TargetTest/VtsHalGraphicsComposerV2_2TargetTest
Bug: 71513501
Change-Id: I45596df6c5a2a726e12f524e82681aef4bcbe180
2018-01-24 17:19:55 -08:00
Chia-I Wu
887a59b301 Merge "graphics: add createDescriptor_2_1 to mapper" 2018-01-24 23:57:03 +00:00
Courtney Goeltzenleuchter
33f62da78c graphics: Add Dataspace and PixelFormats for HDR
Bug: 63710530
Test: make
Change-Id: Iea9b9cf7948567c3cb596de4f628459684aff569
2018-01-24 08:34:14 -08:00
Chia-I Wu
25416b5a1d graphics: add createDescriptor_2_1 to mapper
With new formats and buffer usage bits, we need new
createDescriptor.

Test: VTS
Change-Id: I87e39297f9c1c53377fcc62fb086629779409c16
2018-01-23 20:37:51 -08:00
Courtney Goeltzenleuchter
5ecd86aa40 Update hwcomposer include paths
In preparation of new hwcomposer interface, updating
existing includes to include specific version.
Note: IComposerCommandBuffer.h was moved, renamed and clang
formated, but otherwise had no code changes.
Bug: 71513561
Test: compile

Change-Id: If34cb6f63012592a245708109590653ace7009f5
2018-01-22 11:51:38 -08:00
Craig Donner
243da4d2b8 graphics: add graphics common 1.1 HAL with new pixel formats and usages.
Bug: 66900669
Test: Build
Change-Id: Ie8ba599230c7491aee337c8c333a96859c1ce83d
2018-01-19 10:16:22 -08:00
Chia-I Wu
e3d33876d4 graphics: use allocator HAL support library in default impl am: 699df2167a am: 4e8ce3ea5e
am: 0569d7fdec

Change-Id: Id09e0c7e8a864c350ea6f4bfa9f24b5485ce60d3
2018-01-16 18:46:36 +00:00
Chia-I Wu
aa04f5beb9 graphics: clang-format allocator default impl am: 864c9f8234 am: 0651511689
am: c11b350596

Change-Id: Iffa1203ba058201539f0bb34c910c5fddb93a66f
2018-01-16 18:46:18 +00:00
Chia-I Wu
986c62c85b graphics: make allocator default impl a static library am: b511645d99 am: 80a04eb319
am: 2876b05378

Change-Id: I9a1cb8b600a0b1846877cacf15d837a47aeaf07f
2018-01-16 18:46:01 +00:00
Chia-I Wu
dc3f02702b graphics: add allocator HAL support library am: d6daa8ddf9 am: 8615b56780
am: 53cd26c8a1

Change-Id: I8af338181cc1bf4c7740e8fa63db4d733b27d3c1
2018-01-16 18:45:39 +00:00
Chia-I Wu
7c19ef13d7 graphics: move libgralloc1-adapter am: d6695d5bdc am: a3c036bd37
am: 719bc97bff

Change-Id: I770edfe2ea29dfbce8c42a79e435c5519aae238e
2018-01-16 18:45:09 +00:00