summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayHardware/HWComposer.cpp
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-03-23 15:50:23 -0700
committerDan Stoza <stoza@google.com>2015-04-15 13:20:01 -0700
commitee44edd0acccbf5eaa918d75737c3b65ee04fff7 (patch)
tree757e79db1df532e85418fe69af5d6e49732e6869 /services/surfaceflinger/DisplayHardware/HWComposer.cpp
parent5065a55291b67f584d7b0be3fa3cfc4e29a3cd1c (diff)
downloadframeworks_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/HWComposer.cpp')
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp27
1 files changed, 27 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;
+ }
}
};