diff options
author | Dan Stoza <stoza@google.com> | 2015-03-23 15:50:23 -0700 |
---|---|---|
committer | Dan Stoza <stoza@google.com> | 2015-04-15 13:20:01 -0700 |
commit | ee44edd0acccbf5eaa918d75737c3b65ee04fff7 (patch) | |
tree | 757e79db1df532e85418fe69af5d6e49732e6869 /services/surfaceflinger/DisplayHardware | |
parent | 5065a55291b67f584d7b0be3fa3cfc4e29a3cd1c (diff) | |
download | frameworks_native-ee44edd0acccbf5eaa918d75737c3b65ee04fff7.zip frameworks_native-ee44edd0acccbf5eaa918d75737c3b65ee04fff7.tar.gz frameworks_native-ee44edd0acccbf5eaa918d75737c3b65ee04fff7.tar.bz2 |
SurfaceFlinger: Pass surface damage to HWC
Passes the surface damage from the incoming SurfaceFlingerConsumer
BufferQueue down to the hardware composer HAL interface, if the
HWC version number is 1.5 or greater.
Bug: 11239309
Change-Id: Ic4305210593874a8d6deba3319055b2b8c57e926
Diffstat (limited to 'services/surfaceflinger/DisplayHardware')
-rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer.cpp | 27 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer.h | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 77a9a19..c8b36ec 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -1020,6 +1020,21 @@ public: SharedBuffer const* sb = reg.getSharedBuffer(&visibleRegion.numRects); visibleRegion.rects = reinterpret_cast<hwc_rect_t const *>(sb->data()); } + virtual void setSurfaceDamage(const Region& reg) { + if (!hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_5)) { + return; + } + hwc_region_t& surfaceDamage = getLayer()->surfaceDamage; + // We encode default full-screen damage as INVALID_RECT upstream, but as + // 0 rects for HWComposer + if (reg.isRect() && reg.getBounds() == Rect::INVALID_RECT) { + surfaceDamage.numRects = 0; + surfaceDamage.rects = NULL; + return; + } + SharedBuffer const* sb = reg.getSharedBuffer(&surfaceDamage.numRects); + surfaceDamage.rects = reinterpret_cast<hwc_rect_t const *>(sb->data()); + } virtual void setSidebandStream(const sp<NativeHandle>& stream) { ALOG_ASSERT(stream->handle() != NULL); getLayer()->compositionType = HWC_SIDEBAND; @@ -1050,6 +1065,18 @@ public: } getLayer()->acquireFenceFd = -1; + + if (!hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_5)) { + return; + } + + hwc_region_t& surfaceDamage = getLayer()->surfaceDamage; + sb = SharedBuffer::bufferFromData(surfaceDamage.rects); + if (sb) { + sb->release(); + surfaceDamage.numRects = 0; + surfaceDamage.rects = NULL; + } } }; diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h index a62ac5c..28d8c65 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.h +++ b/services/surfaceflinger/DisplayHardware/HWComposer.h @@ -168,6 +168,7 @@ public: virtual void setFrame(const Rect& frame) = 0; virtual void setCrop(const FloatRect& crop) = 0; virtual void setVisibleRegionScreen(const Region& reg) = 0; + virtual void setSurfaceDamage(const Region& reg) = 0; virtual void setSidebandStream(const sp<NativeHandle>& stream) = 0; virtual void setBuffer(const sp<GraphicBuffer>& buffer) = 0; virtual void setAcquireFenceFd(int fenceFd) = 0; |