am 9bce8737: more surfaceflinger cleanups
This commit is contained in:
commit
2ee3ec24c3
@ -47,11 +47,6 @@ template <typename T> inline T min(T a, T b) {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const uint32_t Layer::typeInfo = LayerBaseClient::typeInfo | 4;
|
|
||||||
const char* const Layer::typeID = "Layer";
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Layer::Layer(SurfaceFlinger* flinger, DisplayID display,
|
Layer::Layer(SurfaceFlinger* flinger, DisplayID display,
|
||||||
const sp<Client>& c, int32_t i)
|
const sp<Client>& c, int32_t i)
|
||||||
: LayerBaseClient(flinger, display, c, i),
|
: LayerBaseClient(flinger, display, c, i),
|
||||||
@ -572,7 +567,7 @@ void Layer::unlockPageFlip(
|
|||||||
}
|
}
|
||||||
if (visibleRegionScreen.isEmpty()) {
|
if (visibleRegionScreen.isEmpty()) {
|
||||||
// an invisible layer should not hold a freeze-lock
|
// an invisible layer should not hold a freeze-lock
|
||||||
// (because it may never be updated and thereore never release it)
|
// (because it may never be updated and therefore never release it)
|
||||||
mFreezeLock.clear();
|
mFreezeLock.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,6 +580,38 @@ void Layer::finishPageFlip()
|
|||||||
this, mFrontBufferIndex);
|
this, mFrontBufferIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Layer::dump(String8& result, char* buffer, size_t SIZE) const
|
||||||
|
{
|
||||||
|
LayerBaseClient::dump(result, buffer, SIZE);
|
||||||
|
|
||||||
|
SharedBufferStack::Statistics stats = lcblk->getStats();
|
||||||
|
result.append( lcblk->dump(" ") );
|
||||||
|
sp<const GraphicBuffer> buf0(getBuffer(0));
|
||||||
|
sp<const GraphicBuffer> buf1(getBuffer(1));
|
||||||
|
uint32_t w0=0, h0=0, s0=0;
|
||||||
|
uint32_t w1=0, h1=0, s1=0;
|
||||||
|
if (buf0 != 0) {
|
||||||
|
w0 = buf0->getWidth();
|
||||||
|
h0 = buf0->getHeight();
|
||||||
|
s0 = buf0->getStride();
|
||||||
|
}
|
||||||
|
if (buf1 != 0) {
|
||||||
|
w1 = buf1->getWidth();
|
||||||
|
h1 = buf1->getHeight();
|
||||||
|
s1 = buf1->getStride();
|
||||||
|
}
|
||||||
|
snprintf(buffer, SIZE,
|
||||||
|
" "
|
||||||
|
"format=%2d, [%3ux%3u:%3u] [%3ux%3u:%3u],"
|
||||||
|
" freezeLock=%p, dq-q-time=%u us\n",
|
||||||
|
pixelFormat(),
|
||||||
|
w0, h0, s0, w1, h1, s1,
|
||||||
|
getFreezeLock().get(), stats.totalTime);
|
||||||
|
|
||||||
|
result.append(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
Layer::SurfaceLayer::SurfaceLayer(const sp<SurfaceFlinger>& flinger,
|
Layer::SurfaceLayer::SurfaceLayer(const sp<SurfaceFlinger>& flinger,
|
||||||
|
@ -46,11 +46,6 @@ const size_t NUM_BUFFERS = 2;
|
|||||||
class Layer : public LayerBaseClient
|
class Layer : public LayerBaseClient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const uint32_t typeInfo;
|
|
||||||
static const char* const typeID;
|
|
||||||
virtual char const* getTypeID() const { return typeID; }
|
|
||||||
virtual uint32_t getTypeInfo() const { return typeInfo; }
|
|
||||||
|
|
||||||
Layer(SurfaceFlinger* flinger, DisplayID display,
|
Layer(SurfaceFlinger* flinger, DisplayID display,
|
||||||
const sp<Client>& client, int32_t i);
|
const sp<Client>& client, int32_t i);
|
||||||
|
|
||||||
@ -73,7 +68,7 @@ public:
|
|||||||
virtual status_t ditch();
|
virtual status_t ditch();
|
||||||
|
|
||||||
// only for debugging
|
// only for debugging
|
||||||
inline sp<GraphicBuffer> getBuffer(int i) { return mBuffers[i]; }
|
inline sp<GraphicBuffer> getBuffer(int i) const { return mBuffers[i]; }
|
||||||
// only for debugging
|
// only for debugging
|
||||||
inline const sp<FreezeLock>& getFreezeLock() const { return mFreezeLock; }
|
inline const sp<FreezeLock>& getFreezeLock() const { return mFreezeLock; }
|
||||||
// only for debugging
|
// only for debugging
|
||||||
@ -81,6 +76,11 @@ public:
|
|||||||
// only for debugging
|
// only for debugging
|
||||||
inline int getFrontBufferIndex() const { return mFrontBufferIndex; }
|
inline int getFrontBufferIndex() const { return mFrontBufferIndex; }
|
||||||
|
|
||||||
|
virtual const char* getTypeId() const { return "Layer"; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void dump(String8& result, char* scratch, size_t size) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline sp<GraphicBuffer> getFrontBufferLocked() {
|
inline sp<GraphicBuffer> getFrontBufferLocked() {
|
||||||
return mBuffers[mFrontBufferIndex];
|
return mBuffers[mFrontBufferIndex];
|
||||||
|
@ -38,14 +38,6 @@ namespace android {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const uint32_t LayerBase::typeInfo = 1;
|
|
||||||
const char* const LayerBase::typeID = "LayerBase";
|
|
||||||
|
|
||||||
const uint32_t LayerBaseClient::typeInfo = LayerBase::typeInfo | 2;
|
|
||||||
const char* const LayerBaseClient::typeID = "LayerBaseClient";
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
LayerBase::LayerBase(SurfaceFlinger* flinger, DisplayID display)
|
LayerBase::LayerBase(SurfaceFlinger* flinger, DisplayID display)
|
||||||
: dpy(display), contentDirty(false),
|
: dpy(display), contentDirty(false),
|
||||||
mFlinger(flinger),
|
mFlinger(flinger),
|
||||||
@ -681,6 +673,22 @@ status_t LayerBase::initializeEglImage(
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LayerBase::dump(String8& result, char* buffer, size_t SIZE) const
|
||||||
|
{
|
||||||
|
const Layer::State& s(drawingState());
|
||||||
|
snprintf(buffer, SIZE,
|
||||||
|
"+ %s %p\n"
|
||||||
|
" "
|
||||||
|
"z=%9d, pos=(%4d,%4d), size=(%4d,%4d), "
|
||||||
|
"needsBlending=%1d, needsDithering=%1d, invalidate=%1d, "
|
||||||
|
"alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n",
|
||||||
|
getTypeId(), this, s.z, tx(), ty(), s.w, s.h,
|
||||||
|
needsBlending(), needsDithering(), contentDirty,
|
||||||
|
s.alpha, s.flags,
|
||||||
|
s.transform[0][0], s.transform[0][1],
|
||||||
|
s.transform[1][0], s.transform[1][1]);
|
||||||
|
result.append(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -713,13 +721,13 @@ LayerBaseClient::~LayerBaseClient()
|
|||||||
delete lcblk;
|
delete lcblk;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t LayerBaseClient::serverIndex() const
|
ssize_t LayerBaseClient::serverIndex() const
|
||||||
{
|
{
|
||||||
sp<Client> client(this->client.promote());
|
sp<Client> client(this->client.promote());
|
||||||
if (client != 0) {
|
if (client != 0) {
|
||||||
return (client->cid<<16)|mIndex;
|
return (client->cid<<16)|mIndex;
|
||||||
}
|
}
|
||||||
return 0xFFFF0000 | mIndex;
|
return ssize_t(0xFFFF0000 | mIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
sp<LayerBaseClient::Surface> LayerBaseClient::getSurface()
|
sp<LayerBaseClient::Surface> LayerBaseClient::getSurface()
|
||||||
@ -748,6 +756,21 @@ void LayerBaseClient::onRemoved()
|
|||||||
lcblk->setStatus(NO_INIT);
|
lcblk->setStatus(NO_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LayerBaseClient::dump(String8& result, char* buffer, size_t SIZE) const
|
||||||
|
{
|
||||||
|
LayerBase::dump(result, buffer, SIZE);
|
||||||
|
|
||||||
|
sp<Client> client(this->client.promote());
|
||||||
|
snprintf(buffer, SIZE,
|
||||||
|
" name=%s\n"
|
||||||
|
" id=0x%08x, client=0x%08x, identity=%u\n",
|
||||||
|
getName().string(),
|
||||||
|
clientIndex(), client.get() ? client->cid : 0,
|
||||||
|
getIdentity());
|
||||||
|
|
||||||
|
result.append(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
LayerBaseClient::Surface::Surface(
|
LayerBaseClient::Surface::Surface(
|
||||||
|
@ -51,35 +51,9 @@ class SurfaceFlinger;
|
|||||||
|
|
||||||
class LayerBase : public RefBase
|
class LayerBase : public RefBase
|
||||||
{
|
{
|
||||||
// poor man's dynamic_cast below
|
|
||||||
template<typename T>
|
|
||||||
struct getTypeInfoOfAnyType {
|
|
||||||
static uint32_t get() { return T::typeInfo; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct getTypeInfoOfAnyType<T*> {
|
|
||||||
static uint32_t get() { return getTypeInfoOfAnyType<T>::get(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const uint32_t typeInfo;
|
LayerBase(SurfaceFlinger* flinger, DisplayID display);
|
||||||
static const char* const typeID;
|
|
||||||
virtual char const* getTypeID() const { return typeID; }
|
|
||||||
virtual uint32_t getTypeInfo() const { return typeInfo; }
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
static T dynamicCast(LayerBase* base) {
|
|
||||||
uint32_t mostDerivedInfo = base->getTypeInfo();
|
|
||||||
uint32_t castToInfo = getTypeInfoOfAnyType<T>::get();
|
|
||||||
if ((mostDerivedInfo & castToInfo) == castToInfo)
|
|
||||||
return static_cast<T>(base);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LayerBase(SurfaceFlinger* flinger, DisplayID display);
|
|
||||||
|
|
||||||
DisplayID dpy;
|
DisplayID dpy;
|
||||||
mutable bool contentDirty;
|
mutable bool contentDirty;
|
||||||
Region visibleRegionScreen;
|
Region visibleRegionScreen;
|
||||||
@ -125,6 +99,9 @@ public:
|
|||||||
|
|
||||||
void invalidate();
|
void invalidate();
|
||||||
|
|
||||||
|
virtual const char* getTypeId() const { return "LayerBase"; }
|
||||||
|
virtual ssize_t serverIndex() const { return -1; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* draw - performs some global clipping optimizations
|
* draw - performs some global clipping optimizations
|
||||||
* and calls onDraw().
|
* and calls onDraw().
|
||||||
@ -217,7 +194,10 @@ public:
|
|||||||
* current list */
|
* current list */
|
||||||
virtual void onRemoved() { };
|
virtual void onRemoved() { };
|
||||||
|
|
||||||
|
/** always call base class first */
|
||||||
|
virtual void dump(String8& result, char* scratch, size_t size) const;
|
||||||
|
|
||||||
|
|
||||||
enum { // flags for doTransaction()
|
enum { // flags for doTransaction()
|
||||||
eVisibleRegion = 0x00000002,
|
eVisibleRegion = 0x00000002,
|
||||||
};
|
};
|
||||||
@ -313,10 +293,6 @@ class LayerBaseClient : public LayerBase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class Surface;
|
class Surface;
|
||||||
static const uint32_t typeInfo;
|
|
||||||
static const char* const typeID;
|
|
||||||
virtual char const* getTypeID() const { return typeID; }
|
|
||||||
virtual uint32_t getTypeInfo() const { return typeInfo; }
|
|
||||||
|
|
||||||
// lcblk is (almost) only accessed from the main SF thread, in the places
|
// lcblk is (almost) only accessed from the main SF thread, in the places
|
||||||
// where it's not, a reference to Client must be held
|
// where it's not, a reference to Client must be held
|
||||||
@ -331,14 +307,12 @@ public:
|
|||||||
|
|
||||||
inline uint32_t getIdentity() const { return mIdentity; }
|
inline uint32_t getIdentity() const { return mIdentity; }
|
||||||
inline int32_t clientIndex() const { return mIndex; }
|
inline int32_t clientIndex() const { return mIndex; }
|
||||||
int32_t serverIndex() const;
|
|
||||||
|
|
||||||
|
|
||||||
sp<Surface> getSurface();
|
sp<Surface> getSurface();
|
||||||
virtual sp<Surface> createSurface() const;
|
virtual sp<Surface> createSurface() const;
|
||||||
|
virtual ssize_t serverIndex() const;
|
||||||
virtual void onRemoved();
|
virtual void onRemoved();
|
||||||
|
virtual const char* getTypeId() const { return "LayerBaseClient"; }
|
||||||
|
|
||||||
class Surface : public BnSurface
|
class Surface : public BnSurface
|
||||||
{
|
{
|
||||||
@ -373,8 +347,11 @@ public:
|
|||||||
|
|
||||||
friend class Surface;
|
friend class Surface;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void dump(String8& result, char* scratch, size_t size) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32_t mIndex;
|
int32_t mIndex;
|
||||||
mutable Mutex mLock;
|
mutable Mutex mLock;
|
||||||
mutable wp<Surface> mClientSurface;
|
mutable wp<Surface> mClientSurface;
|
||||||
// only read
|
// only read
|
||||||
|
@ -33,11 +33,6 @@
|
|||||||
namespace android {
|
namespace android {
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const uint32_t LayerBlur::typeInfo = LayerBaseClient::typeInfo | 8;
|
|
||||||
const char* const LayerBlur::typeID = "LayerBlur";
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
LayerBlur::LayerBlur(SurfaceFlinger* flinger, DisplayID display,
|
LayerBlur::LayerBlur(SurfaceFlinger* flinger, DisplayID display,
|
||||||
const sp<Client>& client, int32_t i)
|
const sp<Client>& client, int32_t i)
|
||||||
: LayerBaseClient(flinger, display, client, i), mCacheDirty(true),
|
: LayerBaseClient(flinger, display, client, i), mCacheDirty(true),
|
||||||
|
@ -31,11 +31,6 @@ namespace android {
|
|||||||
class LayerBlur : public LayerBaseClient
|
class LayerBlur : public LayerBaseClient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const uint32_t typeInfo;
|
|
||||||
static const char* const typeID;
|
|
||||||
virtual char const* getTypeID() const { return typeID; }
|
|
||||||
virtual uint32_t getTypeInfo() const { return typeInfo; }
|
|
||||||
|
|
||||||
LayerBlur(SurfaceFlinger* flinger, DisplayID display,
|
LayerBlur(SurfaceFlinger* flinger, DisplayID display,
|
||||||
const sp<Client>& client, int32_t i);
|
const sp<Client>& client, int32_t i);
|
||||||
virtual ~LayerBlur();
|
virtual ~LayerBlur();
|
||||||
@ -43,6 +38,7 @@ public:
|
|||||||
virtual void onDraw(const Region& clip) const;
|
virtual void onDraw(const Region& clip) const;
|
||||||
virtual bool needsBlending() const { return true; }
|
virtual bool needsBlending() const { return true; }
|
||||||
virtual bool isSecure() const { return false; }
|
virtual bool isSecure() const { return false; }
|
||||||
|
virtual const char* getTypeId() const { return "LayerBlur"; }
|
||||||
|
|
||||||
virtual uint32_t doTransaction(uint32_t flags);
|
virtual uint32_t doTransaction(uint32_t flags);
|
||||||
virtual void setVisibleRegion(const Region& visibleRegion);
|
virtual void setVisibleRegion(const Region& visibleRegion);
|
||||||
|
@ -39,8 +39,6 @@ namespace android {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const uint32_t LayerBuffer::typeInfo = LayerBaseClient::typeInfo | 0x20;
|
|
||||||
const char* const LayerBuffer::typeID = "LayerBuffer";
|
|
||||||
gralloc_module_t const* LayerBuffer::sGrallocModule = 0;
|
gralloc_module_t const* LayerBuffer::sGrallocModule = 0;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@ -52,17 +52,13 @@ class LayerBuffer : public LayerBaseClient
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const uint32_t typeInfo;
|
|
||||||
static const char* const typeID;
|
|
||||||
virtual char const* getTypeID() const { return typeID; }
|
|
||||||
virtual uint32_t getTypeInfo() const { return typeInfo; }
|
|
||||||
|
|
||||||
LayerBuffer(SurfaceFlinger* flinger, DisplayID display,
|
LayerBuffer(SurfaceFlinger* flinger, DisplayID display,
|
||||||
const sp<Client>& client, int32_t i);
|
const sp<Client>& client, int32_t i);
|
||||||
virtual ~LayerBuffer();
|
virtual ~LayerBuffer();
|
||||||
|
|
||||||
virtual void onFirstRef();
|
virtual void onFirstRef();
|
||||||
virtual bool needsBlending() const;
|
virtual bool needsBlending() const;
|
||||||
|
virtual const char* getTypeId() const { return "LayerBuffer"; }
|
||||||
|
|
||||||
virtual sp<LayerBaseClient::Surface> createSurface() const;
|
virtual sp<LayerBaseClient::Surface> createSurface() const;
|
||||||
virtual status_t ditch();
|
virtual status_t ditch();
|
||||||
|
@ -30,9 +30,6 @@
|
|||||||
namespace android {
|
namespace android {
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const uint32_t LayerDim::typeInfo = LayerBaseClient::typeInfo | 0x10;
|
|
||||||
const char* const LayerDim::typeID = "LayerDim";
|
|
||||||
|
|
||||||
bool LayerDim::sUseTexture;
|
bool LayerDim::sUseTexture;
|
||||||
GLuint LayerDim::sTexId;
|
GLuint LayerDim::sTexId;
|
||||||
EGLImageKHR LayerDim::sImage;
|
EGLImageKHR LayerDim::sImage;
|
||||||
|
@ -37,11 +37,6 @@ class LayerDim : public LayerBaseClient
|
|||||||
static int32_t sWidth;
|
static int32_t sWidth;
|
||||||
static int32_t sHeight;
|
static int32_t sHeight;
|
||||||
public:
|
public:
|
||||||
static const uint32_t typeInfo;
|
|
||||||
static const char* const typeID;
|
|
||||||
virtual char const* getTypeID() const { return typeID; }
|
|
||||||
virtual uint32_t getTypeInfo() const { return typeInfo; }
|
|
||||||
|
|
||||||
LayerDim(SurfaceFlinger* flinger, DisplayID display,
|
LayerDim(SurfaceFlinger* flinger, DisplayID display,
|
||||||
const sp<Client>& client, int32_t i);
|
const sp<Client>& client, int32_t i);
|
||||||
virtual ~LayerDim();
|
virtual ~LayerDim();
|
||||||
@ -49,6 +44,7 @@ public:
|
|||||||
virtual void onDraw(const Region& clip) const;
|
virtual void onDraw(const Region& clip) const;
|
||||||
virtual bool needsBlending() const { return true; }
|
virtual bool needsBlending() const { return true; }
|
||||||
virtual bool isSecure() const { return false; }
|
virtual bool isSecure() const { return false; }
|
||||||
|
virtual const char* getTypeId() const { return "LayerDim"; }
|
||||||
|
|
||||||
static void initDimmer(SurfaceFlinger* flinger, uint32_t w, uint32_t h);
|
static void initDimmer(SurfaceFlinger* flinger, uint32_t w, uint32_t h);
|
||||||
};
|
};
|
||||||
|
@ -1078,15 +1078,15 @@ status_t SurfaceFlinger::invalidateLayerVisibility(const sp<LayerBase>& layer)
|
|||||||
|
|
||||||
status_t SurfaceFlinger::addLayer_l(const sp<LayerBase>& layer)
|
status_t SurfaceFlinger::addLayer_l(const sp<LayerBase>& layer)
|
||||||
{
|
{
|
||||||
if (layer == 0)
|
|
||||||
return BAD_VALUE;
|
|
||||||
ssize_t i = mCurrentState.layersSortedByZ.add(
|
ssize_t i = mCurrentState.layersSortedByZ.add(
|
||||||
layer, &LayerBase::compareCurrentStateZ);
|
layer, &LayerBase::compareCurrentStateZ);
|
||||||
sp<LayerBaseClient> lbc = LayerBase::dynamicCast< LayerBaseClient* >(layer.get());
|
return (i < 0) ? status_t(i) : status_t(NO_ERROR);
|
||||||
if (lbc != 0) {
|
}
|
||||||
mLayerMap.add(lbc->serverIndex(), lbc);
|
|
||||||
}
|
status_t SurfaceFlinger::addClientLayer_l(const sp<LayerBaseClient>& lbc)
|
||||||
return NO_ERROR;
|
{
|
||||||
|
ssize_t serverIndex = lbc->serverIndex();
|
||||||
|
return mLayerMap.add(serverIndex, lbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t SurfaceFlinger::removeLayer_l(const sp<LayerBase>& layerBase)
|
status_t SurfaceFlinger::removeLayer_l(const sp<LayerBase>& layerBase)
|
||||||
@ -1094,10 +1094,9 @@ status_t SurfaceFlinger::removeLayer_l(const sp<LayerBase>& layerBase)
|
|||||||
ssize_t index = mCurrentState.layersSortedByZ.remove(layerBase);
|
ssize_t index = mCurrentState.layersSortedByZ.remove(layerBase);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
mLayersRemoved = true;
|
mLayersRemoved = true;
|
||||||
sp<LayerBaseClient> layer =
|
ssize_t serverIndex = layerBase->serverIndex();
|
||||||
LayerBase::dynamicCast< LayerBaseClient* >(layerBase.get());
|
if (serverIndex >= 0) {
|
||||||
if (layer != 0) {
|
mLayerMap.removeItem(serverIndex);
|
||||||
mLayerMap.removeItem(layer->serverIndex());
|
|
||||||
}
|
}
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
@ -1306,6 +1305,7 @@ sp<LayerBaseClient> SurfaceFlinger::createNormalSurfaceLocked(
|
|||||||
if (LIKELY(err == NO_ERROR)) {
|
if (LIKELY(err == NO_ERROR)) {
|
||||||
layer->initStates(w, h, flags);
|
layer->initStates(w, h, flags);
|
||||||
addLayer_l(layer);
|
addLayer_l(layer);
|
||||||
|
addClientLayer_l(layer);
|
||||||
} else {
|
} else {
|
||||||
LOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err));
|
LOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err));
|
||||||
layer.clear();
|
layer.clear();
|
||||||
@ -1320,6 +1320,7 @@ sp<LayerBaseClient> SurfaceFlinger::createBlurSurfaceLocked(
|
|||||||
sp<LayerBlur> layer = new LayerBlur(this, display, client, id);
|
sp<LayerBlur> layer = new LayerBlur(this, display, client, id);
|
||||||
layer->initStates(w, h, flags);
|
layer->initStates(w, h, flags);
|
||||||
addLayer_l(layer);
|
addLayer_l(layer);
|
||||||
|
addClientLayer_l(layer);
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1330,6 +1331,7 @@ sp<LayerBaseClient> SurfaceFlinger::createDimSurfaceLocked(
|
|||||||
sp<LayerDim> layer = new LayerDim(this, display, client, id);
|
sp<LayerDim> layer = new LayerDim(this, display, client, id);
|
||||||
layer->initStates(w, h, flags);
|
layer->initStates(w, h, flags);
|
||||||
addLayer_l(layer);
|
addLayer_l(layer);
|
||||||
|
addClientLayer_l(layer);
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1340,6 +1342,7 @@ sp<LayerBaseClient> SurfaceFlinger::createPushBuffersSurfaceLocked(
|
|||||||
sp<LayerBuffer> layer = new LayerBuffer(this, display, client, id);
|
sp<LayerBuffer> layer = new LayerBuffer(this, display, client, id);
|
||||||
layer->initStates(w, h, flags);
|
layer->initStates(w, h, flags);
|
||||||
addLayer_l(layer);
|
addLayer_l(layer);
|
||||||
|
addClientLayer_l(layer);
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1511,83 +1514,17 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
|
|||||||
result.append(buffer);
|
result.append(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t s = mClientsMap.size();
|
|
||||||
char name[64];
|
|
||||||
for (size_t i=0 ; i<s ; i++) {
|
|
||||||
sp<Client> client = mClientsMap.valueAt(i);
|
|
||||||
sprintf(name, " Client (id=0x%08x)", client->cid);
|
|
||||||
client->dump(name);
|
|
||||||
}
|
|
||||||
const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
|
const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
|
||||||
const size_t count = currentLayers.size();
|
const size_t count = currentLayers.size();
|
||||||
for (size_t i=0 ; i<count ; i++) {
|
for (size_t i=0 ; i<count ; i++) {
|
||||||
/*** LayerBase ***/
|
const sp<LayerBase>& layer(currentLayers[i]);
|
||||||
const sp<LayerBase>& layer = currentLayers[i];
|
layer->dump(result, buffer, SIZE);
|
||||||
const Layer::State& s = layer->drawingState();
|
const Layer::State& s(layer->drawingState());
|
||||||
snprintf(buffer, SIZE,
|
|
||||||
"+ %s %p\n"
|
|
||||||
" "
|
|
||||||
"z=%9d, pos=(%4d,%4d), size=(%4d,%4d), "
|
|
||||||
"needsBlending=%1d, needsDithering=%1d, invalidate=%1d, "
|
|
||||||
"alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n",
|
|
||||||
layer->getTypeID(), layer.get(),
|
|
||||||
s.z, layer->tx(), layer->ty(), s.w, s.h,
|
|
||||||
layer->needsBlending(), layer->needsDithering(),
|
|
||||||
layer->contentDirty,
|
|
||||||
s.alpha, s.flags,
|
|
||||||
s.transform[0][0], s.transform[0][1],
|
|
||||||
s.transform[1][0], s.transform[1][1]);
|
|
||||||
result.append(buffer);
|
|
||||||
buffer[0] = 0;
|
|
||||||
/*** LayerBaseClient ***/
|
|
||||||
sp<LayerBaseClient> lbc =
|
|
||||||
LayerBase::dynamicCast< LayerBaseClient* >(layer.get());
|
|
||||||
if (lbc != 0) {
|
|
||||||
sp<Client> client(lbc->client.promote());
|
|
||||||
snprintf(buffer, SIZE,
|
|
||||||
" name=%s\n", lbc->getName().string());
|
|
||||||
result.append(buffer);
|
|
||||||
snprintf(buffer, SIZE,
|
|
||||||
" id=0x%08x, client=0x%08x, identity=%u\n",
|
|
||||||
lbc->clientIndex(), client.get() ? client->cid : 0,
|
|
||||||
lbc->getIdentity());
|
|
||||||
|
|
||||||
result.append(buffer);
|
|
||||||
buffer[0] = 0;
|
|
||||||
}
|
|
||||||
/*** Layer ***/
|
|
||||||
sp<Layer> l = LayerBase::dynamicCast< Layer* >(layer.get());
|
|
||||||
if (l != 0) {
|
|
||||||
SharedBufferStack::Statistics stats = l->lcblk->getStats();
|
|
||||||
result.append( l->lcblk->dump(" ") );
|
|
||||||
sp<const GraphicBuffer> buf0(l->getBuffer(0));
|
|
||||||
sp<const GraphicBuffer> buf1(l->getBuffer(1));
|
|
||||||
uint32_t w0=0, h0=0, s0=0;
|
|
||||||
uint32_t w1=0, h1=0, s1=0;
|
|
||||||
if (buf0 != 0) {
|
|
||||||
w0 = buf0->getWidth();
|
|
||||||
h0 = buf0->getHeight();
|
|
||||||
s0 = buf0->getStride();
|
|
||||||
}
|
|
||||||
if (buf1 != 0) {
|
|
||||||
w1 = buf1->getWidth();
|
|
||||||
h1 = buf1->getHeight();
|
|
||||||
s1 = buf1->getStride();
|
|
||||||
}
|
|
||||||
snprintf(buffer, SIZE,
|
|
||||||
" "
|
|
||||||
"format=%2d, [%3ux%3u:%3u] [%3ux%3u:%3u],"
|
|
||||||
" freezeLock=%p, dq-q-time=%u us\n",
|
|
||||||
l->pixelFormat(),
|
|
||||||
w0, h0, s0, w1, h1, s1,
|
|
||||||
l->getFreezeLock().get(), stats.totalTime);
|
|
||||||
result.append(buffer);
|
|
||||||
buffer[0] = 0;
|
|
||||||
}
|
|
||||||
s.transparentRegion.dump(result, "transparentRegion");
|
s.transparentRegion.dump(result, "transparentRegion");
|
||||||
layer->transparentRegionScreen.dump(result, "transparentRegionScreen");
|
layer->transparentRegionScreen.dump(result, "transparentRegionScreen");
|
||||||
layer->visibleRegionScreen.dump(result, "visibleRegionScreen");
|
layer->visibleRegionScreen.dump(result, "visibleRegionScreen");
|
||||||
}
|
}
|
||||||
|
|
||||||
mWormholeRegion.dump(result, "WormholeRegion");
|
mWormholeRegion.dump(result, "WormholeRegion");
|
||||||
const DisplayHardware& hw(graphicPlane(0).displayHardware());
|
const DisplayHardware& hw(graphicPlane(0).displayHardware());
|
||||||
snprintf(buffer, SIZE,
|
snprintf(buffer, SIZE,
|
||||||
@ -1600,16 +1537,19 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
|
|||||||
" last transaction time : %f us\n",
|
" last transaction time : %f us\n",
|
||||||
mLastSwapBufferTime/1000.0, mLastTransactionTime/1000.0);
|
mLastSwapBufferTime/1000.0, mLastTransactionTime/1000.0);
|
||||||
result.append(buffer);
|
result.append(buffer);
|
||||||
|
|
||||||
if (inSwapBuffersDuration || !locked) {
|
if (inSwapBuffersDuration || !locked) {
|
||||||
snprintf(buffer, SIZE, " eglSwapBuffers time: %f us\n",
|
snprintf(buffer, SIZE, " eglSwapBuffers time: %f us\n",
|
||||||
inSwapBuffersDuration/1000.0);
|
inSwapBuffersDuration/1000.0);
|
||||||
result.append(buffer);
|
result.append(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inTransactionDuration || !locked) {
|
if (inTransactionDuration || !locked) {
|
||||||
snprintf(buffer, SIZE, " transaction time: %f us\n",
|
snprintf(buffer, SIZE, " transaction time: %f us\n",
|
||||||
inTransactionDuration/1000.0);
|
inTransactionDuration/1000.0);
|
||||||
result.append(buffer);
|
result.append(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buffer, SIZE, " client count: %d\n", mClientsMap.size());
|
snprintf(buffer, SIZE, " client count: %d\n", mClientsMap.size());
|
||||||
result.append(buffer);
|
result.append(buffer);
|
||||||
const GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
|
const GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
|
||||||
@ -1772,10 +1712,6 @@ sp<LayerBaseClient> Client::getLayerUser(int32_t i) const {
|
|||||||
return lbc;
|
return lbc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::dump(const char* what)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
#if 0
|
#if 0
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -73,7 +73,6 @@ public:
|
|||||||
|
|
||||||
inline bool isValid(int32_t i) const;
|
inline bool isValid(int32_t i) const;
|
||||||
sp<LayerBaseClient> getLayerUser(int32_t i) const;
|
sp<LayerBaseClient> getLayerUser(int32_t i) const;
|
||||||
void dump(const char* what);
|
|
||||||
|
|
||||||
const Vector< wp<LayerBaseClient> >& getLayers() const {
|
const Vector< wp<LayerBaseClient> >& getLayers() const {
|
||||||
return mLayers;
|
return mLayers;
|
||||||
@ -281,6 +280,7 @@ private:
|
|||||||
void destroyConnection(ClientID cid);
|
void destroyConnection(ClientID cid);
|
||||||
sp<LayerBaseClient> getLayerUser_l(SurfaceID index) const;
|
sp<LayerBaseClient> getLayerUser_l(SurfaceID index) const;
|
||||||
status_t addLayer_l(const sp<LayerBase>& layer);
|
status_t addLayer_l(const sp<LayerBase>& layer);
|
||||||
|
status_t addClientLayer_l(const sp<LayerBaseClient>& lbc);
|
||||||
status_t removeLayer_l(const sp<LayerBase>& layer);
|
status_t removeLayer_l(const sp<LayerBase>& layer);
|
||||||
status_t purgatorizeLayer_l(const sp<LayerBase>& layer);
|
status_t purgatorizeLayer_l(const sp<LayerBase>& layer);
|
||||||
void free_resources_l();
|
void free_resources_l();
|
||||||
|
Loading…
Reference in New Issue
Block a user