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

Commit 285dbde2 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Added a name to Surface created by SurfaceFlinger

Updated the window manager to use this new facility.
Surfaces name are now printed by "dumpsys".
parent 46a26c63
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ public:

    virtual sp<ISurface> createSurface( surface_data_t* data,
                                        int pid, 
                                        const String8& name,
                                        DisplayID display,
                                        uint32_t w,
                                        uint32_t h,
+11 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public:
    //! Create a surface
    sp<SurfaceControl> createSurface(
            int pid,            // pid of the process the surface is for
            const String8& name,// name of the surface
            DisplayID display,  // Display to create this surface on
            uint32_t w,         // width in pixel
            uint32_t h,         // height in pixel
@@ -72,6 +73,16 @@ public:
            uint32_t flags = 0  // usage flags
    );

    sp<SurfaceControl> createSurface(
            int pid,            // pid of the process the surface is for
            DisplayID display,  // Display to create this surface on
            uint32_t w,         // width in pixel
            uint32_t h,         // height in pixel
            PixelFormat format, // pixel-format desired
            uint32_t flags = 0  // usage flags
    );


    // ------------------------------------------------------------------------
    // Composer parameters
    // All composer parameters must be changed within a transaction
+8 −0
Original line number Diff line number Diff line
@@ -728,6 +728,14 @@ LayerBaseClient::~LayerBaseClient()
    delete lcblk;
}

void LayerBaseClient::setName(const String8& name) {
    mName = name;
}

String8 LayerBaseClient::getName() const {
    return mName;
}

int32_t LayerBaseClient::serverIndex() const 
{
    sp<Client> client(this->client.promote());
+4 −0
Original line number Diff line number Diff line
@@ -320,6 +320,8 @@ public:
            const sp<Client>& client, int32_t i);
    virtual ~LayerBaseClient();
    virtual void onFirstRef();
    void setName(const String8& name);
    String8 getName() const;

    const wp<Client>    client;

@@ -333,6 +335,7 @@ public:
    
    virtual void onRemoved();


    class Surface : public BnSurface 
    {
    public:
@@ -371,6 +374,7 @@ private:
    mutable     Mutex           mLock;
    mutable     wp<Surface>     mClientSurface;
    // only read
                String8         mName;
    const       uint32_t        mIdentity;
    static      int32_t         sIdentity;
};
+9 −4
Original line number Diff line number Diff line
@@ -1186,7 +1186,7 @@ int SurfaceFlinger::setOrientation(DisplayID dpy,
}

sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid,
        ISurfaceFlingerClient::surface_data_t* params,
        const String8& name, ISurfaceFlingerClient::surface_data_t* params,
        DisplayID d, uint32_t w, uint32_t h, PixelFormat format,
        uint32_t flags)
{
@@ -1232,6 +1232,7 @@ sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid,
    }

    if (layer != 0) {
        layer->setName(name);
        setTransactionFlags(eTransactionNeeded);
        surfaceHandle = layer->getSurface();
        if (surfaceHandle != 0) { 
@@ -1506,7 +1507,9 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
            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());
@@ -1760,10 +1763,12 @@ sp<IMemoryHeap> BClient::getControlBlock() const {

sp<ISurface> BClient::createSurface(
        ISurfaceFlingerClient::surface_data_t* params, int pid,
        const String8& name,
        DisplayID display, uint32_t w, uint32_t h, PixelFormat format,
        uint32_t flags)
{
    return mFlinger->createSurface(mId, pid, params, display, w, h, format, flags);
    return mFlinger->createSurface(mId, pid, name, params, display, w, h,
            format, flags);
}

status_t BClient::destroySurface(SurfaceID sid)
Loading