From 4961c959aebac31991fd7653853d47dfd79d3472 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 6 Oct 2009 19:00:57 -0700 Subject: fix [2152536] ANR in browser A window is created and the browser is about to render into it the very first time, at that point it does an IPC to SF to request a new buffer. Meanwhile, the window manager removes that window from the list and the shared memory block it uses is marked as invalid. However, at that point, another window is created and is given the same index (that just go freed), but a different identity and resets the "invalid" bit in the shared block. When we go back to the buffer allocation code, we're stuck because the surface we're allocating for is gone and we don't detect it's invalid because the invalid bit has been reset. It is not sufficient to check for the invalid bit, I should also check that identities match. --- libs/surfaceflinger/Layer.cpp | 4 ++-- libs/surfaceflinger/Layer.h | 2 +- libs/surfaceflinger/LayerBlur.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libs/surfaceflinger') diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index eb0614f..0258cee 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -133,7 +133,7 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h, void Layer::reloadTexture(const Region& dirty) { Mutex::Autolock _l(mLock); - sp buffer(getFrontBuffer()); + sp buffer(getFrontBufferLocked()); if (LIKELY((mFlags & DisplayHardware::DIRECT_TEXTURE) && (buffer->usage & GRALLOC_USAGE_HW_TEXTURE))) { int index = mFrontBufferIndex; @@ -194,7 +194,7 @@ void Layer::reloadTexture(const Region& dirty) } } } else { - for (int i=0 ; i getFrontBuffer() { + inline sp getFrontBufferLocked() { return mBuffers[mFrontBufferIndex]; } diff --git a/libs/surfaceflinger/LayerBlur.cpp b/libs/surfaceflinger/LayerBlur.cpp index 0ef663f..744f2e9 100644 --- a/libs/surfaceflinger/LayerBlur.cpp +++ b/libs/surfaceflinger/LayerBlur.cpp @@ -189,8 +189,8 @@ void LayerBlur::onDraw(const Region& clip) const } else { GLuint tw = 1 << (31 - clz(w)); GLuint th = 1 << (31 - clz(h)); - if (tw < w) tw <<= 1; - if (th < h) th <<= 1; + if (tw < GLuint(w)) tw <<= 1; + if (th < GLuint(h)) th <<= 1; glTexImage2D(GL_TEXTURE_2D, 0, mReadFormat, tw, th, 0, mReadFormat, mReadType, NULL); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, -- cgit v1.1