Merge change I0c4cec7e into eclair
* changes: Attempt to fix [2152536] ANR in browser
This commit is contained in:
@@ -142,6 +142,7 @@ public:
|
||||
SharedBufferBase(SharedClient* sharedClient, int surface, int num);
|
||||
~SharedBufferBase();
|
||||
uint32_t getIdentity();
|
||||
status_t getStatus() const;
|
||||
size_t getFrontBuffer() const;
|
||||
String8 dump(char const* prefix) const;
|
||||
|
||||
@@ -177,7 +178,7 @@ status_t SharedBufferBase::waitForCondition(T condition)
|
||||
{
|
||||
const SharedBufferStack& stack( *mSharedStack );
|
||||
SharedClient& client( *mSharedClient );
|
||||
const nsecs_t TIMEOUT = s2ns(1);
|
||||
const nsecs_t TIMEOUT = s2ns(1);
|
||||
Mutex::Autolock _l(client.lock);
|
||||
while ((condition()==false) && (stack.status == NO_ERROR)) {
|
||||
status_t err = client.cv.waitRelative(client.lock, TIMEOUT);
|
||||
@@ -187,14 +188,15 @@ status_t SharedBufferBase::waitForCondition(T condition)
|
||||
if (err == TIMED_OUT) {
|
||||
if (condition()) {
|
||||
LOGE("waitForCondition(%s) timed out (identity=%d), "
|
||||
"but condition is true! We recovered but it "
|
||||
"shouldn't happen." ,
|
||||
T::name(), mSharedStack->identity);
|
||||
"but condition is true! We recovered but it "
|
||||
"shouldn't happen." , T::name(),
|
||||
mSharedStack->identity);
|
||||
break;
|
||||
} else {
|
||||
LOGW("waitForCondition(%s) timed out (identity=%d). "
|
||||
"CPU may be pegged. trying again.",
|
||||
T::name(), mSharedStack->identity);
|
||||
LOGW("waitForCondition(%s) timed out "
|
||||
"(identity=%d, status=%d). "
|
||||
"CPU may be pegged. trying again.", T::name(),
|
||||
mSharedStack->identity, mSharedStack->status);
|
||||
}
|
||||
} else {
|
||||
LOGE("waitForCondition(%s) error (%s) ",
|
||||
|
||||
@@ -20,17 +20,12 @@
|
||||
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/Log.h>
|
||||
#include <binder/MemoryBase.h>
|
||||
#include <binder/IMemory.h>
|
||||
|
||||
#include <ui/PixelFormat.h>
|
||||
#include <ui/Surface.h>
|
||||
#include <pixelflinger/pixelflinger.h>
|
||||
|
||||
#include "Buffer.h"
|
||||
#include "BufferAllocator.h"
|
||||
#include "SurfaceFlinger.h"
|
||||
|
||||
|
||||
namespace android {
|
||||
|
||||
|
||||
@@ -20,20 +20,11 @@
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <hardware/gralloc.h>
|
||||
|
||||
#include <utils/Atomic.h>
|
||||
|
||||
#include <ui/PixelFormat.h>
|
||||
#include <ui/Rect.h>
|
||||
#include <ui/Surface.h>
|
||||
|
||||
#include <pixelflinger/pixelflinger.h>
|
||||
|
||||
#include <private/ui/SharedBufferStack.h>
|
||||
#include <private/ui/SurfaceBuffer.h>
|
||||
|
||||
class copybit_image_t;
|
||||
struct android_native_buffer_t;
|
||||
|
||||
namespace android {
|
||||
@@ -42,8 +33,6 @@ namespace android {
|
||||
// Buffer
|
||||
// ===========================================================================
|
||||
|
||||
class NativeBuffer;
|
||||
|
||||
class Buffer : public SurfaceBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <cutils/ashmem.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <utils/Singleton.h>
|
||||
|
||||
@@ -65,14 +65,6 @@ Layer::~Layer()
|
||||
// the actual buffers will be destroyed here
|
||||
}
|
||||
|
||||
// called with SurfaceFlinger::mStateLock as soon as the layer is entered
|
||||
// in the purgatory list
|
||||
void Layer::onRemoved()
|
||||
{
|
||||
// wake up the condition
|
||||
lcblk->setStatus(NO_INIT);
|
||||
}
|
||||
|
||||
void Layer::destroy()
|
||||
{
|
||||
for (size_t i=0 ; i<NUM_BUFFERS ; i++) {
|
||||
|
||||
@@ -85,8 +85,6 @@ private:
|
||||
return mBuffers[mFrontBufferIndex];
|
||||
}
|
||||
|
||||
virtual void onRemoved();
|
||||
|
||||
void reloadTexture(const Region& dirty);
|
||||
|
||||
sp<SurfaceBuffer> requestBuffer(int index, int usage);
|
||||
|
||||
@@ -690,6 +690,14 @@ sp<LayerBaseClient::Surface> LayerBaseClient::createSurface() const
|
||||
const_cast<LayerBaseClient *>(this));
|
||||
}
|
||||
|
||||
// called with SurfaceFlinger::mStateLock as soon as the layer is entered
|
||||
// in the purgatory list
|
||||
void LayerBaseClient::onRemoved()
|
||||
{
|
||||
// wake up the condition
|
||||
lcblk->setStatus(NO_INIT);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
LayerBaseClient::Surface::Surface(
|
||||
@@ -700,7 +708,6 @@ LayerBaseClient::Surface::Surface(
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LayerBaseClient::Surface::~Surface()
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -205,10 +205,13 @@ public:
|
||||
*/
|
||||
virtual bool isSecure() const { return false; }
|
||||
|
||||
/** signal this layer that it's not needed any longer. called from the
|
||||
* main thread */
|
||||
/** Called from the main thread, when the surface is removed from the
|
||||
* draw list */
|
||||
virtual status_t ditch() { return NO_ERROR; }
|
||||
|
||||
/** called with the state lock when the surface is removed from the
|
||||
* current list */
|
||||
virtual void onRemoved() { };
|
||||
|
||||
|
||||
enum { // flags for doTransaction()
|
||||
@@ -318,7 +321,7 @@ public:
|
||||
sp<Surface> getSurface();
|
||||
virtual sp<Surface> createSurface() const;
|
||||
|
||||
virtual void onRemoved() { }
|
||||
virtual void onRemoved();
|
||||
|
||||
class Surface : public BnSurface
|
||||
{
|
||||
|
||||
@@ -1073,6 +1073,8 @@ status_t SurfaceFlinger::purgatorizeLayer_l(const sp<LayerBase>& layerBase)
|
||||
// remove the layer from the main list (through a transaction).
|
||||
ssize_t err = removeLayer_l(layerBase);
|
||||
|
||||
layerBase->onRemoved();
|
||||
|
||||
// it's possible that we don't find a layer, because it might
|
||||
// have been destroyed already -- this is not technically an error
|
||||
// from the user because there is a race between BClient::destroySurface(),
|
||||
@@ -1321,7 +1323,6 @@ status_t SurfaceFlinger::removeSurface(SurfaceID index)
|
||||
if (layer != 0) {
|
||||
err = purgatorizeLayer_l(layer);
|
||||
if (err == NO_ERROR) {
|
||||
layer->onRemoved();
|
||||
setTransactionFlags(eTransactionNeeded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,12 @@ uint32_t SharedBufferBase::getIdentity()
|
||||
return stack.identity;
|
||||
}
|
||||
|
||||
status_t SharedBufferBase::getStatus() const
|
||||
{
|
||||
SharedBufferStack& stack( *mSharedStack );
|
||||
return stack.status;
|
||||
}
|
||||
|
||||
size_t SharedBufferBase::getFrontBuffer() const
|
||||
{
|
||||
SharedBufferStack& stack( *mSharedStack );
|
||||
@@ -135,7 +141,6 @@ String8 SharedBufferBase::dump(char const* prefix) const
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// conditions and updates
|
||||
// ============================================================================
|
||||
@@ -375,8 +380,10 @@ status_t SharedBufferServer::unlock(int buffer)
|
||||
|
||||
void SharedBufferServer::setStatus(status_t status)
|
||||
{
|
||||
StatusUpdate update(this, status);
|
||||
updateCondition( update );
|
||||
if (status < NO_ERROR) {
|
||||
StatusUpdate update(this, status);
|
||||
updateCondition( update );
|
||||
}
|
||||
}
|
||||
|
||||
status_t SharedBufferServer::reallocate()
|
||||
|
||||
@@ -733,9 +733,11 @@ status_t Surface::getBufferLocked(int index, int usage)
|
||||
index, usage);
|
||||
if (buffer != 0) { // this should never happen by construction
|
||||
LOGE_IF(buffer->handle == NULL,
|
||||
"requestBuffer(%d, %08x) returned a buffer with a null handle",
|
||||
index, usage);
|
||||
if (buffer->handle != NULL) {
|
||||
"Surface (identity=%d) requestBuffer(%d, %08x) returned"
|
||||
"a buffer with a null handle", mIdentity, index, usage);
|
||||
err = mSharedBufferClient->getStatus();
|
||||
LOGE_IF(err, "Surface (identity=%d) state = %d", mIdentity, err);
|
||||
if (!err && buffer->handle != NULL) {
|
||||
err = getBufferMapper().registerBuffer(buffer->handle);
|
||||
LOGW_IF(err, "registerBuffer(...) failed %d (%s)",
|
||||
err, strerror(-err));
|
||||
|
||||
Reference in New Issue
Block a user