Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce8a4445 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge changes I3f0e01b0,I946cbc78,I9d3ad801 into ics-factoryrom

* changes:
  fix transition from full overlays to fb
  rename mInvalidRegion to mSwapRegion
  improve hwc dumpsys
parents b76f8fd9 8bfdda9a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -84,9 +84,10 @@ public:
    
    status_t compositionComplete() const;
    
    Rect bounds() const {
    Rect getBounds() const {
        return Rect(mWidth, mHeight);
    }
    inline Rect bounds() const { return getBounds(); }

    // only for debugging
    int getCurrentBufferIndex() const;
+48 −5
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ namespace android {
HWComposer::HWComposer(const sp<SurfaceFlinger>& flinger)
    : mFlinger(flinger),
      mModule(0), mHwc(0), mList(0), mCapacity(0),
      mNumOVLayers(0), mNumFBLayers(0),
      mDpy(EGL_NO_DISPLAY), mSur(EGL_NO_SURFACE)
{
    int err = hw_get_module(HWC_HARDWARE_MODULE_ID, &mModule);
@@ -98,9 +99,40 @@ status_t HWComposer::createWorkList(size_t numLayers) {

status_t HWComposer::prepare() const {
    int err = mHwc->prepare(mHwc, mList);
    if (err == NO_ERROR) {
        size_t numOVLayers = 0;
        size_t numFBLayers = 0;
        size_t count = mList->numHwLayers;
        for (size_t i=0 ; i<count ; i++) {
            hwc_layer& l(mList->hwLayers[i]);
            if (l.flags & HWC_SKIP_LAYER) {
                l.compositionType = HWC_FRAMEBUFFER;
            }
            switch (l.compositionType) {
                case HWC_OVERLAY:
                    numOVLayers++;
                    break;
                case HWC_FRAMEBUFFER:
                    numFBLayers++;
                    break;
            }
        }
        mNumOVLayers = numOVLayers;
        mNumFBLayers = numFBLayers;
    }
    return (status_t)err;
}

size_t HWComposer::getLayerCount(int type) const {
    switch (type) {
        case HWC_OVERLAY:
            return mNumOVLayers;
        case HWC_FRAMEBUFFER:
            return mNumFBLayers;
    }
    return 0;
}

status_t HWComposer::commit() const {
    int err = mHwc->set(mHwc, mDpy, mSur, mList);
    if (mList) {
@@ -143,18 +175,29 @@ void HWComposer::dump(String8& result, char* buffer, size_t SIZE,
        snprintf(buffer, SIZE, "  numHwLayers=%u, flags=%08x\n",
                mList->numHwLayers, mList->flags);
        result.append(buffer);

        result.append(
                "    type   |   hints  |   flags  | tr | blend |  format  |     source rectangle      |      crop rectangle       name \n"
                "-----------+----------+----------+----+-------+----------+---------------------------+--------------------------------\n");
        //      "  ________ | ________ | ________ | __ | _____ | ________ | [_____,_____,_____,_____] | [_____,_____,_____,_____]
        for (size_t i=0 ; i<mList->numHwLayers ; i++) {
            const hwc_layer_t& l(mList->hwLayers[i]);
            snprintf(buffer, SIZE, "  %8s | %08x | %08x | %02x | %04x | [%5d,%5d,%5d,%5d] |  [%5d,%5d,%5d,%5d] %s\n",
            const sp<LayerBase> layer(visibleLayersSortedByZ[i]);
            int32_t format = -1;
            if (layer->getLayer() != NULL) {
                const sp<GraphicBuffer>& buffer(layer->getLayer()->getActiveBuffer());
                if (buffer != NULL) {
                    format = buffer->getPixelFormat();
                }
            }
            snprintf(buffer, SIZE,
                    "  %8s | %08x | %08x | %02x | %05x | %08x | [%5d,%5d,%5d,%5d] | [%5d,%5d,%5d,%5d] %s\n",
                    l.compositionType ? "OVERLAY" : "FB",
                    l.hints, l.flags, l.transform, l.blending,
                    l.hints, l.flags, l.transform, l.blending, format,
                    l.sourceCrop.left, l.sourceCrop.top, l.sourceCrop.right, l.sourceCrop.bottom,
                    l.displayFrame.left, l.displayFrame.top, l.displayFrame.right, l.displayFrame.bottom,
                    visibleLayersSortedByZ[i]->getName().string());
                    layer->getName().string());
            result.append(buffer);
        }

    }
    if (mHwc && mHwc->common.version >= 1 && mHwc->dump) {
        mHwc->dump(mHwc, buffer, SIZE);
+5 −0
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ public:
    size_t getNumLayers() const;
    hwc_layer_t* getLayers() const;

    // updated in preapre()
    size_t getLayerCount(int type) const;

    // for debugging
    void dump(String8& out, char* scratch, size_t SIZE,
            const Vector< sp<LayerBase> >& visibleLayersSortedByZ) const;
@@ -81,6 +84,8 @@ private:
    hwc_composer_device_t*  mHwc;
    hwc_layer_list_t*       mList;
    size_t                  mCapacity;
    mutable size_t          mNumOVLayers;
    mutable size_t          mNumFBLayers;
    hwc_display_t           mDpy;
    hwc_surface_t           mSur;
    cb_context              mCBContext;
+2 −0
Original line number Diff line number Diff line
@@ -73,12 +73,14 @@ public:
    virtual bool isSecure() const           { return mSecure; }
    virtual bool isProtected() const;
    virtual void onRemoved();
    virtual sp<Layer> getLayer() const { return const_cast<Layer*>(this); }

    // LayerBaseClient interface
    virtual wp<IBinder> getSurfaceTextureBinder() const;

    // only for debugging
    inline const sp<FreezeLock>&  getFreezeLock() const { return mFreezeLock; }
    inline const sp<GraphicBuffer>& getActiveBuffer() const { return mActiveBuffer; }

protected:
    virtual void onFirstRef();
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ class Client;
class DisplayHardware;
class GraphicBuffer;
class GraphicPlane;
class Layer;
class LayerBaseClient;
class SurfaceFlinger;

@@ -105,6 +106,7 @@ public:
            void invalidate();

    virtual sp<LayerBaseClient> getLayerBaseClient() const { return 0; }
    virtual sp<Layer> getLayer() const { return 0; }

    virtual const char* getTypeId() const { return "LayerBase"; }

Loading