summaryrefslogtreecommitdiff
path: root/native/android/surface_control.cpp
AgeCommit message (Collapse)Author
2022-03-15Merge SP2A.220305.013Haamed Gheibi
Bug: 220074017 Change-Id: Idfdd94e902f656ac65a2a75dfdd199f6f85ba472
2021-07-12Remove isDataspaceValidJohn Reck
isDataspaceValid is problematic in that it prevents applications from being able to pass-through dataspaces they receive from other APIs, and it also assumes that the display's capabilities are the only things that are supported. Although it's recommended that applications stick to dataspaces that the display can handle, it's not strictly required. RenderEngine can handle more dataspaces than the display can, applying appropriate color conversion. Similarly this could be going to a virtual display instead, in which case the physical display's capabilities are not necessarily relevant. Bug: 149931223 Test: make Change-Id: I475f4e4dcbcdb4765670f6a8eb4cc047a9babb43
2021-05-11Remove rotation based scalingVishnu Nair
In order to simplify some of the geometry logic in BufferStateLayer, and unify with the rest of the layer in SurfaceFlinger we translate the concept of source and dest frame into crop, scale and position. This is currently done on the client side. But if there is buffer rotation transform, we will generate an additional scale, to scale the buffer size to the new orientation. This causes issues with rounded corners because the additional scale stretches the rounded corner incorrectly. And translating the buffer rotation into a rotation matrix affects child layers. This solution only adjusts the buffer size based on the rotation matrix and the scale is generated based on the rotated buffer. This cannot be done in the client side because we do not have the current display orientation to unflip the buffer if the client sets the transformToDisplayInverse flag. In the future the plan is to drive the transform hint and the display orientation down from WM so this calculation can go back to the client. Also fixes incorrect additional scaling from source frame to dest frame in ASurfaceTransaction_setGeometry. Test: atest SurfaceControlTest ASurfaceControlTest libgui_test SurfaceFlinger_test Test: go/wm-smoke Bug: 185597146 Change-Id: I38adbc72c7567510c953cfd362a94b2b38d7fda7
2021-04-29Restore old behavior in pulic API setGeometrychaviw
When setFrame was removed, it required some changes to setGeometry. However, this created some behavior changes between R and S. Modified setGeometry to restore old behavior. 1. Destination can't have negative left and top. If negative values are set, it will revert to (0,0,w,h) 2. If invalid source is set, an invalid rect for crop will be sent to SF which would normally mean crop is ignored. Test: ASurfaceControlTest Bug: 185533162 Change-Id: I5c86da7327f97e82c63ae1f1c985829b8a4dbaef
2021-04-27Added setBufferCrop to setGeometrychaviw
The crop being sent to SF is in layer space where the setGeometry API is getting buffer space crop. This breaks the API behavior so call setBufferCrop instead of setCrop Test: ASurfaceControlTest Fixes: 186266903 Change-Id: I8f2567aa41b9525c3c3dc08855d14d8a9b11c7e2
2021-04-21Introduce ASurfaceTransaction_setOnCommit apiVishnu Nair
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-14Updated native SurfaceControl APIs to reflect their behavior.chaviw
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-12Merge "Revert^2 "Remove setFrame from surface_control setGeometry"" into sc-devChavi Weingarten
2021-04-09Revert^2 "Remove setFrame from surface_control setGeometry"Chavi Weingarten
98aa7d4c88834987d5102f0137d206e921583ace Change-Id: I9172fac77048f548e1adacdc0041dc52a25eac0d
2021-04-09Merge "Revert "Remove setFrame from surface_control setGeometry"" into sc-devOrion Hodson
2021-04-08Revert "Remove setFrame from surface_control setGeometry"Orion Hodson
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-07Merge "Remove setFrame from surface_control setGeometry" into sc-devChavi Weingarten
2021-04-02Merge "ASurfaceTransaction: Add setEnableBackpressure" into sc-devRob Carr
2021-04-01ASurfaceTransaction: Add setEnableBackpressureRobert Carr
Expose the backpressure flag to NDK. See comment in header file for extensive discussion. Bug: 177458703 Test: Need new CTS Change-Id: I97cdaef5d499f57a270972f001517b8a520aa2fe
2021-03-31Merge "setFrameRate: Make shouldBeSeamless an enum" into sc-devMarin Shalamanov
2021-03-30Remove setFrame from surface_control setGeometrychaviw
Use setMatrix and setPosition instead Test: SurfaceFlinger_tests Test: ASurfaceControlTest Bug: 170765639 Change-Id: I5720276c12f085d564c19849c356ab304326979e
2021-03-24setFrameRate: Make shouldBeSeamless an enumMarin Shalamanov
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-17Split ASurfaceTransaction_setGeometry apiVasiliy Telezhnikov
This CL adds three new methods: setSourceRect, setPosition and setTransform. Test: ASurfaceControlTest Bug: 173671170 Change-Id: I00f05a45bfa2b6e53735d95977d32bdecbce3df1
2021-02-22Merge "Introduce DynamicDisplayInfo" into sc-devMarin Shalamanov
2021-02-18Introduce DynamicDisplayInfoMarin Shalamanov
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-17Add GPU completion to FrameMetrics (1/3)Jorim Jaggi
- 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-11Add ASurfaceControl_acquire apiHuihong Luo
hwui needs this api to hold a reference to a surface control object passed from java layer. Bug: 173671170 Test: manual Change-Id: I2b8417c289718bb1b99af47d7828e91b16785123
2020-11-17Add shouldBeSeamless param to Surface.setFrameRateMarin Shalamanov
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-10-22Allow creating child surfaces from BlastBufferQueueVishnu Nair
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-01Update JNI to pass SurfaceControls rather than handles to layer statePablo Gamito
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-02-17Add compatibility param to setFrameRate() apiSteven Thomas
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-01-29Pass back frame event statsValerie Hau
Adding frame event stats to SurfaceControlStats Not exposing to ASurfaceControlStats Bug: 141939081 Test: build, boot Change-Id: If64056514be6b5161d52f5e8c2cc499bd8389099
2020-01-22Add setFrameRate() apiSteven Thomas
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
2019-10-21Adding transformHint to callbacksValerie Hau
Bug: 141939598, 133512804 Test: build, boot, manual Change-Id: I58411368e5187b3a23eb9e8ac9abbf1cb1a5d97e
2019-08-26Do not crash on invalid dataspaceValerie Hau
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-05-23Handle NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY flag in ASurfaceTransactionVishnu Nair
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-04-23ASurfaceControl: fix surface damageMarissa Wall
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-02-11Merge "ASurfaceControl: dataspace (1/2)"TreeHugger Robot
2019-02-08ASurfaceControl: dataspace (1/2)Marissa Wall
Allow dataspace to be set on the SurfaceControl. Test: atest CtsViewTestCases:android.view.cts.ASurfaceControlTest Bug: 80477568 Change-Id: Idc12d0a4024fc21d570c5190af33559b818b4b08
2019-02-06Merge "Generalize physical display management"Dominik Laskowski
2019-02-04Generalize physical display managementDominik Laskowski
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-01Combining background color transactionsValerie Hau
Bug: 122326454 Test: ASurfaceControlTest cts test Change-Id: Ie6d6c5d4d8a27cbf936936200d1c81619d83ca87
2019-01-24Eliminate the usage of ConfigStore.Peiyong Lin
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-23Add setColor, setColorAlpha, and setColorDataspace to ASurfaceControlValerie Hau
Bug:122326454 Test: atest CtsViewTestCases:android.view.cts.ASurfaceControlTests Change-Id: If41f0a6b736315dbdb829cf3f8fefc654ede9bcf
2019-01-18ASurfaceControl: add more support to NDK (1/2)Marissa Wall
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-14ASurfaceControl: add SurfaceControl to NDK (1/2)Marissa Wall
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