Commit graph

139 commits

Author SHA1 Message Date
Alec Mouri
8ff184b518 Add composer API changes in accordance to partner feedback
* Add a DimmingStage to the client target configuration reported by HWC,
  which may be used for some vendor color modes to configure when
  dimming should occur during client composition
* Communicate the display brightness in nits, so that HWC
  implementations do not need to parse the per-display xml to map from
  display brightness to nits. Furthermore, this is more plausible for
  extensibility for external displays.

Bug: 220396224
Bug: 218954037
Test: builds
Change-Id: I5675c16f0895f9958e3bee3ee4c85df8937ecdb7
2022-02-24 01:45:41 +00:00
Alec Mouri
bf0bbc2db0 Remove concept of nits from the client target properties
An earlier patch replaced white point nits with a per-layer brightness.
This patch does the same for providing the brightness space of the
client target relative to the display brightness.

Bug: 217961164
Test: builds, boots
Change-Id: I1be65f7c511fefa239305e0735637126a1cd6622
Merged-In: I1be65f7c511fefa239305e0735637126a1cd6622
2022-02-23 23:04:55 +00:00
TreeHugger Robot
b62a39242b Merge "Add a VTS test for DISPLAY_DECORATION" 2022-02-17 18:00:19 +00:00
Leon Scroggins III
de0575882c Add a VTS test for DISPLAY_DECORATION
Check for support via getDisplayDecorationSupport. If it is supported,
verify that we can allocate a buffer of the correct format and that
Composition.DISPLAY_DECORATION can be used without error. If it's not
supported, expect an error of EX_UNSUPPORTED_OPERATION.

Bug: 209458568
Fixes: 209458568
Test: atest VtsHalGraphicsComposer3_TargetTest (this)
Change-Id: I0a62a0ce3f8fd3a2d6088f94ce1ad0840d9c6faa
2022-02-17 08:36:04 -05:00
Ram Indani
2d22f84671 Merge "[VTS] Removes wait on buffer fence" 2022-02-16 19:00:35 +00:00
Ram Indani
8af9317f42 Merge "[VTS] BlendMode::Coverage test" 2022-02-16 19:00:13 +00:00
ramindani
58ced4f54e [VTS] Removes wait on buffer fence
When we have a fence created with GraphicBuffer
We don't need to wait on it in VTS tests,
the composer should be able to handle the
 fence in this case

BUG: 219589185

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I688d695bb562dd1fe86cdceb642e746cbafe8b30
2022-02-16 18:58:14 +00:00
ramindani
07e6f8499b [VTS] BlendMode::Coverage test
Enable BlendMode::Coverage test.
Test pass: BlendMode/GraphicsBlendModeCompositionTest#Premultiplied/0: PASSED (930ms)
BlendMode/GraphicsBlendModeCompositionTest#Premultiplied/1: PASSED (933ms)

BUG: 219737571

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I5f5bbf371c26933457eec0f3710d47ddadd06cdb
2022-02-16 18:58:14 +00:00
Ram Indani
170bcb8e69 Merge "Use Vector instead of unordered_map for hotplug displays" 2022-02-16 18:56:28 +00:00
Ram Indani
acd5739fd1 Merge "BlendMode VTS tests" 2022-02-16 18:56:13 +00:00
ramindani
7ce70fea34 Use Vector instead of unordered_map for hotplug displays
For multi-display order of the hotplug matters, and vector
maintains the order that we need for the multi-display.
see: ag/1921760 for partner cl on HIDL.

BUG: 210920960
BUG: 209409863

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I4f9a86413f20c860fc0bc3850a14335d62de881a
2022-02-15 15:13:02 +00:00
ramindani
b636af2820 BlendMode VTS tests
BlendMode::Coverage and BlendMode::Premultiplied test fix

HIDL only worked on SRGB for this test and
as HIDL this also passes just the Coverage and Premultiplied
with the colorMode SRGB
see: https://source.corp.google.com/android/hardware/interfaces/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp;rcl=ddbbf784a80979fd0b2d926a1e3cdb68d0a49b61;l=938

BUG: 216172840

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: Iec16fc112d3ab6ee37e55ca9f3fa760a439e52eb
2022-02-15 15:13:02 +00:00
TreeHugger Robot
690a98e945 Merge "Provide dimming ratio instead of white point nits in composer" 2022-02-15 04:58:06 +00:00
ramindani
b1144219bf ClientComposition test fix
Client composition test was broken because there was a buffer
created at the test creation and this is not how
this test works for client composition trigger.
And for the fence that was used is different from what it
needs previously fence was acquired through gralloc but now
it's internal to the Graphic Buffer and we no longer
have to  wait for the fence to signal it's taken care
by the graphicBuffer->unlock call, the unlock call waits
for us.
See for unlock https://source.corp.google.com/android/frameworks/native/libs/ui/GraphicBufferMapper.cpp;rcl=HEAD;l=139

BUG: 216170021

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I8fa25d8910a4e2b1df2f0e2270445a658e3b1a39
2022-02-14 21:34:58 +00:00
ramindani
0a2bee4eba Clean up the GraphicBuffer.
HIDL tests don't have any buffer created when test execution starts and with GraphicBuffer that wasn't the case.
We only initialize the buffer when required the way gralloc implementation did.

BUG: 199413815

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I3aeec5b00e30e636de2e58cf7e6ced5539ae19b6
2022-02-14 21:33:08 +00:00
Alec Mouri
b1f16725cc Provide dimming ratio instead of white point nits in composer
There are several reasons for limiting the notion of white point nits in
the composer interface:

1. Some KMS apis exposed by drivers only expose a notion of a per-plane
   brightness. While these are non-mobile drivers, e.g., nouveau, this
   does indicate that white point is not directly going to be understood
   by typical hardware
2. Changing the brightness without requiring a frame update introduces
   implicit state in composer. If the brightness and white point nits
   for a set of SDR layers are 200 nits, and the brightness changes to
   205 nits to respond to ambient conditions, then composer must not dim
   the layers, and in fact DisplayManager will tell SurfaceFlinger that
   the SDR white point will be 205 nits. But SurfaceFlinger will not
   tell composer that the SDR white point changed as that would
   otherwise introduce a re-composition cycle, meaning that
   HW Composer must track somehow that the layer white point changed
   without a corresponding change on the layer data structure, which is
   confusing.
3. It's poorly defined what the dimming ratio should be if
   SurfaceFlinger provides the following inputs: Layer A has a white
   point of 200 nits, Layer B has a white point of 400 nits, and display
   brightness is 300 nits. Current implementations may clamp the
   brightness of Layer B to be 300 nits and dim layer A by 2/3s, but
   there is an equally valid interpretation which is just dim Layer A to
   be 50% of Layer B's brightness.
4. The problem indicated by (2) and (3) suggests that layer white point is
   really an up-stack concept, that SurfaceFlinger can be aware of for
   properly computing the dimming ratios it can send to composer, but
   the composer hal shouldn't really be speaking in terms of nits.

Note that this patch does not yet change the interface for
ClientTargetWithNits, which may be done in a follow-up patch.

Bug: 217961164
Test: builds, boots
Change-Id: I4a1b4e8c300d22599a5683bd44b7b8afa9a29425
2022-02-10 15:14:51 -08:00
Leon Scroggins
3ea6e39979 Merge "Add a more detailed HAL for DISPLAY_DECORATION" 2022-02-10 11:56:31 +00:00
TreeHugger Robot
f3eadf62a2 Merge "Assure width and height are always initialized" 2022-02-10 08:21:27 +00:00
Greg Kaiser
c20d70e09f Assure width and height are always initialized
In case a user fails to call setDimensions() prior to several
other methods on this class, we at least want to have consistent
behavior that's easy to debug.

Test: TreeHugger
BUG: 199413815
Change-Id: Iee7681ed855cf6ebf9e436e0d2864e0fc9cb4025
2022-02-09 07:11:33 -08:00
Ady Abraham
fac5544455 Revert "composer: adds BufferAhead for the LayerCommand.aidl"
This reverts commit d40304b574.

Reason for revert: Punting hal changes to future release

Change-Id: I0980ac2d36962998472f46ece93f88f28fac4232
2022-02-08 19:03:44 -08:00
ramindani
8bb4ce13a2 Remove test GetDisplayAttributeConfigsInAGroupDifferOnlyByVsyncPeriod
The test is removed from aosp so won't be required in HWC3.0

BUG: 200184776

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I21f0ccf94d1d92a730a41b579bf111fa0553f609
2022-02-08 19:44:07 +00:00
ramindani
dcecfd46a1 Use Wrapper in the readback tests.
BUG: 199413815

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I3a7e81f8c04971b178ae703a3eb83de50ae0810f
2022-02-08 19:44:06 +00:00
ramindani
431aad4a65 Use VtsComposerClient in Base test
Makes corrections to the code such as checking EXPECT_TRUE, ASSERT_TRUE in certain cases, test name corrections, consolidate layer configurations.
See comments in ag/16465080 for change refrences.

BUG: 199413815
Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I73c4621d8c525fdfbcd301d78a1ad97c142b2864
2022-02-08 19:44:06 +00:00
ramindani
edf3ef9f93 IComposerClient wrapper for VTS tests
A wrapper helps with implementation details of IComposerClient and
improves re-usability with readback and base tests.

Changes from the original wrapper (ag/16578214):

Changed the createClient to return ScopedAStatus
as it helps more with the singleton test.
And updated getDisplays to go through all the configurations
and save it in the DisplayResources as we use
the properties like width, height, vsync later
in the test and we avoid querying to the composerClient for this.

With readback tests updated setReadbackBuffer method to use
const native_handle_t* buffer instead of const native_handle* buffer

BUG: 199413815

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: Ia33c9489bf15a52edcae55a91ec56666df3726c1
2022-02-08 19:32:11 +00:00
Leon Scroggins III
e5c038e9ef Add a more detailed HAL for DISPLAY_DECORATION
Different hardware may prefer different formats for DISPLAY_DECORATION
layers. Add a new struct with two enums: one for the format, and one for
how to interpret the alpha. These two properties are orthogonal.

Add IComposerClient.getDisplayDecorationSupport for retrieving the
struct. I0c2fbc78cf5e4e97cede4762699a1ecc98620919 demonstrates a sample
implementation.

Remove the DisplayCapability.DISPLAY_DECORATION, which is replaced by
this.

Bug: 216644902
Test: manual
Change-Id: I27f119f927b23052c5fd8f068cbca75338fe7b91
2022-02-07 11:41:35 -05:00
TreeHugger Robot
66cb6f97d0 Merge "Revert "IComposerClient wrapper for VTS tests"" 2022-01-29 03:13:08 +00:00
Ram Indani
22884acd6a Revert "IComposerClient wrapper for VTS tests"
This reverts commit 634340d6a8.

Reason for revert: No one is using it, I will make a cl with usage of the wrapper along side this and reupload it.

Change-Id: I3ff3427fc9e81d53fd47a082ab027441f5dc8a66
2022-01-29 02:00:21 +00:00
Ram Indani
d1cbbea53f Merge "IComposerClient wrapper for VTS tests" 2022-01-29 01:52:29 +00:00
ramindani
634340d6a8 IComposerClient wrapper for VTS tests
A wrapper helps with implementation details of IComposerClient and
improves re-usability with readback and base tests.

BUG: 199413815

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I627748d1c779eaacf92ff6fb5ccf3138a3024681
2022-01-28 23:13:18 +00:00
TreeHugger Robot
e8b2c912a2 Merge "composer3: update cursorPosition documentation" 2022-01-28 01:15:48 +00:00
Ady Abraham
ac1125cb98 composer3: update cursorPosition documentation
Remove the word asynchronous and insteam explain 
that the cursor position can be updated without a validate/present.

Change-Id: Ia01bc097bc335779dba4e06577c285ca133dfd02
Fixes: 209711877
Test: make
2022-01-27 22:57:43 +00:00
TreeHugger Robot
99684613d9 Merge "composer: adds BufferAhead for the LayerCommand.aidl" 2022-01-27 21:53:57 +00:00
ramindani
d40304b574 composer: adds BufferAhead for the LayerCommand.aidl
Adds a Capability param as BUFFER_AHEAD to check if
BufferAhead is supported.

Test: Device boots after these changes.
BUG: 198186628
Change-Id: Ic0f3e602635a2519f4e90c546dfca1af985116f9
2022-01-27 19:36:33 +00:00
TreeHugger Robot
b20697869b Merge "composer: add API to control display idle timer" 2022-01-26 03:04:51 +00:00
Jason Macnak
325e8235c3 Skip expectedPresentTime_* tests when unreliable fences cap present
... as these tests depends on present fence signal times.

Bug: b/193240715
Test: cvd start
Test: vts -m VtsHalGraphicsComposer3_TargetTest
Change-Id: Iad0b89daa85e01a287f045a91b1cbdb890fee05d
2022-01-24 14:51:19 -08:00
Alec Mouri
3e037cf683 Remove stride from VTS classes
Stride must be retrieved from the graphic buffer immediately prior to
CPU access. The previous code was tripped up by an error-prone situation
where stride was never initialized, causing UB.

Also this patch sneaks in a couple of const modifiers for methods that
pass-by-ref.

Bug: 213493262
Test: VtsHalGraphicsComposer3_TargetTest
Change-Id: Ic601cca128b71d36876ed25bd55140b02cb0ad0f
2022-01-24 10:58:41 -08:00
Alec Mouri
710a50ae6b Merge "Fix asserts for GetReadbackBufferFenceInactive" 2022-01-21 21:17:31 +00:00
Alec Mouri
62ae37be3c Fix asserts for GetReadbackBufferFenceInactive
If there's no readback buffer, then the status is NOT ok(), and the
returned fence must be -1.

Bug: 213493262
Test: VtsHalGraphicsComposer3_TargetTest
Change-Id: Iff1b6e04126bfcc748f0f8d173f63244bfd83be4
2022-01-21 19:42:32 +00:00
Alec Mouri
f23f502fcc Merge changes from topic "whitepoint_readback_vts"
* changes:
  Cleanup for readback buffer management:
  Readback test support for per-layer dimming
2022-01-21 19:42:16 +00:00
Midas Chien
a0b56bde11 composer: add API to control display idle timer
Add new functions to control display idle timer
- Adding an API to r configure display idle timer.
- Extend DisplayCapability to query display support idle timer.
- Adding an callback for notify client the display is idle, the refresh
  rate changed to a lower setting to preserve power and vsync cadence
  changed. The client can enable vsync callback to learn the new vsync
  cadence before sending a new frame.

Bug: 194068871
Bug: 198808492
Test: build, vts
Change-Id: I47649d222022922926a05f2d700ca798f8f48b35
2022-01-21 15:38:52 +08:00
Jason Macnak
062bc9a3a6 Use IComposerClient::EX_UNSUPPORTED
Bug: b/193240715
Test: cvd start
Test: vts -m VtsHalGraphicsComposer3_TargetTest
Change-Id: Ibf80a618dead09ffdea56d373a83a691124c7d2e
2022-01-20 15:00:09 -08:00
Alec Mouri
7b4d5ee452 Cleanup for readback buffer management:
* Tests exercising that a bad readback buffer is sent should actually
use a native_handle from a deallocated buffer rather than a valid
handle, since that would still work
* Creating a readback buffer should not require passing in a buffer at
construction. Instead ReadbackBuffer should always allocate its buffer
internally whenever a new buffer needs to be generated.
* Passing the readback buffer's fence to lockAsync should be a dup'd fd,
as lockAsync takes ownership of the fence

Bug: 213493262
Test: VtsHalGraphicsComposer3_TargetTest
Change-Id: I73396f982cf9a67f0dd81eaed509cf9cc7b03314
2022-01-20 12:16:45 -08:00
Jason Macnak
e531a092fc Check createComposer().isOk() in test setup
Bug: b/193240715
Test: cvd start
Test: vts -m VtsHalGraphicsComposer3_TargetTest
Change-Id: I0a2b90bcb403fbf3454046d3e46bf972a4d149f7
2022-01-20 10:15:43 -08:00
Alec Mouri
0cb31dbb0a Merge "Add VTS for setting layer white point" 2022-01-20 17:57:09 +00:00
Ady Abraham
96e2785b7e Merge "composer: add getDisplayPhysicalOrientation" 2022-01-19 04:03:48 +00:00
Ady Abraham
ae12e389fd composer: add getDisplayPhysicalOrientation
Add an API to query the physical display orientation.

Bug: 213237830
Test: VTS
Change-Id: I4ea9ee5c8655be283e19156b0ce68e35674ac321
2022-01-19 01:13:28 +00:00
Leon Scroggins
a393f66d23 Merge "Add VTS for setLayerBlockingRegion" 2022-01-14 19:25:51 +00:00
Alec Mouri
510670192a Readback test support for per-layer dimming
Dimming is only verified if setting display brightness is supported. The
test then does:
* Sets the display brightness to max, which is the same nit level that
is found in the display xml file
* Dims a layer by 10%

Bug: 213493262
Test: builds
Change-Id: I3b552682276be26fefd7ae5586ba42af0e574e31
2022-01-14 11:10:59 -08:00
Alec Mouri
95e490bf23 Add VTS for setting layer white point
No readback tests as of yet, as that will necessitate a new api to get
the max display brightness, so that we can max out the brightness -> use
well-defined dimming ratios

Bug: 213493262
Test: builds
Change-Id: I0166dc67f4c52919c02ab7abbf47701e6be3d983
2022-01-14 10:50:05 -08:00
Vishnu Nair
6a265c50fc Merge "Update VTS to use ExternalTexture impl" 2022-01-14 17:04:26 +00:00