Commit Graph

36 Commits

Author SHA1 Message Date
Vishnu Nair
beb3b482db Introduce ASurfaceTransaction_setOnCommit api
Introduce a new callback for SurfaceControl transactions that
fire after we commit a transaction in SurfaceFlinger. This
will help some clients pace when they should apply the next
transaction so it get applied on the next vsync. If they wait for
the existing transaction complete callback, there may not be
enough time between when the client applies the transaction
and surface flinger waking up and apply it on the new vsync.
This would mean the update would arrive a frame late.

Bug: 185843251
Test: atest ASurfaceControlTest
Change-Id: If0d5d01a1d5c2029eb81667356e666d7297376d4
2021-04-21 15:06:19 -07:00
chaviw
ccf3e8b9f9 Updated native SurfaceControl APIs to reflect their behavior.
Updated setPosition, setCrop, setBufferTransform, and added setScale
to native SurfaceControl API. The new functions should be pass through
calls to SurfaceComposerClient that sends it to SurfaceFlinger.

Test: ASurfaceControlTest
Bug: 170765639
Change-Id: I214c5ae998d8f896200f3010cf2de6754d1e8510
2021-04-14 16:40:33 -05:00
Chavi Weingarten
a6d011d092 Merge "Revert^2 "Remove setFrame from surface_control setGeometry"" into sc-dev 2021-04-12 13:51:01 +00:00
Chavi Weingarten
305ec1d5c8 Revert^2 "Remove setFrame from surface_control setGeometry"
98aa7d4c88

Change-Id: I9172fac77048f548e1adacdc0041dc52a25eac0d
2021-04-09 13:37:33 +00:00
Orion Hodson
397cb14bd3 Merge "Revert "Remove setFrame from surface_control setGeometry"" into sc-dev 2021-04-09 07:34:01 +00:00
Orion Hodson
98aa7d4c88 Revert "Remove setFrame from surface_control setGeometry"
Revert "Remove setFrame from BufferStateLayer"

Revert "Update tests to reflect the new behavior for setGeometry"

Revert submission 13843937-sc_remove_set_frame

Reason for revert: Candidate CL for b/184807094
Reverted Changes:
Iffbd955a3:Remove setFrame
I27f17bc61:Update tests to reflect the new behavior for setGe...
I5720276c1:Remove setFrame from surface_control setGeometry
I32ee0e3e4:Remove setFrame from BufferStateLayer

Bug: 184807094
Change-Id: I7f6f0d7799e6e2858af2ce2e8acb5c67db8714f8
2021-04-08 12:30:21 +00:00
Chavi Weingarten
56fa22a105 Merge "Remove setFrame from surface_control setGeometry" into sc-dev 2021-04-07 18:56:42 +00:00
Rob Carr
782102ccd5 Merge "ASurfaceTransaction: Add setEnableBackpressure" into sc-dev 2021-04-02 19:03:09 +00:00
Robert Carr
f57c0163f9 ASurfaceTransaction: Add setEnableBackpressure
Expose the backpressure flag to NDK. See comment in
header file for extensive discussion.

Bug: 177458703
Test: Need new CTS
Change-Id: I97cdaef5d499f57a270972f001517b8a520aa2fe
2021-04-01 19:41:40 +00:00
Marin Shalamanov
d15b4b5473 Merge "setFrameRate: Make shouldBeSeamless an enum" into sc-dev 2021-03-31 14:30:23 +00:00
chaviw
5bdebd04de Remove setFrame from surface_control setGeometry
Use setMatrix and setPosition instead

Test: SurfaceFlinger_tests
Test: ASurfaceControlTest
Bug: 170765639
Change-Id: I5720276c12f085d564c19849c356ab304326979e
2021-03-30 16:51:17 -05:00
Marin Shalamanov
511f9145ba setFrameRate: Make shouldBeSeamless an enum
Change the shouldBeSeamless parameter to an enum
in order to make the API easier to understand.

This changes
 - SurfaceControl.setFrameRate
 - Surface.setFrameRate
 - ANativeWindow_setFrameRateWithChangeStrategy
 - ASurfaceTransaction_setFrameRateWithChangeStrategy

Bug: 179116474
Test: atest SetFrameRateTest
Change-Id: I55265399238e2c95fbb90fd33a4c2513d1fc5cec
2021-03-24 21:34:04 +01:00
Vasiliy Telezhnikov
5ead3aa5f2 Split ASurfaceTransaction_setGeometry api
This CL adds three new methods: setSourceRect, setPosition and
setTransform.

Test: ASurfaceControlTest
Bug: 173671170
Change-Id: I00f05a45bfa2b6e53735d95977d32bdecbce3df1
2021-03-17 18:14:55 +00:00
Marin Shalamanov
1b520a6d3f Merge "Introduce DynamicDisplayInfo" into sc-dev 2021-02-22 18:28:27 +00:00
Marin Shalamanov
463ad8ee22 Introduce DynamicDisplayInfo
In this CL we introduce SurfaceContorl.getDynamicDisplayInfo
which replaces the current seprate calls for supported and
active display mode, supproted and active color modes and
HDR capabilities.

This way display capabilities can be queried atomically.

Additionally this CL pipes an DisplayMode IDs from
SurfaceFlinger and updates LocalDislayAdapter to use
IDs instead of array indices.

Test: presubmit
Bug: 159590486
Bug: 175678215
Change-Id: I169e3055d07905e2330e11f158b61ffd366f97e6
2021-02-18 18:54:41 +01:00
Jorim Jaggi
71db8892ac Add GPU completion to FrameMetrics (1/3)
- Add SurfaceStatsCallback to TransactionCompletedListener
- Register a callback in RenderProxy to be called when we have
surface stats from SF via the BLAST callback.
- Instead of finishing a frame for frame metrics reporting
immediately, wait until BLAST callback fires, note GPU completion
time and finish frame.
- Expose GPU_COMPLETION in FrameMetrics
- Modify TOTAL_DURATION to also include GPU_COMPLETION

Test: FrameMetricsListenerTest
Fixes: 171046219
Change-Id: I16fa1d80cfc4e7a5527c18fec7e885409f17ee4d
2021-02-17 14:55:22 +01:00
Huihong Luo
91697e13ff Add ASurfaceControl_acquire api
hwui needs this api to hold a reference to a surface control object passed from java layer.

Bug: 173671170
Test: manual
Change-Id: I2b8417c289718bb1b99af47d7828e91b16785123
2021-02-11 17:59:04 +00:00
Marin Shalamanov
41ffa8dd06 Add shouldBeSeamless param to Surface.setFrameRate
This CL adds a new parameter shouldBeSeamless to the existing
setFrameRate APIs. This parameter indicates whether the desired
refresh rate should be achieved only seamlessly or also switches
with visual interruptions for the user are allowed. The default
value of the new parameter is "true".

Test: atest SetFrameRateTest
Test: atest RefreshRateConfigsTest
Test: atest libsurfaceflinger_unittest
Bug: 161776961
Change-Id: Ic2446d278e4f57fe507d30a0a18ef7b85909da4b
2020-11-17 11:53:14 +01:00
Vishnu Nair
ce1a648484 Allow creating child surfaces from BlastBufferQueue
App such as Chrome create child surfaces and parent them to
surfaces provided by SurfaceView. When we enable the blast
adapter for SurfaceView, the IGBP returned to the app is
created in the client and SurfaceFlinger does not know about it.
When the app creates a child surface and provides the IGBP as the
parent surface identifier, SF fails to validate the IGBP and the
surface is not created. This can be avoid if the client creates the
child surface from the SV SurfaceControl but we still need to
support existing APIs.

To fix this, when we create a Surface from the adapter, pass in
the handle of the Blast SurfaceControl. When calling
ASurfaceControl_createFromWindow, use this handle to identify
the parent.

Bug: 168917217
Test: adb shell settings put global use_blast_adapter_sv 1 & launch chrome
Change-Id: I879b411c47e8558397516bd7b7278813e79e005f
2020-10-22 18:03:22 -07:00
Pablo Gamito
117040c542 Update JNI to pass SurfaceControls rather than handles to layer state
updates

This allows us to have all the information that is stored in surface control including the layer id in the layer state so that it can be dumped directly from the client side

Test: N/A
Change-Id: I3d953382d0aad1a192ad9f767daa09a4ceefba8b
2020-10-01 17:34:18 +00:00
Steven Thomas
dd7bf2fea5 Add compatibility param to setFrameRate() api
Add a compatiblity param to the setFrameRate() api, so the system has
more info to decide the device frame rate when there are multiple
competing preferences.

I also changed the plumbing for setFrameRate() to go directly to surface
flinger, instead of through buffer queue. We're trying to avoid changes
to buffer queue code, to avoid disturbing the prebuilts.

Bug: 137287430

Test: Added new cts tests to verify behavior of the compatibility param.
      cts-tradefed run commandAndExit cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.SetFrameRateTest

Test: /data/nativetest64/SurfaceFlinger_test/SurfaceFlinger_test --gtest_filter='SetFrameRateTest.*'

Change-Id: I9123afee2ba63d01ff35fb2b257a1ee0e4928ddd
2020-02-17 00:38:43 -08:00
Valerie Hau
d6a222eab0 Pass back frame event stats
Adding frame event stats to SurfaceControlStats
Not exposing to ASurfaceControlStats

Bug: 141939081
Test: build, boot
Change-Id: If64056514be6b5161d52f5e8c2cc499bd8389099
2020-01-29 20:01:38 -08:00
Steven Thomas
6cf051ef89 Add setFrameRate() api
setFrameRate() is a new api in Android 11 that will enable apps to
specify their intended frame rate.

Bug: 143912624
Bug: 137287430

Test: Added a new CTS test - android.graphics.cts.SetFrameRateTest.

Change-Id: I922573c0d704e2e0ce4cfc2a462f14dce8cb7a79
2020-01-22 13:20:42 -08:00
Valerie Hau
ec453e1423 Adding transformHint to callbacks
Bug: 141939598, 133512804
Test: build, boot, manual
Change-Id: I58411368e5187b3a23eb9e8ac9abbf1cb1a5d97e
2019-10-21 14:43:28 -07:00
Valerie Hau
5e18c43fa7 Do not crash on invalid dataspace
Prior logic caused device to crash when setting the dataspace for a
layer to hdr on a non-hdr device.  Update to log the failure and perform
a no-op to match framework APIs.

Bug: 140029823
Test: build, boot, CtsViewTestCases:android.view.cts.ASurfaceControlTest
Change-Id: I9baf88a6d787e043b440ad4c2ebeb4c7a1fd90a2
2019-08-26 14:23:52 -07:00
Vishnu Nair
1ad69541a4 Handle NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY flag in ASurfaceTransaction
BufferStateLayer ignores NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY flag if its set as part of
the transform.

Fix this by calling Transaction::setTransformToDisplayInverse when calling
ASurfaceTransaction_setGeometry.

Bug: 133330435
Test: Test landscape orientation in test app
Test: go/wm-smoke
Change-Id: Id499448d822425e5b7be4efed7f448c4e4378b87
2019-05-23 09:09:09 +00:00
Marissa Wall
bb9b14f020 ASurfaceControl: fix surface damage
There are two problems with surface control.
1) By merging the rects, the Region turned into 0,0,0,0 instead of
an or of the Rects.
2) In the case where an app intends to have a region of 0,0,0,0,
we should treat it the same as a region of 0,0,-1,-1.

Bug: 131175047
Test: ASurfaceControl
Change-Id: Ib2e3b90ac215e069d3d3c2eca81ff1013b4287aa
2019-04-23 14:10:15 -07:00
TreeHugger Robot
5ea4f3ce4e Merge "ASurfaceControl: dataspace (1/2)" 2019-02-11 20:36:39 +00:00
Marissa Wall
7f24f79bc8 ASurfaceControl: dataspace (1/2)
Allow dataspace to be set on the SurfaceControl.

Test: atest CtsViewTestCases:android.view.cts.ASurfaceControlTest
Bug: 80477568
Change-Id: Idc12d0a4024fc21d570c5190af33559b818b4b08
2019-02-08 10:53:56 -08:00
Dominik Laskowski
9e7dce3833 Merge "Generalize physical display management" 2019-02-06 22:46:09 +00:00
Dominik Laskowski
3316a0a08e Generalize physical display management
This CL enables the framework to manage an arbitrary number of physical
displays. It also surfaces physical display IDs, which are stable across
reboots and encode (model, port) information that will be propagated
further up in a follow-up CL.

Bug: 116025192
Test: Boot with more than two displays
Test: Hotplug works with any number of displays
Test: Verify stable display IDs with "dumpsys display"
Change-Id: Idb2eaff66b2e0873be6ad27d337ff18b730d1331
2019-02-04 10:06:15 -08:00
Valerie Hau
6bc48231fc Combining background color transactions
Bug: 122326454
Test: ASurfaceControlTest cts test
Change-Id: Ie6d6c5d4d8a27cbf936936200d1c81619d83ca87
2019-02-01 13:18:56 -08:00
Peiyong Lin
0d04f32385 Eliminate the usage of ConfigStore.
Ideally modules above SurfaceFlinger should query ConfigStore through
ISurfaceComposer APIs. Previously getWideColorSupport directly evaluate wide
color support for built-in display, we don't want that, we should align it with
SurfaceFlinger.

BUG: 123312783
Test: Build, flash and boot. Verify in logcat.
Change-Id: I6299fe1a5483075a98adbb903d3bb68255afb699
2019-01-24 17:57:50 -08:00
Valerie Hau
5bbfd51757 Add setColor, setColorAlpha, and setColorDataspace to ASurfaceControl
Bug:122326454
Test: atest CtsViewTestCases:android.view.cts.ASurfaceControlTests

Change-Id: If41f0a6b736315dbdb829cf3f8fefc654ede9bcf
2019-01-23 12:12:27 -08:00
Marissa Wall
1be5a10c39 ASurfaceControl: add more support to NDK (1/2)
Adds several new functions and updates existing functions.
 - release fences
 - desired present time
 - alpha
 - hdr metadata

Test: atest CtsViewTestCases:android.view.cts.ASurfaceControlTest
Bug: 80477568
Change-Id: Iabda5936a51030bebabc4328dbd83108401603c2
2019-01-18 16:35:49 -08:00
Marissa Wall
f6a73faf81 ASurfaceControl: add SurfaceControl to NDK (1/2)
Add the NDK API for apps to use SurfaceControl for low level compositing
using SurfaceFlinger.

Test: atest CtsViewTestCases:android.view.cts.ASurfaceControlTest
Bug: 80477568, 111656650

Change-Id: If2c85a4427f422e41feeadbee0b64de7eb5c925e
2019-01-14 12:13:36 -08:00