am 26fe45dc: Merge change I4961c959 into eclair
Merge commit '26fe45dcb3df12eda94d93f1473cd6a2f5f345c7' into eclair-mr2 * commit '26fe45dcb3df12eda94d93f1473cd6a2f5f345c7': fix [2152536] ANR in browser
This commit is contained in:
@@ -139,7 +139,8 @@ private:
|
|||||||
class SharedBufferBase
|
class SharedBufferBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SharedBufferBase(SharedClient* sharedClient, int surface, int num);
|
SharedBufferBase(SharedClient* sharedClient, int surface, int num,
|
||||||
|
int32_t identity);
|
||||||
~SharedBufferBase();
|
~SharedBufferBase();
|
||||||
uint32_t getIdentity();
|
uint32_t getIdentity();
|
||||||
status_t getStatus() const;
|
status_t getStatus() const;
|
||||||
@@ -150,6 +151,7 @@ protected:
|
|||||||
SharedClient* const mSharedClient;
|
SharedClient* const mSharedClient;
|
||||||
SharedBufferStack* const mSharedStack;
|
SharedBufferStack* const mSharedStack;
|
||||||
const int mNumBuffers;
|
const int mNumBuffers;
|
||||||
|
const int mIdentity;
|
||||||
|
|
||||||
friend struct Update;
|
friend struct Update;
|
||||||
friend struct QueueUpdate;
|
friend struct QueueUpdate;
|
||||||
@@ -180,7 +182,10 @@ status_t SharedBufferBase::waitForCondition(T condition)
|
|||||||
SharedClient& client( *mSharedClient );
|
SharedClient& client( *mSharedClient );
|
||||||
const nsecs_t TIMEOUT = s2ns(1);
|
const nsecs_t TIMEOUT = s2ns(1);
|
||||||
Mutex::Autolock _l(client.lock);
|
Mutex::Autolock _l(client.lock);
|
||||||
while ((condition()==false) && (stack.status == NO_ERROR)) {
|
while ((condition()==false) &&
|
||||||
|
(stack.identity == mIdentity) &&
|
||||||
|
(stack.status == NO_ERROR))
|
||||||
|
{
|
||||||
status_t err = client.cv.waitRelative(client.lock, TIMEOUT);
|
status_t err = client.cv.waitRelative(client.lock, TIMEOUT);
|
||||||
|
|
||||||
// handle errors and timeouts
|
// handle errors and timeouts
|
||||||
@@ -190,13 +195,13 @@ status_t SharedBufferBase::waitForCondition(T condition)
|
|||||||
LOGE("waitForCondition(%s) timed out (identity=%d), "
|
LOGE("waitForCondition(%s) timed out (identity=%d), "
|
||||||
"but condition is true! We recovered but it "
|
"but condition is true! We recovered but it "
|
||||||
"shouldn't happen." , T::name(),
|
"shouldn't happen." , T::name(),
|
||||||
mSharedStack->identity);
|
stack.identity);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
LOGW("waitForCondition(%s) timed out "
|
LOGW("waitForCondition(%s) timed out "
|
||||||
"(identity=%d, status=%d). "
|
"(identity=%d, status=%d). "
|
||||||
"CPU may be pegged. trying again.", T::name(),
|
"CPU may be pegged. trying again.", T::name(),
|
||||||
mSharedStack->identity, mSharedStack->status);
|
stack.identity, stack.status);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGE("waitForCondition(%s) error (%s) ",
|
LOGE("waitForCondition(%s) error (%s) ",
|
||||||
@@ -205,7 +210,7 @@ status_t SharedBufferBase::waitForCondition(T condition)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stack.status;
|
return (stack.identity != mIdentity) ? status_t(BAD_INDEX) : stack.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -223,8 +228,9 @@ status_t SharedBufferBase::updateCondition(T update) {
|
|||||||
class SharedBufferClient : public SharedBufferBase
|
class SharedBufferClient : public SharedBufferBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SharedBufferClient(SharedClient* sharedClient, int surface, int num);
|
SharedBufferClient(SharedClient* sharedClient, int surface, int num,
|
||||||
|
int32_t identity);
|
||||||
|
|
||||||
ssize_t dequeue();
|
ssize_t dequeue();
|
||||||
status_t undoDequeue(int buf);
|
status_t undoDequeue(int buf);
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h,
|
|||||||
void Layer::reloadTexture(const Region& dirty)
|
void Layer::reloadTexture(const Region& dirty)
|
||||||
{
|
{
|
||||||
Mutex::Autolock _l(mLock);
|
Mutex::Autolock _l(mLock);
|
||||||
sp<GraphicBuffer> buffer(getFrontBuffer());
|
sp<GraphicBuffer> buffer(getFrontBufferLocked());
|
||||||
if (LIKELY((mFlags & DisplayHardware::DIRECT_TEXTURE) &&
|
if (LIKELY((mFlags & DisplayHardware::DIRECT_TEXTURE) &&
|
||||||
(buffer->usage & GRALLOC_USAGE_HW_TEXTURE))) {
|
(buffer->usage & GRALLOC_USAGE_HW_TEXTURE))) {
|
||||||
int index = mFrontBufferIndex;
|
int index = mFrontBufferIndex;
|
||||||
@@ -194,7 +194,7 @@ void Layer::reloadTexture(const Region& dirty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i=0 ; i<NUM_BUFFERS ; i++)
|
for (size_t i=0 ; i<NUM_BUFFERS ; i++)
|
||||||
mTextures[i].image = EGL_NO_IMAGE_KHR;
|
mTextures[i].image = EGL_NO_IMAGE_KHR;
|
||||||
|
|
||||||
GGLSurface t;
|
GGLSurface t;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
inline PixelFormat pixelFormat() const { return mFormat; }
|
inline PixelFormat pixelFormat() const { return mFormat; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline sp<GraphicBuffer> getFrontBuffer() {
|
inline sp<GraphicBuffer> getFrontBufferLocked() {
|
||||||
return mBuffers[mFrontBufferIndex];
|
return mBuffers[mFrontBufferIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ void LayerBlur::onDraw(const Region& clip) const
|
|||||||
} else {
|
} else {
|
||||||
GLuint tw = 1 << (31 - clz(w));
|
GLuint tw = 1 << (31 - clz(w));
|
||||||
GLuint th = 1 << (31 - clz(h));
|
GLuint th = 1 << (31 - clz(h));
|
||||||
if (tw < w) tw <<= 1;
|
if (tw < GLuint(w)) tw <<= 1;
|
||||||
if (th < h) th <<= 1;
|
if (th < GLuint(h)) th <<= 1;
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, mReadFormat, tw, th, 0,
|
glTexImage2D(GL_TEXTURE_2D, 0, mReadFormat, tw, th, 0,
|
||||||
mReadFormat, mReadType, NULL);
|
mReadFormat, mReadType, NULL);
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h,
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h,
|
||||||
|
|||||||
@@ -97,10 +97,10 @@ Region SharedBufferStack::getDirtyRegion(int buffer) const
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
SharedBufferBase::SharedBufferBase(SharedClient* sharedClient,
|
SharedBufferBase::SharedBufferBase(SharedClient* sharedClient,
|
||||||
int surface, int num)
|
int surface, int num, int32_t identity)
|
||||||
: mSharedClient(sharedClient),
|
: mSharedClient(sharedClient),
|
||||||
mSharedStack(sharedClient->surfaces + surface),
|
mSharedStack(sharedClient->surfaces + surface),
|
||||||
mNumBuffers(num)
|
mNumBuffers(num), mIdentity(identity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,8 +248,8 @@ ssize_t SharedBufferServer::StatusUpdate::operator()() {
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
SharedBufferClient::SharedBufferClient(SharedClient* sharedClient,
|
SharedBufferClient::SharedBufferClient(SharedClient* sharedClient,
|
||||||
int surface, int num)
|
int surface, int num, int32_t identity)
|
||||||
: SharedBufferBase(sharedClient, surface, num), tail(0)
|
: SharedBufferBase(sharedClient, surface, num, identity), tail(0)
|
||||||
{
|
{
|
||||||
tail = computeTail();
|
tail = computeTail();
|
||||||
}
|
}
|
||||||
@@ -353,7 +353,7 @@ status_t SharedBufferClient::setDirtyRegion(int buffer, const Region& reg)
|
|||||||
|
|
||||||
SharedBufferServer::SharedBufferServer(SharedClient* sharedClient,
|
SharedBufferServer::SharedBufferServer(SharedClient* sharedClient,
|
||||||
int surface, int num, int32_t identity)
|
int surface, int num, int32_t identity)
|
||||||
: SharedBufferBase(sharedClient, surface, num)
|
: SharedBufferBase(sharedClient, surface, num, identity)
|
||||||
{
|
{
|
||||||
mSharedStack->init(identity);
|
mSharedStack->init(identity);
|
||||||
mSharedStack->head = num-1;
|
mSharedStack->head = num-1;
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ Surface::Surface(const sp<SurfaceControl>& surface)
|
|||||||
mWidth(surface->mWidth), mHeight(surface->mHeight)
|
mWidth(surface->mWidth), mHeight(surface->mHeight)
|
||||||
{
|
{
|
||||||
mSharedBufferClient = new SharedBufferClient(
|
mSharedBufferClient = new SharedBufferClient(
|
||||||
mClient->mControl, mToken, 2);
|
mClient->mControl, mToken, 2, mIdentity);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -336,7 +336,7 @@ Surface::Surface(const Parcel& parcel)
|
|||||||
mClient = SurfaceComposerClient::clientForConnection(clientBinder);
|
mClient = SurfaceComposerClient::clientForConnection(clientBinder);
|
||||||
|
|
||||||
mSharedBufferClient = new SharedBufferClient(
|
mSharedBufferClient = new SharedBufferClient(
|
||||||
mClient->mControl, mToken, 2);
|
mClient->mControl, mToken, 2, mIdentity);
|
||||||
}
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|||||||
Reference in New Issue
Block a user