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

Commit 5882a267 authored by Pablo Ceballos's avatar Pablo Ceballos Committed by Android (Google) Code Review
Browse files

Merge "Revert "EGL: Ensure surfaces are disconnected when destroyed"" into nyc-dev

parents 62b6bc7c 1a5c4dee
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -605,7 +605,6 @@ EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
    EGLBoolean result = s->cnx->egl.eglDestroySurface(dp->disp.dpy, s->surface);
    if (result == EGL_TRUE) {
        _s.terminate();
        dp->removeSurface(surface);
    }
    return result;
}
+0 −25
Original line number Diff line number Diff line
@@ -90,31 +90,6 @@ bool egl_display_t::getObject(egl_object_t* object) const {
    return false;
}

void egl_display_t::addContext(egl_context_t* context) {
    Mutex::Autolock _l(lock);
    contexts.add(context);
}

void egl_display_t::removeContext(egl_context_t* context) {
    Mutex::Autolock _l(lock);
    contexts.remove(context);
}

void egl_display_t::removeSurface(EGLSurface surface) const {
    Mutex::Autolock _l(lock);
    for (size_t i = 0; i < contexts.size(); i++) {
        egl_context_t* context = contexts[i];
        if (context->read == surface) {
            SurfaceRef _r(get_surface(context->read));
            _r.release();
        }
        if (context->draw == surface) {
            SurfaceRef _d(get_surface(context->draw));
            _d.release();
        }
    }
}

EGLDisplay egl_display_t::getFromNativeDisplay(EGLNativeDisplayType disp) {
    if (uintptr_t(disp) >= NUM_DISPLAYS)
        return NULL;
+0 −8
Original line number Diff line number Diff line
@@ -68,13 +68,6 @@ public:
    // add reference to this object. returns true if this is a valid object.
    bool getObject(egl_object_t* object) const;

    // add context to this display's list
    void addContext(egl_context_t* context);
    // remove context from this display's list
    void removeContext(egl_context_t* context);
    // search for surface on all contexts and remove the references
    void removeSurface(EGLSurface surface) const;

    // These notifications allow the display to keep track of how many window
    // surfaces exist, which it uses to decide whether to hibernate the
    // underlying EGL implementation. They can be called by any thread without
@@ -142,7 +135,6 @@ private:
    mutable Mutex                       lock, refLock;
    mutable Condition                   refCond;
            SortedVector<egl_object_t*> objects;
            SortedVector<egl_context_t*> contexts;
            String8 mVendorString;
            String8 mVersionString;
            String8 mClientApiString;
+0 −6
Original line number Diff line number Diff line
@@ -91,12 +91,6 @@ egl_context_t::egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig confi
        egl_connection_t const* cnx, int version) :
    egl_object_t(get_display_nowake(dpy)), dpy(dpy), context(context),
            config(config), read(0), draw(0), cnx(cnx), version(version) {
    get_display_nowake(dpy)->addContext(this);
}

void egl_context_t::terminate() {
    display->removeContext(this);
    egl_object_t::terminate();
}

void egl_context_t::onLooseCurrent() {
+2 −3
Original line number Diff line number Diff line
@@ -40,12 +40,11 @@ namespace android {
class egl_display_t;

class egl_object_t {
    egl_display_t *display;
    mutable volatile int32_t count;

protected:
    virtual ~egl_object_t();
    virtual void terminate();
    egl_display_t *display;

public:
    egl_object_t(egl_display_t* display);
@@ -56,6 +55,7 @@ public:
    inline egl_display_t* getDisplay() const { return display; }

private:
    void terminate();
    static bool get(egl_display_t const* display, egl_object_t* object);

public:
@@ -143,7 +143,6 @@ public:
class egl_context_t: public egl_object_t {
protected:
    ~egl_context_t() {}
    void terminate() override;
public:
    typedef egl_object_t::LocalRef<egl_context_t, EGLContext> Ref;