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

Commit 3e876011 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Implement SurfaceFlinger's ANW on top of BufferQueue

SF now has its own implementation of ANW for the
framebuffer and it uses BufferQueue. FramebufferNativeWindow
is now only used by stand-alone apps.

Change-Id: Iddeb24087df62bd92b0f78e391dda9b97ddc859c
parent 04d7eaf1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -96,7 +96,9 @@ public:
    // allowSynchronousMode specifies whether or not synchronous mode can be
    // enabled.
    // bufferCount sets the minimum number of undequeued buffers for this queue
    BufferQueue(  bool allowSynchronousMode = true, int bufferCount = MIN_UNDEQUEUED_BUFFERS);
    BufferQueue(bool allowSynchronousMode = true,
            int bufferCount = MIN_UNDEQUEUED_BUFFERS,
            const sp<IGraphicBufferAlloc>& allocator = NULL);
    virtual ~BufferQueue();

    virtual int query(int what, int* value);
+10 −5
Original line number Diff line number Diff line
@@ -81,7 +81,8 @@ static const char* scalingModeName(int scalingMode) {
    }
}

BufferQueue::BufferQueue(  bool allowSynchronousMode, int bufferCount ) :
BufferQueue::BufferQueue(bool allowSynchronousMode, int bufferCount,
        const sp<IGraphicBufferAlloc>& allocator) :
    mDefaultWidth(1),
    mDefaultHeight(1),
    mPixelFormat(PIXEL_FORMAT_RGBA_8888),
@@ -105,11 +106,15 @@ BufferQueue::BufferQueue( bool allowSynchronousMode, int bufferCount ) :
    mConsumerName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId());

    ST_LOGV("BufferQueue");
    if (allocator == NULL) {
        sp<ISurfaceComposer> composer(ComposerService::getComposerService());
        mGraphicBufferAlloc = composer->createGraphicBufferAlloc();
        if (mGraphicBufferAlloc == 0) {
            ST_LOGE("createGraphicBufferAlloc() failed in BufferQueue()");
        }
    } else {
        mGraphicBufferAlloc = allocator;
    }
}

BufferQueue::~BufferQueue() {
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ LOCAL_SRC_FILES:= \
    LayerScreenshot.cpp                     \
    DisplayHardware/DisplayHardware.cpp     \
    DisplayHardware/DisplayHardwareBase.cpp \
    DisplayHardware/FramebufferSurface.cpp  \
    DisplayHardware/HWComposer.cpp          \
    DisplayHardware/PowerHAL.cpp            \
    GLExtensions.cpp                        \
+2 −2
Original line number Diff line number Diff line
@@ -25,13 +25,13 @@
#include <utils/Log.h>

#include <ui/PixelFormat.h>
#include <ui/FramebufferNativeWindow.h>

#include <GLES/gl.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>

#include "DisplayHardware/DisplayHardware.h"
#include "DisplayHardware/FramebufferSurface.h"

#include <hardware/gralloc.h>

@@ -148,7 +148,7 @@ static status_t selectConfigForPixelFormat(

void DisplayHardware::init(uint32_t dpy)
{
    mNativeWindow = new FramebufferNativeWindow();
    mNativeWindow = new FramebufferSurface();
    framebuffer_device_t const * fbDev = mNativeWindow->getDevice();
    if (!fbDev) {
        ALOGE("Display subsystem failed to initialize. check logs. exiting...");
+2 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@

namespace android {

class FramebufferNativeWindow;
class FramebufferSurface;

class DisplayHardware :
    public DisplayHardwareBase,
@@ -144,7 +144,7 @@ private:
    // protected by mLock
    wp<VSyncHandler>    mVSyncHandler;

    sp<FramebufferNativeWindow> mNativeWindow;
    sp<FramebufferSurface> mNativeWindow;
};

}; // namespace android
Loading