summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-08-21 12:05:09 -0700
committerJesse Hall <jessehall@google.com>2012-08-22 12:09:39 -0700
commitbbd164a3c790a0649dffd2f015e6f47692c72e1c (patch)
treecfad2ee7cd6599e65710b0de8c404aadd266356e /services/surfaceflinger
parent8f971ff6661c875e7adb3f14731e1579c3c80c62 (diff)
downloadframeworks_native-bbd164a3c790a0649dffd2f015e6f47692c72e1c.zip
frameworks_native-bbd164a3c790a0649dffd2f015e6f47692c72e1c.tar.gz
frameworks_native-bbd164a3c790a0649dffd2f015e6f47692c72e1c.tar.bz2
Update for cleanups in hwc interface
Change-Id: I363fd8b085167a1af6c14b68012bda5c62bfe59f
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp48
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.h5
2 files changed, 35 insertions, 18 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index eda0c0b..403b979 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -89,7 +89,7 @@ static size_t sizeofHwcLayerList(const hwc_composer_device_1_t* hwc,
static int hwcEventControl(hwc_composer_device_1_t* hwc, int dpy,
int event, int enabled) {
if (hwcHasVersion(hwc, HWC_DEVICE_API_VERSION_1_0)) {
- return hwc->methods->eventControl(hwc, dpy, event, enabled);
+ return hwc->eventControl(hwc, dpy, event, enabled);
} else {
hwc_composer_device_t* hwc0 = reinterpret_cast<hwc_composer_device_t*>(hwc);
return hwc0->methods->eventControl(hwc0, event, enabled);
@@ -98,7 +98,7 @@ static int hwcEventControl(hwc_composer_device_1_t* hwc, int dpy,
static int hwcBlank(hwc_composer_device_1_t* hwc, int dpy, int blank) {
if (hwcHasVersion(hwc, HWC_DEVICE_API_VERSION_1_0)) {
- return hwc->methods->blank(hwc, dpy, blank);
+ return hwc->blank(hwc, dpy, blank);
} else {
if (blank) {
hwc_composer_device_t* hwc0 = reinterpret_cast<hwc_composer_device_t*>(hwc);
@@ -162,6 +162,17 @@ static size_t& hwcNumHwLayers(hwc_composer_device_1_t* hwc,
}
}
+static void hwcDump(hwc_composer_device_1_t* hwc, char* buff, int buff_len) {
+ if (hwcHasVersion(hwc, HWC_DEVICE_API_VERSION_1_0)) {
+ if (hwc->dump)
+ hwc->dump(hwc, buff, buff_len);
+ } else if (hwcHasVersion(hwc, HWC_DEVICE_API_VERSION_0_1)) {
+ hwc_composer_device_t* hwc0 = reinterpret_cast<hwc_composer_device_t*>(hwc);
+ if (hwc0->dump)
+ hwc0->dump(hwc0, buff, buff_len);
+ }
+}
+
// ---------------------------------------------------------------------------
struct HWComposer::cb_context {
@@ -213,6 +224,14 @@ HWComposer::HWComposer(
}
if (mHwc) {
+ if (mHwc->registerProcs) {
+ mCBContext->hwc = this;
+ mCBContext->procs.invalidate = &hook_invalidate;
+ mCBContext->procs.vsync = &hook_vsync;
+ memset(mCBContext->procs.zero, 0, sizeof(mCBContext->procs.zero));
+ mHwc->registerProcs(mHwc, &mCBContext->procs);
+ }
+
// always turn vsync off when we start
needVSyncThread = false;
if (hwcHasVsyncEvent(mHwc)) {
@@ -226,14 +245,6 @@ HWComposer::HWComposer(
needVSyncThread = true;
}
- if (mHwc->registerProcs) {
- mCBContext->hwc = this;
- mCBContext->procs.invalidate = &hook_invalidate;
- mCBContext->procs.vsync = &hook_vsync;
- mHwc->registerProcs(mHwc, &mCBContext->procs);
- memset(mCBContext->procs.zero, 0, sizeof(mCBContext->procs.zero));
- }
-
if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_1))
mNumDisplays = HWC_NUM_DISPLAY_TYPES;
@@ -280,12 +291,17 @@ status_t HWComposer::initCheck() const {
return mHwc ? NO_ERROR : NO_INIT;
}
-void HWComposer::hook_invalidate(struct hwc_procs* procs) {
- reinterpret_cast<cb_context *>(procs)->hwc->invalidate();
+void HWComposer::hook_invalidate(const struct hwc_procs* procs) {
+ cb_context* ctx = reinterpret_cast<cb_context*>(
+ const_cast<hwc_procs_t*>(procs));
+ ctx->hwc->invalidate();
}
-void HWComposer::hook_vsync(struct hwc_procs* procs, int dpy, int64_t timestamp) {
- reinterpret_cast<cb_context *>(procs)->hwc->vsync(dpy, timestamp);
+void HWComposer::hook_vsync(const struct hwc_procs* procs, int dpy,
+ int64_t timestamp) {
+ cb_context* ctx = reinterpret_cast<cb_context*>(
+ const_cast<hwc_procs_t*>(procs));
+ ctx->hwc->vsync(dpy, timestamp);
}
void HWComposer::invalidate() {
@@ -714,8 +730,8 @@ void HWComposer::dump(String8& result, char* buffer, size_t SIZE,
layer->getName().string());
}
}
- if (mHwc && hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_0_1) && mHwc->dump) {
- mHwc->dump(mHwc, buffer, SIZE);
+ if (mHwc) {
+ hwcDump(mHwc, buffer, SIZE);
result.append(buffer);
}
}
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 8080d3b..d15c6f4 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -229,8 +229,9 @@ private:
struct cb_context;
- static void hook_invalidate(struct hwc_procs* procs);
- static void hook_vsync(struct hwc_procs* procs, int dpy, int64_t timestamp);
+ static void hook_invalidate(const struct hwc_procs* procs);
+ static void hook_vsync(const struct hwc_procs* procs, int dpy,
+ int64_t timestamp);
inline void invalidate();
inline void vsync(int dpy, int64_t timestamp);