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

Commit 26c28b16 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

make use of new eglGetRenderBufferANDROID extension to clean-up a bit a few hacks added recently

parent c1e3ec55
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -55,9 +55,6 @@ public:
    bool isUpdateOnDemand() const { return mUpdateOnDemand; }
    status_t setUpdateRectangle(const Rect& updateRect);
    
    // FIXME: needed for copybit hack in LayerBuffer
    android_native_buffer_t const* getBackbuffer() const;
    
private:
    friend class LightRefBase<FramebufferNativeWindow>;    
    ~FramebufferNativeWindow(); // this class cannot be overloaded
@@ -78,9 +75,6 @@ private:
    int32_t mNumFreeBuffers;
    int32_t mBufferHead;
    bool mUpdateOnDemand;

    // FIXME: for getBackbuffer
    int32_t mLastDequeued;
};
    
// ---------------------------------------------------------------------------
+0 −5
Original line number Diff line number Diff line
@@ -348,8 +348,3 @@ void DisplayHardware::makeCurrent() const
{
    eglMakeCurrent(mDisplay, mSurface, mSurface, mContext);
}

sp<FramebufferNativeWindow> DisplayHardware::getFb() const { 
    return mNativeWindow; 
}
+0 −3
Original line number Diff line number Diff line
@@ -84,9 +84,6 @@ public:
        return Rect(mWidth, mHeight);
    }

    // FIXME: needed in LayerBuffer for msm7k/copybit hack
    sp<FramebufferNativeWindow> getFb() const;
    
private:
    void init(uint32_t displayIndex) __attribute__((noinline));
    void fini() __attribute__((noinline));
+42 −37
Original line number Diff line number Diff line
@@ -468,16 +468,19 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const
        }
#endif

#ifdef EGL_ANDROID_get_render_buffer
        EGLDisplay dpy = eglGetCurrentDisplay();
        EGLSurface draw = eglGetCurrentSurface(EGL_DRAW); 
        EGLClientBuffer clientBuf = eglGetRenderBufferANDROID(dpy, draw);
        android_native_buffer_t* nb = (android_native_buffer_t*)clientBuf;
        if (nb == 0) {
            err = BAD_VALUE;
        } else {
            copybit_image_t dst;
        const DisplayHardware& hw(mLayer.graphicPlane(0).displayHardware());
        sp<FramebufferNativeWindow> fbw = hw.getFb();
        android_native_buffer_t const* nb = fbw->getBackbuffer();
        native_handle_t const* hnd = nb->handle;

        dst.w       = 320;
        dst.h       = 480;
        dst.format  = 4;
        dst.base    = 0;
            dst.w       = nb->width;
            dst.h       = nb->height;
            dst.format  = nb->format;
            dst.base    = NULL; // unused by copybit on msm7k
            dst.handle  = (native_handle_t *)nb->handle;

            const Rect& transformedBounds = mLayer.getTransformedBounds();
@@ -508,6 +511,8 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const
                LOGE("copybit failed (%s)", strerror(err));
            }
        }
    }
#endif
    
    if (!copybit || err) 
    {
+0 −6
Original line number Diff line number Diff line
@@ -63,11 +63,6 @@ private:
};


android_native_buffer_t const* FramebufferNativeWindow::getBackbuffer() const {
    return static_cast<android_native_buffer_t const*>(buffers[mLastDequeued].get());
}


/*
 * This implements the (main) framebuffer management. This class is used
 * mostly by SurfaceFlinger, but also by command line GL application.
@@ -170,7 +165,6 @@ int FramebufferNativeWindow::dequeueBuffer(android_native_window_t* window,
    if (self->mBufferHead >= self->mNumBuffers)
        self->mBufferHead = 0;

    self->mLastDequeued = index;
    *buffer = self->buffers[index].get();

    return 0;