summaryrefslogtreecommitdiffstats
path: root/libs/gui/include
Commit message (Collapse)AuthorAgeFilesLines
* libgui: Add discardFreeBuffers callback to producerShuzhen Wang2019-12-093-1/+55
| | | | | | | | | | This enables buffer producer to clear its buffer caches. Test: Camera CTS, libgui_test Bug: 136677409 Bug: 145617243 Change-Id: I7f46e977f3edc3b08177654531745d8ca0b86889 Merged-In: I7f46e977f3edc3b08177654531745d8ca0b86889
* libgui: add EGL Image Tracking for debugAdy Abraham2019-07-221-0/+44
| | | | | | | | Track EGL images allocated by libgui to help debug memory leaks Test: monkey Bug: 137514000 Change-Id: I0b193c0fdb7a4c07d7c2e5d06063e3dc01b5a57b
* Attach color space information when attach and queue buffer.Peiyong Lin2019-06-261-1/+2
| | | | | | | | | | Currently when calling attachAndQueueBuffer, the color space information is lost. This results in color shift if the color space doesn't match the color space of the surface. BUG: b/135002842, b/131928312 Test: boot. Manually verified on P19 Change-Id: I1d77c9994f50d9a2f5cfde96ca805f7142fddfab
* Merge "SurfaceFlinger: add explicit register for ↵TreeHugger Robot2019-06-082-2/+8
|\ | | | | | | DISPLAY_EVENT_CONFIG_CHANGED" into qt-r1-dev
| * SurfaceFlinger: add explicit register for DISPLAY_EVENT_CONFIG_CHANGEDAdy Abraham2019-06-052-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When display refresh rate changes, SF fires DISPLAY_EVENT_CONFIG_CHANGED thru DisplayEventReceiver. If the other end of the pipe doesn't consume the events it may lead to pipe full and dropping of events. Furthermore, The only clients interested in this event in DisplayManager and hwui. To avoid spamming all clients with this event, this change is adding an explicit register for DISPLAY_EVENT_CONFIG_CHANGED events. Bug: 131688378 Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest Test: trigger config change and observe logcat Change-Id: I5973a1ecc1f3e3ff8d8a0cba19db0e49ef0d5341
* | Drop buffers for SurfaceFlinger properlySungtak Lee2019-05-281-1/+2
|/ | | | | | | | | Drop buffers restrictively when consumer is SurfaceFlinger. When both producer and consumer are controlled by app and timeout is not positive, drop buffers for SurfaceFlinger. Bug: 133214906 Change-Id: Ied102857673cbf36e51aac6abeea9abffbdcce67
* SurfaceFlinger: Add touch events to SchedulerAdy Abraham2019-05-172-0/+21
| | | | | | | | | | | | | | | Add the notion of Touch Events to Scheduler to enhance the algorithm to move to Performance refresh rate. Scheduler selects Performance when: - There is a touch event - There is a buffer to HWC This change also removes the behavior of Scheduler to move to Performance on Choreographer callbacks. Test: Switch between apps using gesture navigation Bug: 131906818 Change-Id: I588cfc32449e87744e829dc7c5261a2e4151a8f8
* Merge "Added captureScreen function for displayId or layerStack" into qt-devChavi Weingarten2019-05-092-0/+6
|\
| * Added captureScreen function for displayId or layerStackchaviw2019-05-082-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, screencap shell command could accept a display id as an argument. It would use the id to look up information about the display (displayToken, orientation, colorMode) by making requests into SurfaceFlinger. Since those requests only worked for physical display ids, screencap didn't work to capture virtual displays. Instead of adding new methods to look up display information for a virtual display, this change just adds a new captureScreen function in SurfaceFlinger that accepts a displayId or layerStack and handles getting the default info for the requested display. This works for both physical and virtual displays. Test: adb shell screencap -d <layerStack for virt display> Fixes: 130974213 Change-Id: I24b7558c973a057414c6b4f81ab1d60152fff38d
* | Merge "Zero-initialize HIDL structs before passing" into qt-devSteven Moreland2019-05-081-12/+12
|\ \
| * | Zero-initialize HIDL structs before passingSteven Moreland2019-05-071-12/+12
| |/ | | | | | | | | | | | | | | | | | | | | | | Test: make cts -j123 && cts-tradefed run cts-dev -m \ CtsMediaTestCases --compatibility:module-arg \ CtsMediaTestCases:include-annotation:\ android.platform.test.annotations.RequiresDevice Bug: 131267328 Bug: 131356202 Change-Id: Ie91b7946f8f4406fd06e9cb4ad883b3a2704f366
* / Clean-up egl image preallocationAlec Mouri2019-05-063-9/+0
|/ | | | | | | | | | Allocate EGL images in onFrameAvailable, instead of a custom onBuffersAllocated callback. This way we reduce traffic over binder while still performing GL work ahead of time in queueBuffer(). Bug: 130567928 Test: systrace Change-Id: I4070e9ddbd379dac3d809d0e7edb2855fc8b7a80
* SurfaceFlinger: fix deferred transactions for buffers with timestampsAdy Abraham2019-04-301-0/+3
| | | | | | | | | | | A deferred transaction needs to wait until the buffer is ready to be latched. This means that the buffer needs to be: 1. Done with rendering (fence has signaled) 2. Present timestamp is within the boundary of the next vsync Test: Screen rotation with Chrome Bug: 130785247 Change-Id: I8def1f10ea3d5c253ab14fa3aa4445588fc2ba8b
* Merge "SurfaceFlinger: Validate layers before casting." into qt-devRob Carr2019-04-221-6/+3
|\
| * SurfaceFlinger: Validate layers before casting.Robert Carr2019-04-151-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reinterpret casting random IBinder = no-fun. I first attempted to use inheritance of "getInterfaceDescriptor" in Layer::Handle but departing from "standard-layout" (e.g. using virtual methods) means that downcasting with static/reinterpret_cast is no longer valid. Instead I opted for the pattern the system-server uses of maintaing a map. Now that we look up the handle in a map rather than casting IBinder to Layer::Handle we need to make sure we have unique instances of the handle. In general this is true but we weren't doing this in the createWithSurfaceParent where we had an extra call to getHandle. Here we both refactor createWithSurfaceParent so it works with the new changes and also add protection for getHandle. We also fix an error where the handle map was populated outside of lock. Bug: 129768960 Test: InvalidHandles_test.cpp ASurfaceControlTest SurfaceControlTest Change-Id: I869bf6164c8d8203af7486ed1b12a763d5a56662
* | Change slot generation for BufferStateMarissa Wall2019-04-162-6/+10
|/ | | | | | | | | | | | | BufferState layers now do slot generation with buffer death considered appropriately. When a buffer dies, the slot will be pushed onto a stack of available slots to be reused at the next opportunity. This should mimic BufferQueue slot behavior and prevent Composer Resources from growing too large. Test: build, boot, manual Bug: 129351223 Change-Id: Icef9592593cacb0b5c6b12f6679fc2c4dabdcd19
* Merge "Make NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY transforms sticky" into ↵TreeHugger Robot2019-04-111-0/+1
|\ | | | | | | qt-dev
| * Make NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY transforms stickyVishnu Nair2019-04-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a client sets the NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY flag, the buffer producer may override the flag if it sets a buffer transform. The second issue is that SurfaceFlinger may apply a transform hint based on display orientation which may be applied by the buffer producer. The flag NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY indicates the client wants to submit buffers in the same orientation regardless of display orientation. So if the flag is set, make it sticky until the surface is disconnected. Secondly, ignore the transform hint if the flag is set. Test: Launch test app and test seamless rotation in portrait mode and landscape mode Test: go/wm-smoke Test: atest libsurfaceflinger_unittest libgui_test SurfaceFlinger_test Bug: 127953232 Change-Id: Ic153faae0f3cdc9d385cdfe8162d3caabac60901
* | Merge "BufferQueueProducer::queueBuffer may not drop buffers" into qt-devTreeHugger Robot2019-04-113-0/+21
|\ \
| * | BufferQueueProducer::queueBuffer may not drop buffersSungtak Lee2019-04-093-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable BufferQueueProducer::setDequeueTimeout retain existing dropping behavior. Setting negative and zero to setDequeueTimeout will not change existing dropping behavior. BufferQueueProducer::setLegacyBufferDrop can disable buffer dropping behavior of BufferQueueProducer::queueBuffer. If it's disabled, buffers will not be dropped unless consumer is SurfaceFlinger. Bug: 130039639 Change-Id: I8432a7ad386836498e632c67953ad49c6be008bb
* | | Merge "Revert "SurfaceFlinger: Validate layers before casting."" into qt-devTreeHugger Robot2019-04-101-3/+6
|\ \ \
| * | | Revert "SurfaceFlinger: Validate layers before casting."Marissa Wall2019-04-101-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4293e9d75d5b0d033126f529ab61dd1f4a8d8420. Reason for revert: it broke CtsViewTestCases:android.view.cts.ASurfaceControlTest Bug: 129768960 Change-Id: I4b97869eefdf9108cf2e0e33656037780e5376f7
* | | | Merge "SurfaceFlinger: Indicate whether we have captured secure layers." ↵Rob Carr2019-04-092-4/+7
|\ \ \ \ | |/ / / |/| | | | | | | into qt-dev
| * | | SurfaceFlinger: Indicate whether we have captured secure layers.Robert Carr2019-04-052-4/+7
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For purposes of the screen rotation animation the system server is allowed to capture secure (not protected) layers and trusted not to persist screenshots which may contain secure layers. However when displaying the screen rotation animation, the layer the screenshot is placed on will itself not be secure, so if we record the animation the recording will contain persisted versions of the secure content. Here we forward whether the screenshot contains secure content so that system server can do the right thing. Bug: 69703445 Test: Transaction_test#SetFlagsSecureEuidSystem Change-Id: I828cfe3faee3a0c84525f90b9df8b66e392bc240
* / / SurfaceFlinger: Validate layers before casting.Robert Carr2019-04-051-6/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | Reinterpret casting random IBinder = no-fun. I first attempted to use inheritance of "getInterfaceDescriptor" in Layer::Handle but departing from "standard-layout" (e.g. using virtual methods) means that downcasting with static/reinterpret_cast is no longer valid. Instead I opted for the pattern the system-server uses of maintaing a map. Bug: 129768960 Test: InvalidHandles_test.cpp Change-Id: Ica8d08a2daf5e80d187e818adbff0c7901db69f7
* / SurfaceFlinger: Add exclusion list for captureLayers.Robert Carr2019-04-042-9/+21
|/ | | | | | | | | Among other use cases, WM needs to be able to omit the IME from Task Snapshots, even while it is on-screen. Bug: 126614127 Test: Transaction_test.cpp#CaptureLayerExclude,CaptureLayerExcludeTree Change-Id: I055d99106c9ce2ed90d64eca06961d88cbd5e2d4
* Merge "Move WGraphicBufferProducer into libgui"TreeHugger Robot2019-04-034-2/+1210
|\
| * Move WGraphicBufferProducer into libguiChong Zhang2019-03-254-2/+1210
| | | | | | | | | | | | | | | | | | | | So that client side omx codec code no longer need to link to libstagefright_bufferqueue_helper (which we want to link on server side only). bug: 129272021 Change-Id: Id69854158b4083ff8f0280decd599d86f11db4f5
* | Merge changes I735d68e8,I1226ed73Jorim Jaggi2019-04-022-9/+17
|\ \ | | | | | | | | | | | | | | | * changes: Wait for buffer allocation Convert Mutex to std::mutex in BufferQueueCore/Producer/Consumer
| * | Wait for buffer allocationJorim Jaggi2019-04-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In dequeueBuffer, if we don't have a free slot but are in the process of allocating, we wait for that to complete instead of kicking off our own allocation, as it's likely that the allocation from allocateBuffers is able to finish earlier than if we'd kick off our own allocation. Test: Swipe up, see less initial buffer dequeue delay Fixes: 111517695 Change-Id: I735d68e87fc7e2ff5b7ec3595f0ced5a94ebbf9c
| * | Convert Mutex to std::mutex in BufferQueueCore/Producer/ConsumerJorim Jaggi2019-04-022-9/+10
| | | | | | | | | | | | | | | Bug: 111517695 Change-Id: I1226ed7396d0d768a26f4145af5fe48e2c70e8d2
* | | Merge "Create EGLImages during buffer allocation"Alec Mouri2019-03-293-0/+9
|\ \ \
| * | | Create EGLImages during buffer allocationAlec Mouri2019-03-283-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EGLImage creation is now performed on an async binder thread, so now GPU composition should rarely be stalled by expensive image creation. Bug: 129008989 Test: systrace Change-Id: I9732f866933a8950a4c69ff51d5ac1622bbb3470
* | | | blast: in order no-op transaction callbacksMarissa Wall2019-03-291-13/+10
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transactions callbacks were being sent as soon as they were ready instead of in order. To fix this, keep a deque of Transaction callbacks and do not send a callback until all the callbacks before it have been sent. Bug: 128519264 Test: Transaction_test Change-Id: Ia363b3aca85bc1cd71d0fd915de79b44f786e09f
* | | blast: transaction callbacks should come in orderMarissa Wall2019-03-272-9/+12
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if no SurfaceControls where marked to get callbacks, a callback was sent directly from SurfaceComposerClient so we could save a binder call into SurfaceFlinger and a binder call for the callback. Although this saved us 2 binder calls, it made the transactions callbacks come out of order. The public api guarantees that all callbacks must come in order. This patch moves the callback from SurfaceComposerClient into SurfaceFlinger so the callbacks are in order. Bug: 128519264 Test: SurfaceFlinger_test Change-Id: Ia1cadb81adb69b58a4d6d43ae453c96a1572f833
* | blast: drop buffer from SF's cache when destroyedMarissa Wall2019-03-223-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an app drops its reference to an AHardwareBuffer, the buffer should be removed from the client and SurfaceFlinger caches. Ideally, both caches would have wp to the buffer and the buffer would automatically be removed from the cache. Unfortunately, GraphicBuffers are refcounted per process. If SurfaceFlinger just has a wp to the GraphicBuffer, the buffer's destructor will be called and SurfaceFlinger will lose access to the buffer. SurfaceFlinger can't just hold onto a sp to the buffer because then the buffer wouldn't be destoryed when the app drops its reference. Instead, when the app process drops its last strong reference, GraphicBuffer will send a callback to the client side cache. The cache will send a Transaction to SurfaceFlinger to drop its sp to the buffer. Bug: 127689853 Test: SurfaceFlinger_test Change-Id: I2182578ed33d7c731945cb88cd1decb2892266b0
* | Merge "libgui: update description of sourceCrop for captureScreen"TreeHugger Robot2019-03-221-2/+1
|\ \ | |/ |/|
| * libgui: update description of sourceCrop for captureScreenYiwei Zhang2019-03-211-2/+1
| | | | | | | | | | | | Bug: 117892959 Test: builds Change-Id: I757385465c537e51ddfc2fd830e1e2a35eab5883
* | Implement converters for bufferqueue@2.0Pawin Vongmasa2019-03-198-6/+540
|/ | | | | | | | | | Test: make cts -j123 && cts-tradefed run cts-dev -m \ CtsMediaTestCases --compatibility:module-arg \ CtsMediaTestCases:include-annotation:\ android.platform.test.annotations.RequiresDevice Bug: 112508112 Change-Id: I60f2068788136b01c45e03fc4d846d4e37edc7f2
* Merge "BufferQueueProducer: use the correct IPCThreadState."Jayant Chowdhary2019-03-181-0/+30
|\
| * BufferQueueProducer: use the correct IPCThreadState.Jayant Chowdhary2019-03-081-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The system variant of libgui maybe be double loaded. Also IGraphicBufferProducer functions may be called from hwbinder threads due to the presence of TWGraphicBufferProducer wrappers (hybrid interfaces). Therefore, we should use the correct IPCThreadState/ hardware::IPCThreadState to query callingPids. This also avoids access to /dev/binder in vendor processes, in case the system variant of the library is loaded, for eg: in libmediandk. Bug: 124128212 Test: Selinux denials realted to/dev/binder acccess are not present when AImageReader from libmediandk is used in a vendor process. Test: Play Youtube movies on Chrome, use camera to take pictures/ record videos (sanity). Change-Id: I27d78e30e16b7df5e3dfbb130121f3d7078671a3 Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
* | Moved brightness from Lights to SF.Dan Gittik2019-03-082-0/+59
|/ | | | | | | | Test: manual. Check that brightness works. Fixes: 111435292 Change-Id: I96dfdf0ad5d16fdb03e575cbe05ad4e1dbc8ee36
* Merge "libgui: add sampling fns to SurfaceComposerClient"TreeHugger Robot2019-03-071-0/+5
|\
| * libgui: add sampling fns to SurfaceComposerClientKevin DuBois2019-02-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | {add,remove}RegionSamplingListener was missing from SurfaceComposerClient. Add them here to make the JNI connection easier. Test: boot Test: atest CompositionSamplingListenerTest Bug: 124305231 Change-Id: Ifd8833c25c112743524cee0ac5f2eae035011161
* | [SurfaceFlinger] Add setColorSpaceAgnostic API.Peiyong Lin2019-03-042-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | Some layers, for example ScreenDecorOverlay*, only carry black, white or gray with some transpanrency, these values are special as they are color space agnostic. We don't need to do color conversion on them, instead we want to intercept the color space before we send to hardware composer for validation. This patch adds an API to allow this to happen. BUG: 126616348 Test: Build, flash and boot. Verify by calling in Letterbox. Change-Id: I62c9bf4feb320b466584a90df707c2b04213339c
* | Merge "SurfaceFlinger: add getAllowedDisplayConfigs"TreeHugger Robot2019-02-282-0/+15
|\ \
| * | SurfaceFlinger: add getAllowedDisplayConfigsAdy Abraham2019-02-272-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | Add an API to ISurfaceComposer to get allowed display configurations. Test: manual test that calls getAllowedDisplayConfigs() Bug: 122905403 Change-Id: Ieeb04f0d002ecfb2dbb0acd22ef6f659806c3950
* | | Merge changes from topic "display_policy"TreeHugger Robot2019-02-273-1/+21
|\| | | | | | | | | | | | | | | | | * changes: SurfaceFlinger: add DISPLAY_EVENT_CONFIG_CHANGED SurfaceFlinger: add setAllowedDisplayConfigs
| * | SurfaceFlinger: add DISPLAY_EVENT_CONFIG_CHANGEDAdy Abraham2019-02-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new event to DisplayEventReceiver for display configuration change. This event is sent by SF when display config is changed. Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest Bug: 122905403 Change-Id: Ibb7e0ce7b83b91259ccb0e9c982f5e378b0ebfaf
| * | SurfaceFlinger: add setAllowedDisplayConfigsAdy Abraham2019-02-252-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an API to ISurfaceComposer to set allowed display configurations. This API is expected to be called by DisplayManager depends on the current policy in place. Once setAllowedDisplayConfigs is called, SF can only set a new display config if it is part of the allowed configurations list. Test: call setAllowedDisplayConfigs() from backdoor and observe config change. Bug: 122905403 Change-Id: I1d0a3649bbe7a08efeb72dc270f0b2df330b021c