summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayHardware/HWComposer.cpp
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2012-10-02 19:04:45 -0700
committerThe Android Automerger <android-build@android.com>2012-10-04 14:42:03 -0700
commiteb1caaea6970d2cf870d26cadb40871f6b9784ab (patch)
tree50e484067f099f8803beb531655ed4479cdcaba1 /services/surfaceflinger/DisplayHardware/HWComposer.cpp
parent5031729a37b510959244e076bb1c4b06e1095f74 (diff)
downloadframeworks_native-eb1caaea6970d2cf870d26cadb40871f6b9784ab.zip
frameworks_native-eb1caaea6970d2cf870d26cadb40871f6b9784ab.tar.gz
frameworks_native-eb1caaea6970d2cf870d26cadb40871f6b9784ab.tar.bz2
Fix crashes after HDMI disconnect
The display was being removed from SurfaceFlinger's list before we had a chance to reset HWComposer's layer list, so we were passing stale data into the hardware composer (which has its own per-display data). This resulted in "invalid gralloc handle" complaints. We now clear the layer list immediately after removing the display. The display was being removed while its EGLSurface was still "current", resulting in "cancelBuffer: BufferQueue has been abandoned" complaints. We now call makeCurrent on the primary display before removing the external display. Bug 7274254 Change-Id: Ia59e3a61d7ec46488b96bf93ec5e4ed3488b70e4
Diffstat (limited to 'services/surfaceflinger/DisplayHardware/HWComposer.cpp')
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index fb93c47..302ce82 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -540,8 +540,13 @@ status_t HWComposer::prepare() {
// DO NOT reset the handle field to NULL, because it's possible
// that we have nothing to redraw (eg: eglSwapBuffers() not called)
// in which case, we should continue to use the same buffer.
+ LOG_FATAL_IF(disp.list == NULL);
disp.framebufferTarget->compositionType = HWC_FRAMEBUFFER_TARGET;
}
+ if (!disp.connected && disp.list != NULL) {
+ ALOGW("WARNING: disp %d: connected, non-null list, layers=%d",
+ i, disp.list->numHwLayers);
+ }
mLists[i] = disp.list;
if (mLists[i]) {
if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_2)) {
@@ -664,6 +669,17 @@ status_t HWComposer::acquire(int disp) const {
return NO_ERROR;
}
+void HWComposer::disconnectDisplay(int disp) {
+ LOG_ALWAYS_FATAL_IF(disp < 0 || disp == HWC_DISPLAY_PRIMARY ||
+ disp >= HWC_NUM_DISPLAY_TYPES);
+ DisplayData& dd(mDisplayData[disp]);
+ if (dd.list != NULL) {
+ free(dd.list);
+ dd.list = NULL;
+ dd.framebufferTarget = NULL; // points into dd.list
+ }
+}
+
int HWComposer::getVisualID() const {
if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) {
// FIXME: temporary hack until HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED