diff options
author | Dan Stoza | 2015-04-16 19:28:43 -0500 |
---|---|---|
committer | Dan Stoza | 2015-04-23 17:28:12 -0500 |
commit | 9de7293b0a1b01ebe6fb1ab4a498f144adc8029f (patch) | |
tree | f8ee5b60b00fb545ea324e94fdb4b246b0943f16 /services | |
parent | 0de7ea752900b5da29ad19c2799040235477f3c5 (diff) | |
download | frameworks-native-9de7293b0a1b01ebe6fb1ab4a498f144adc8029f.tar.gz frameworks-native-9de7293b0a1b01ebe6fb1ab4a498f144adc8029f.tar.xz frameworks-native-9de7293b0a1b01ebe6fb1ab4a498f144adc8029f.zip |
libgui: Allow an IGBProducer to disable allocation
Adds a new method IGBP::allowAllocation, which controls whether
dequeueBuffer is permitted to allocate a new buffer. If allocation is
disallowed, dequeueBuffer will block or return an error as it
normally would (as controlled by *ControlledByApp).
If there are free buffers, but they are not of the correct dimensions,
format, or usage, they may be freed if a more suitable buffer is not
found first.
Bug: 19801715
Change-Id: I0d604958b78b2fd775c2547690301423f9a52165
Diffstat (limited to 'services')
4 files changed, 10 insertions, 0 deletions
diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp index 0e94f0d58..11cbdc6d9 100644 --- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp +++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp | |||
@@ -526,6 +526,10 @@ void VirtualDisplaySurface::allocateBuffers(bool /* async */, | |||
526 | // TODO: Should we actually allocate buffers for a virtual display? | 526 | // TODO: Should we actually allocate buffers for a virtual display? |
527 | } | 527 | } |
528 | 528 | ||
529 | status_t VirtualDisplaySurface::allowAllocation(bool /* allow */) { | ||
530 | return INVALID_OPERATION; | ||
531 | } | ||
532 | |||
529 | void VirtualDisplaySurface::updateQueueBufferOutput( | 533 | void VirtualDisplaySurface::updateQueueBufferOutput( |
530 | const QueueBufferOutput& qbo) { | 534 | const QueueBufferOutput& qbo) { |
531 | uint32_t w, h, transformHint, numPendingBuffers; | 535 | uint32_t w, h, transformHint, numPendingBuffers; |
diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h index 0a3f4a157..97af9809a 100644 --- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h +++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h | |||
@@ -115,6 +115,7 @@ private: | |||
115 | virtual status_t setSidebandStream(const sp<NativeHandle>& stream); | 115 | virtual status_t setSidebandStream(const sp<NativeHandle>& stream); |
116 | virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, | 116 | virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, |
117 | PixelFormat format, uint32_t usage); | 117 | PixelFormat format, uint32_t usage); |
118 | virtual status_t allowAllocation(bool allow); | ||
118 | 119 | ||
119 | // | 120 | // |
120 | // Utility methods | 121 | // Utility methods |
diff --git a/services/surfaceflinger/MonitoredProducer.cpp b/services/surfaceflinger/MonitoredProducer.cpp index e4e7d4227..9fb555b47 100644 --- a/services/surfaceflinger/MonitoredProducer.cpp +++ b/services/surfaceflinger/MonitoredProducer.cpp | |||
@@ -110,6 +110,10 @@ void MonitoredProducer::allocateBuffers(bool async, uint32_t width, | |||
110 | mProducer->allocateBuffers(async, width, height, format, usage); | 110 | mProducer->allocateBuffers(async, width, height, format, usage); |
111 | } | 111 | } |
112 | 112 | ||
113 | status_t MonitoredProducer::allowAllocation(bool allow) { | ||
114 | return mProducer->allowAllocation(allow); | ||
115 | } | ||
116 | |||
113 | IBinder* MonitoredProducer::onAsBinder() { | 117 | IBinder* MonitoredProducer::onAsBinder() { |
114 | return IInterface::asBinder(mProducer).get(); | 118 | return IInterface::asBinder(mProducer).get(); |
115 | } | 119 | } |
diff --git a/services/surfaceflinger/MonitoredProducer.h b/services/surfaceflinger/MonitoredProducer.h index aec3e8502..b2f8293e6 100644 --- a/services/surfaceflinger/MonitoredProducer.h +++ b/services/surfaceflinger/MonitoredProducer.h | |||
@@ -53,6 +53,7 @@ public: | |||
53 | virtual status_t setSidebandStream(const sp<NativeHandle>& stream); | 53 | virtual status_t setSidebandStream(const sp<NativeHandle>& stream); |
54 | virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, | 54 | virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, |
55 | PixelFormat format, uint32_t usage); | 55 | PixelFormat format, uint32_t usage); |
56 | virtual status_t allowAllocation(bool allow); | ||
56 | virtual IBinder* onAsBinder(); | 57 | virtual IBinder* onAsBinder(); |
57 | 58 | ||
58 | private: | 59 | private: |