summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueue.cpp
AgeCommit message (Collapse)Author
2025-02-26Revert^2 "Harden construction sites of android::StrongPointer." Anton Ivanov
This reverts commit f73db7a6242e297ead71df0d0d1fb3a8515245d3. Reason for revert: Scope restricted to sp<>::make which is a safe replacement for assignment from new. Bug: 393217449 Test: ChoreographerTests pass locally. Flag: EXEMPT_refactor Change-Id: I9a38c54c06cc64da099d282c05ccf20f40b70a72
2025-02-19Revert "Harden construction sites of android::StrongPointer." Priyanka Advani (xWF)
This reverts commit 81793808b9347a52dd979e4b3d5d9d10fc8c4915. Reason for revert: Droidmonitor created revert due to b/397788382. Will be verifying through ABTD before submission. Change-Id: Idd58b82a5a5380053cdff4e7b92eafa66b2c2782
2025-02-17Harden construction sites of android::StrongPointer. Anton Ivanov
Bug: 393217449 Test: presubmit Flag: EXEMPT_refactor Change-Id: Icf703aed608531e9b302b299481af00a52074731
2024-12-12libgui: Add support for unlimited slot BufferQueues Jim Shargo
BufferQueues can now be of unlimited size, according to the wishes of the producer. We add four new methods: - IGBC::allowUnlimitedSlots, which permits the IGBP to call extendSlotCount - IGBP::extendSlotCount, which increases the total available slot count to a fixed number and notifies the consumer via ICL::onSlotCountChanged - ICL::onSlotCountChanged, which notifies the consumer to resize its personal slot vector - IGBC::getReleasedBuffersExtented, which is like getReleasedBuffers but with an arbitrary sized bitvector instead of a fixed 64 bit vector The internal representation of the slots in BufferQueueCore is now a vector instead of an array, and can grow (but not shrink). The only consumers of these new APIs are intented to be Surface and ConsumerBase. Everything else is being migrated away from IGBP/IGBC anyway. This is part of go/warren-buffers. Bug: 341359814 Flag: com.android.graphics.libgui.flags.wb_unlimited_slots Test: new tests, old tests Change-Id: I0df872b9d6f9273854cc07a88d29b65451e1832a
2023-10-27libgui: use flag MACRO for BQ_SETFRAMERATE Ady Abraham
Bug: 281695725 Test: presubmit Change-Id: I644dadbfc72cd50d80c50d36da96078253bbc009
2023-09-14libgui: plumb setFrameRate thru BufferQueue Ady Abraham
The current implementation just assumes that the Surface and BLASTBufferQueue lives in the same process and rely on inheritance to handle setFrameRate. This doesn't work for any usecase that the Surface is Parceled to a diffrent process. Bug: 281695725 Test: atest CtsGraphicsTestCases --test-filter SetFrameRateTest* Change-Id: I4e08b92b618fa7b863ca3ef4f7b46d9f1c30c775
2022-09-30Remove bufferhub support from libgui. Peter Collingbourne
As far as I can tell the bufferhub support in libgui was never completed, and it is unused except for tests and the libdvr library (which is also unused except for benchmarks and tests, which I also removed, and its headers which I kept for now). This will allow building the platform with newer compilers that diagnose invalid code in libpdx, one of bufferhub's dependencies. Bug: 246977679 Change-Id: Iff5f879c2bb5583e789a604d64638e8ce7d2b2c5
2019-10-23Add tracing for dequeueBuffer, detachBuffer and cancelBuffer Adithya Srinivasan
The FrameTracer prototype currently doesn't have some of the events traced. This change adds the plumbing required to emit dequeueBuffer, detachBuffer and cancelBuffer. Only the dequeueBuffer is made to emit the event in this CL while enabling detach and cancel to have a place if emitting is required. Test: Build and trace with GAPID and FrameTracer perfetto changes. Bug: 142502670 Change-Id: I2ba90b32d7b309a7c8145f75387c8e6f8f6bd0fb
2019-05-06Clean-up egl image preallocation Alec Mouri
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
2019-03-28Create EGLImages during buffer allocation Alec Mouri
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
2018-06-05Replace NULL/0 with nullptr Yi Kong
Fixes -Wzero-as-null-pointer-constant warning. clang-tidy -checks=modernize-use-nullptr -p compile_commands.json -fix ... Test: m Bug: 68236239 Change-Id: I3a8e982ba40f9b029bafef78437b146a878f56a9
2018-04-10Mark some libs as double_loadable Jiyong Park
Following libs are explicitly marked as double_loadable since they are one of the (indirect) dependencies of LLNDK libraries and at the same time they themselves are marked as VNDK. Such lib can be double loaded inside a vendor process. * libgui and libbinder: due to indirect dependency from libmediandk via libmediaomx. libmediandk is LLNDK) * libui: due to dependency from libnativewindow, which is LLNDK. Also, dependencies from libui and libgui to libpdx_default_transport and libbufferhubque are cut when building libui and libgui for vendors. This is primarily to exclude libpdx* and libbufferhubqueue from VNDK and secondly not to mark transitive dependencies of the libs (such as libcrypto) as double_loadable. Note: even without this change, the library is already capable of being double loaded due to the dependency chain towards it. This change is to make it explicit so that double loading of a library is carefully tracked and signed-off by the owner of the lib. Bug: 77155589 Test: m -j Change-Id: Id4768162aeb72b71d63d7e4498980f276ef58e6b
2018-04-05BufferHubProducer: don't check user_metadata_size Jiwen 'Steve' Cai
Now we are using canonical metadata for all BufferHubQueue, it's actually wrong to enforce user_metadata_size. Bug: 75962234 Bug: 77655695 Test: buffer_hub_queue-test, buffer_hub_queue_producer-test, SurfaceParcelable_test, dvr_buffer_queue-test, libgui_test Change-Id: I6736ed277f7ac08d1f4a7288ce4a101bc89ca35b
2018-02-13Support BufferHub-backed IGBP in libgui_test Jiwen 'Steve' Cai
Use gtest's TestWithParam tests to support testing both BufferQueue backend and BufferHub backend. Testing against BufferHub backend is gated by USE_BUFFER_HUB_AS_BUFFER_QUEUE build time flag, so that build targets don't support BufferHub won't be impacted by this test. Known issues: b/36724099: Add support for BufferHubProducer::setAsyncMode(true) b/38137191: Implement BufferHubProducer::detachBuffer b/69981968: Implement BufferHubProducer::attachBuffer b/70041889: BufferHubProducer need to support metadata: numPendingBuffers b/70041952: BufferHubProducer need to support metadata: nextFrameNumber b/73267953: Make BufferHub hornor producer and consumer connection Bug: 68733388 Bug: 70046255 Bug: 73160000 Test: libgui_test Change-Id: I35631762781a622cabb0fba7302d18fb983dde40
2017-04-13get rid of IGraphicBufferAlloc Mathias Agopian
Buffers can now be allocated directly through the graphic allocator HAL. Test: marlin: run full camera cts Test: angler: take screenshot, take photo w/ and w/o HDR, video, panorama, refocus, slo-mo Bug: 36462585 Bug: 36333314 Change-Id: Ie5222c53c3b9462e0ac7a41568718aad131eb328
2017-03-16Revert "Get rid of IGraphicBufferAlloc" Romain Guy
This reverts commit 78491c9f694cb0767996503c629776a8eda950d7. Change-Id: I78d5c0a30ab80265f697f681387872b6763b2d1e
2017-03-15Get rid of IGraphicBufferAlloc Mathias Agopian
This reverts commit 527747dce1ab4714bd424e5c1a25ebad3506c2cb. selinux policy allowing this change fixed. Test: took a screenshot Test: ran ImageReaderTest CTS Bug: 36194109 Change-Id: I72ac17b6c252750aa2a66cd1d94bd8b4e21b5e9d
2017-03-13Revert "get rid of IGraphicBufferAlloc" Chia-I Wu
This reverts commit 1da94dfed674e94edc37cdc8ef68530520edf169. Bug: 36176799 Bug: 36175706 Change-Id: I6dd5fe8df564f0efa4392a800fb316e27a05076e
2017-03-08get rid of IGraphicBufferAlloc Mathias Agopian
buffers can now be allocated in-process. Test: compile & run Bug: cleanup Change-Id: I3d4317a9bed20a6d8be2b7ac8fbb85738efb3657
2017-02-15Fix unexpected FrameEvents on BufferQueue reconnect Brian Anderson
Helps reduce the number of ALOGE's being hit when switching between apps. * Notify Layer when the Producer disconnects. * Avoid sending event deltas from a previous connection. * Avoid releasing a frame more than once. Test: adb shell /data/nativetest/libgui_test/libgui_test --gtest_filter=*GetFrameTimestamps* Change-Id: I64f314be72ddb154b584d726ac382cd468e345bf
2016-11-17Cache frame event history producer-side. Brian Anderson
* Producer maintains a recent history of frames. * Producer only does a binder call if requested informatiVon doesn't exist in the cache. * Consumer sends fences to the producer, which can be queried for timestamps without a binder call. Test: adb shell /data/nativetest/libgui_test/libgui_test --gtest_filter=*GetFrameTimestamps* Change-Id: I8a64579407cc2935f5c659462cb227b07ba27e43
2016-11-15Track frame events incrementally and per layer. Brian Anderson
* Replaces FenceTracker, which was owned by SurfaceFlinger, with FrameEventHistory, which is owned by Layer. * Updates FrameEventHistory as events occur. * Changes SurfaceFlinger flag "--fences" to "--frame-events". Test: adb shell /data/nativetest/libgui_test/libgui_test --gtest_filter=*GetFrameTimestamps* Change-Id: I868c2ef93964656d7e41848243433499e7f45fe7
2016-07-21Integrate SurfaceInterceptor into SurfaceFlinger Irvel
Change-Id: If18d967f2b69ed219f17a9afedb61884ad5f1dc8
2016-06-07Plumbing for getting FenceTracker timestamps Pablo Ceballos
Change-Id: I1ebee9e42e28658bd3a2b161fdaabb7da756d8f3
2016-01-11Revert "libgui: Remove custom BufferQueue allocators" Dan Stoza
This reverts commit acd56150573d3a6d449c0de01f93c6f269d121e3. Change-Id: I877f63a57fbddb4dcff71b3909b460ecc05981eb
2016-01-08libgui: Remove custom BufferQueue allocators Dan Stoza
Removes the ability to set a custom GraphicBuffer allocator for a BufferQueue. Custom-allocated buffers may still be used through the attachBuffer call. Change-Id: I127bdfb496fc089a61c7e266c8bd2b906d41f32e
2015-05-11libgui: Hook up onFrameReplaced Dan Stoza
This completes the plumbing from ConsumerListener::onFrameReplaced into SurfaceFlinger (and other consumers that may care). Change-Id: I376e78ace95d6748e8662e6b4d47c0dfa697a300
2015-03-16libgui: Remove IGBC::BufferItem Dan Stoza
Removes IGraphicBufferConsumer::BufferItem. Depends on the following changes: I187b3a7d05196b6289596afac8fb9a9d4aebff76 I0ddd38df37500cfd6b21d1e768ed14e39c5cd9fc Change-Id: Id1fa56d092188f2cb712768d5d2fc6a9027fb73c
2014-11-07Add a BufferItem parameter to onFrameAvailable Dan Stoza
Passes the BufferItem for the queued buffer to the onFrameAvailable callback so the consumer can track the BufferQueue's contents. Also adds an onFrameReplaced callback, which is necessary if the consumer wants to do anything more than simple queue length tracking. Bug: 18111837 Change-Id: If9d07229c9b586c668e5f99074e9b63b0468feb0
2014-04-22Remove deprecated BufferQueue constructor Dan Stoza
Finally remove the BufferQueue constructor itself. From now on, all BufferQueues must be created through the createBufferQueue method. Bug: 13415624 Change-Id: I192bf9430265bab761dcd59db1f02c9d0ac4feed
2014-04-21Merge "BufferQueue: Increase max slots from 32 to 64" Dan Stoza
2014-04-18BufferQueue: Increase max slots from 32 to 64 Dan Stoza
Increases NUM_BUFFER_SLOTS from 32 to 64 and changes the mask returned by IGBC::getReleasedBuffers from 32 to 64 bits. Bug: 13174352 Change-Id: Ie8ef0853916cfb91f83881c7241886bb1950f01a
2014-04-15BufferQueueProducer: add detachNextBuffer Dan Stoza
Adds a new method, IGBP::detachNextBuffer, that effectively does dequeue + request + detach in a single call, but does not need to know anything about the dequeued buffer, and will not block on dequeue. This is mostly for the upcoming StreamSplitter to use in its onBufferReleased callback. Change-Id: Ie88a69de109003acebaa486a5b44c8a455726550
2014-04-11Merge "BufferQueue: Add producer buffer-released callback" Dan Stoza
2014-04-07BufferQueue: Remove Bn version of create* Dan Stoza
It turns out that there's no reason to have both I* and Bn* versions of the createBufferQueue method, so I removed the Bn* version. Change-Id: I66aeb09e10458ae540ddf1f38d2d0154ea8f315b
2014-03-31BufferQueue: Add producer buffer-released callback Dan Stoza
Add a callback to the producer side, onBufferReleased, which will be called every time the consumer releases a buffer back to the BufferQueue. This will enable a buffer stream splitter to work autonomously without having to block on dequeueBuffer. The binder object used for the callback replaces the generic IBinder token that was passed into IGraphicBufferProducer::connect to detect the death of the producer. If a producer does not wish to listen for buffer release events, it can pass in an instance of the DummyProducerListener class defined in IProducerListener.h, if it even cares about death events (BufferQueue doesn't enforce the token being non-NULL, though perhaps we should). Change-Id: I23935760673524abeafea2b58dccc3583b368710
2014-03-13Merge "Add sideband streams to BufferQueue and related classes" Jesse Hall
2014-03-12BufferQueue: Allow returning interfaces as I*/Bn* Dan Stoza
This adds a second createBufferQueue method that returns sp<IGraphicBuffer*> interfaces instead of sp<BnGraphicBuffer*>, since most clients don't actually need the Binderized versions (but some might). Change-Id: Iaf4f719c96ddb6f704afc75cf52be22588173e32
2014-03-11Add sideband streams to BufferQueue and related classes Jesse Hall
Sideband streams are essentially a device-specific buffer queue that bypasses the BufferQueue system. They can be used for situations with hard real-time requirements like high-quality TV and video playback with A/V sync. A handle to the stream is provided by the source HAL, and attached to a BufferQueue. The sink HAL can read buffers via the stream handle rather than acquiring individual buffers from the BufferQueue. Change-Id: Ib3f262eddfc520f4bbe3d9b91753ed7dd09d3a9b
2014-03-10BufferQueue: Allow detaching/reattaching buffers Dan Stoza
Adds detachBuffer and attachBuffer calls to both the producer and consumer sides of BufferQueue. Buffers may be detached while dequeued by the producer or acquired by the consumer, and when attached, enter the dequeued and acquired states, respectively. Bug: 13173343 Change-Id: Ic152692b0a94d99e0135b9bfa62747dab2a54220
2014-03-04Change BufferQueue into producer/consumer wrapper Dan Stoza
Now that BufferQueue has been split into core + producer + consumer, rewrite BufferQueue to be a thin layer over a producer and consumer interface. Eventually, this layer will be deprecated in favor of only using either the producer or consumer interface, as applicable. Change-Id: I340ae5f5b633b244fb594615ff52ba50b9e2f7e4
2013-11-21gui: Add tests for IGraphicBufferProducer Igor Murashkin
* Basic tests only. Needs more complicated queue/dequeue tests. * Also needs consumer-side tests to really be thorough. Change-Id: I1099dd56d65b6e9dfa15377726d6054ce657c0ca
2013-11-13gui: Update header docs for IGraphicBufferConsumer/Producer/BufferQueue Igor Murashkin
Also fix compiler warnings for libgui Change-Id: I0ee38d9ad5eaa82d55bf812d291da8c433581cef
2013-10-18am 251b11c2: am 85075869: Wait for buffers to drain Andy McFadden
* commit '251b11c2045b2ae97f2ab270a65e11b4ca49b1b6': Wait for buffers to drain
2013-10-18Wait for buffers to drain Andy McFadden
When a BufferQueue producer disconnects and reconnects, we retain the previously-queued buffers but empty the slots. This allows the number of queued buffers to grow without limit. The low-memory killer does not approve. Bug 11069934 Change-Id: Ia2eaa954c7a3904b54209a3701dba01689e204d8
2013-10-02am 6be1d210: am f0cf5f10: BufferQueue: fix a test crash Jamie Gennis
* commit '6be1d210eef392f5745d58a0033572b1af4b2f2a': BufferQueue: fix a test crash
2013-10-02BufferQueue: fix a test crash Jamie Gennis
Bug: 10935880 Change-Id: If76e9fb055103bad0db7e6c16487532671573149
2013-09-19Merge "Remove unnecessary include." Christopher Ferris
2013-09-19Remove unnecessary include. Christopher Ferris
All these files are including utils/CallStack.h, but none of the code uses any CallStack objects. Change-Id: I38c3a346a3bd0ddbff368d0f7f8b3f3d78fc0432
2013-09-17fix camera API 2.0 orientation Mathias Agopian
we add a flag to ANativeWindow::setBufferTransform that means "apply the inverse rotation of the display this buffer is displayed onto to". Bug: 10804238 Change-Id: Id2447676271950463e8dbcef1b95935c5c3f32b2