Commit graph

190 commits

Author SHA1 Message Date
Dan Stoza
aaa8dfb47d Merge "Composer 2.2: Fix readback docs" into pi-dev am: 066288295e
am: cdf9c58712

Change-Id: I697e84dbd3fa257791293028e039b2ff4a261d54
2018-05-16 16:22:54 -07:00
Dan Stoza
cdf9c58712 Merge "Composer 2.2: Fix readback docs" into pi-dev
am: 066288295e

Change-Id: I6721a52dbdb7141b84dde0516be6923b4016d7fa
2018-05-16 15:52:52 -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
Dominik Laskowski
bebc464d90 Merge "graphics: Add composer 2.3" 2018-05-02 22:24:01 +00:00
android-build-prod (mdb)
241b31ab77 Merge "HWC2On1Adapter: Fix fd leak in Layer::dump" am: 2e38b2c0f6 am: 28172ae62a
am: 7ba269ea79

Change-Id: I87530cfb3908ca158d96d9bc3ad6e4be91df1ade
2018-04-27 11:48:11 -07:00
android-build-prod (mdb)
7ba269ea79 Merge "HWC2On1Adapter: Fix fd leak in Layer::dump" am: 2e38b2c0f6
am: 28172ae62a

Change-Id: I384c44c57d05ca303fd04c9e920aae9e23c9ee45
2018-04-27 11:39:23 -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
825f29f755 graphics: allow re-saturation for any legacy dataspace am: c75e0f0bf9
am: 6f869050d1

Change-Id: I7199ebd515c681a8961122d2340f0be67d24b93a
2018-04-25 13:25:54 -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
Dominik Laskowski
cd2e9f587d graphics: Add composer 2.3
The 2.3 interface adds IComposerClient.getDisplayIdentificationData,
which enables display identification for generalized multi-display
support.

Bug: 74619554
Test: VtsHalGraphicsComposerV2_3TargetTest
Change-Id: I303e722ce938fe0af4fc77da812e3525d8c90251
2018-04-24 10:26:16 -07:00
Dominik Laskowski
0c41558bdf graphics: Clean up VTS boilerplate for composer
This CL makes the V2_1::vts::Composer class more reusable, and cleans up
the 2.2 boilerplate.

Bug: 74619554
Test: VtsHalGraphicsComposerV2_2TargetTest
Change-Id: Iff2905d40afe16a0b9ce735f1285d5bdc6b4cec7
2018-04-05 15:21:28 -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
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
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
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
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
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
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
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
Lloyd Pique
2765f9d406 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
2018-01-11 13:04:50 -08:00
Chia-I Wu
e3c695c8e6 Merge "graphics: improve PRESENT_OR_VALIDATE_DISPLAY support" am: f43ab227a5 am: 8e1ec23a5d
am: a72e80eafa

Change-Id: I40e32ddcb9646f08e1cb0b7a0eaa137ea4b6b94b
2017-12-21 17:40:56 +00:00
Chia-I Wu
a72e80eafa Merge "graphics: improve PRESENT_OR_VALIDATE_DISPLAY support" am: f43ab227a5
am: 8e1ec23a5d

Change-Id: I856a4bfc708f34a331f83e1466e689a2fa5427b7
2017-12-21 07:30:24 +00: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
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
Steven Moreland
c2f829a1d2 Updating makefiles for hidl_interface.
Bug: 64487114
Test: manual
Merged-In: Ie13d9e014cf2b81c18c67f551b4644fb9f0ba812
Change-Id: Ie13d9e014cf2b81c18c67f551b4644fb9f0ba812
2017-11-13 11:39:07 -08:00
Steven Moreland
8db261bc99 Updating makefiles for hidl_interface.
Bug: 64487114
Test: manual
Merged-In: Ie13d9e014cf2b81c18c67f551b4644fb9f0ba812
Change-Id: Ie13d9e014cf2b81c18c67f551b4644fb9f0ba812
2017-11-13 10:00:18 -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
d4bb253b18 graphics: add OWNERS file to default implementations am: e3b1836d90 am: d9c63996ce
am: eb4eba96c9

Change-Id: Ieef144876dfa608ddf34de391ce40e8fd8d6c7c4
2017-11-07 19:12:52 +00:00
Chia-I Wu
eb4eba96c9 graphics: add OWNERS file to default implementations am: e3b1836d90
am: d9c63996ce

Change-Id: I3b582fba337306fe2fb32b5b480ccef7d763a97d
2017-11-07 19:00:29 +00:00
Chia-I Wu
23dbc0f5ab graphics: support FB HAL using HWC2OnFbAdapter am: 16e8ed254d am: 20b073fe6c
am: 85ade632ce

Change-Id: I6f020f5fbe0ecd04d5115e1553169b23bf3d196f
2017-11-07 18:23:51 +00:00
Chia-I Wu
85ade632ce graphics: support FB HAL using HWC2OnFbAdapter am: 16e8ed254d
am: 20b073fe6c

Change-Id: I3e50c5f00b8385a33ff1d04622102ca041cc408d
2017-11-07 18:19:19 +00:00
Chia-I Wu
e051dcef99 graphics: require validateDisplay after onRefresh am: 8101b24ca7
am: a565609b83

Change-Id: I713f68f0b789acac0ab1340f1a2de9a514a8079d
2017-11-07 18:19:13 +00: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
Chia-I Wu
179aa67cfc Merge "graphics: require validateDisplay after onRefresh" 2017-10-26 04:45:04 +00:00