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

Commit f9e6033e authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Revert "Get rid of IGraphicBufferAlloc""

parents d4639b1e f8b4ca51
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
 namespace android {

GLHelper::GLHelper() :
    mGraphicBufferAlloc(new GraphicBufferAlloc()),
    mDisplay(EGL_NO_DISPLAY),
    mContext(EGL_NO_CONTEXT),
    mDummySurface(EGL_NO_SURFACE),
@@ -202,7 +203,7 @@ bool GLHelper::createNamedSurfaceTexture(GLuint name, uint32_t w, uint32_t h,
        sp<GLConsumer>* glConsumer, EGLSurface* surface) {
    sp<IGraphicBufferProducer> producer;
    sp<IGraphicBufferConsumer> consumer;
    BufferQueue::createBufferQueue(&producer, &consumer);
    BufferQueue::createBufferQueue(&producer, &consumer, mGraphicBufferAlloc);
    sp<GLConsumer> glc = new GLConsumer(consumer, name,
            GL_TEXTURE_EXTERNAL_OES, false, true);
    glc->setDefaultBufferSize(w, h);
+3 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
 * limitations under the License.
 */

#include <gui/GraphicBufferAlloc.h>
#include <gui/GLConsumer.h>
#include <gui/Surface.h>
#include <gui/SurfaceControl.h>
@@ -74,6 +75,8 @@ private:

    bool setUpShaders(const ShaderDesc* shaderDescs, size_t numShaders);

    sp<GraphicBufferAlloc> mGraphicBufferAlloc;

    EGLDisplay mDisplay;
    EGLContext mContext;
    EGLSurface mDummySurface;
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#define ATRACE_TAG ATRACE_TAG_ALWAYS

#include <gui/GraphicBufferAlloc.h>
#include <gui/Surface.h>
#include <gui/SurfaceControl.h>
#include <gui/GLConsumer.h>
+7 −1
Original line number Diff line number Diff line
@@ -23,6 +23,10 @@
#include <gui/IGraphicBufferProducer.h>
#include <gui/IConsumerListener.h>

// These are only required to keep other parts of the framework with incomplete
// dependencies building successfully
#include <gui/IGraphicBufferAlloc.h>

namespace android {

class BufferQueue {
@@ -77,9 +81,11 @@ public:
    // needed gralloc buffers.
    static void createBufferQueue(sp<IGraphicBufferProducer>* outProducer,
            sp<IGraphicBufferConsumer>* outConsumer,
            const sp<IGraphicBufferAlloc>& allocator = NULL,
            bool consumerIsSurfaceFlinger = false);

    BufferQueue() = delete; // Create through createBufferQueue
private:
    BufferQueue(); // Create through createBufferQueue
};

// ----------------------------------------------------------------------------
+8 −2
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@
namespace android {

class IConsumerListener;
class IGraphicBufferAlloc;
class IProducerListener;

class BufferQueueCore : public virtual RefBase {
@@ -78,8 +79,9 @@ public:
    typedef Vector<BufferItem> Fifo;

    // BufferQueueCore manages a pool of gralloc memory slots to be used by
    // producers and consumers.
    BufferQueueCore();
    // producers and consumers. allocator is used to allocate all the needed
    // gralloc buffers.
    BufferQueueCore(const sp<IGraphicBufferAlloc>& allocator = NULL);
    virtual ~BufferQueueCore();

private:
@@ -141,6 +143,10 @@ private:
    void validateConsistencyLocked() const;
#endif

    // mAllocator is the connection to SurfaceFlinger that is used to allocate
    // new GraphicBuffer objects.
    sp<IGraphicBufferAlloc> mAllocator;

    // mMutex is the mutex used to prevent concurrent access to the member
    // variables of BufferQueueCore objects. It must be locked whenever any
    // member variable is accessed.
Loading