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

Commit 975e49a2 authored by Chia-I Wu's avatar Chia-I Wu Committed by Android (Google) Code Review
Browse files

Merge "Revert "get rid of IGraphicBufferAlloc""

parents 4c5441be 527747dc
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
 namespace android {
 namespace android {


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


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


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


    sp<GraphicBufferAlloc> mGraphicBufferAlloc;

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


#define ATRACE_TAG ATRACE_TAG_ALWAYS
#define ATRACE_TAG ATRACE_TAG_ALWAYS


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


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


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


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


class IConsumerListener;
class IConsumerListener;
class IGraphicBufferAlloc;
class IProducerListener;
class IProducerListener;


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


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


private:
private:
@@ -141,6 +143,10 @@ private:
    void validateConsistencyLocked() const;
    void validateConsistencyLocked() const;
#endif
#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
    // mMutex is the mutex used to prevent concurrent access to the member
    // variables of BufferQueueCore objects. It must be locked whenever any
    // variables of BufferQueueCore objects. It must be locked whenever any
    // member variable is accessed.
    // member variable is accessed.
Loading