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

Commit 56f825e7 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger now uses GLES 2.x when available" into klp-dev

parents 5025593d 3f844833
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@

#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

#include <gui/IGraphicBufferProducer.h>
#include <gui/BufferQueue.h>
@@ -54,6 +52,8 @@ class String8;
 * This class was previously called SurfaceTexture.
 */
class GLConsumer : public ConsumerBase {
protected:
    enum { TEXTURE_EXTERNAL = 0x8D65 }; // GL_TEXTURE_EXTERNAL_OES
public:
    typedef ConsumerBase::FrameAvailableListener FrameAvailableListener;

@@ -82,7 +82,7 @@ public:
    // context to another. If such a transfer is not needed there is no
    // requirement that either of these methods be called.
    GLConsumer(const sp<IGraphicBufferConsumer>& bq,
            GLuint tex, GLenum texTarget = GL_TEXTURE_EXTERNAL_OES,
            uint32_t tex, uint32_t texureTarget = TEXTURE_EXTERNAL,
            bool useFenceSync = true, bool isControlledByApp = false);

    // updateTexImage acquires the most recently queued buffer, and sets the
@@ -160,7 +160,7 @@ public:

    // getCurrentTextureTarget returns the texture target of the current
    // texture as returned by updateTexImage().
    GLenum getCurrentTextureTarget() const;
    uint32_t getCurrentTextureTarget() const;

    // getCurrentCrop returns the cropping rectangle of the current buffer.
    Rect getCurrentCrop() const;
@@ -215,7 +215,7 @@ public:
    // call to attachToContext will result in this texture object being bound to
    // the texture target and populated with the image contents that were
    // current at the time of the last call to detachFromContext.
    status_t attachToContext(GLuint tex);
    status_t attachToContext(uint32_t tex);

protected:

@@ -347,7 +347,7 @@ private:
    // mTexName is the name of the OpenGL texture to which streamed images will
    // be bound when updateTexImage is called. It is set at construction time
    // and can be changed with a call to attachToContext.
    GLuint mTexName;
    uint32_t mTexName;

    // mUseFenceSync indicates whether creation of the EGL_KHR_fence_sync
    // extension should be used to prevent buffers from being dequeued before
@@ -362,7 +362,7 @@ private:
    // glCopyTexSubImage to read from the texture.  This is a hack to work
    // around a GL driver limitation on the number of FBO attachments, which the
    // browser's tile cache exceeds.
    const GLenum mTexTarget;
    const uint32_t mTexTarget;

    // EGLSlot contains the information and object references that
    // GLConsumer maintains about a BufferQueue buffer slot.
+0 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
#define ANDROID_GUI_SURFACE_H

#include <gui/IGraphicBufferProducer.h>
#include <gui/GLConsumer.h>
#include <gui/BufferQueue.h>

#include <ui/ANativeObjectBase.h>
+5 −5
Original line number Diff line number Diff line
@@ -89,8 +89,8 @@ static void mtxMul(float out[16], const float a[16], const float b[16]);
Mutex GLConsumer::sStaticInitLock;
sp<GraphicBuffer> GLConsumer::sReleasedTexImageBuffer;

GLConsumer::GLConsumer(const sp<IGraphicBufferConsumer>& bq, GLuint tex,
        GLenum texTarget, bool useFenceSync, bool isControlledByApp) :
GLConsumer::GLConsumer(const sp<IGraphicBufferConsumer>& bq, uint32_t tex,
        uint32_t texTarget, bool useFenceSync, bool isControlledByApp) :
    ConsumerBase(bq, isControlledByApp),
    mCurrentTransform(0),
    mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
@@ -523,7 +523,7 @@ status_t GLConsumer::detachFromContext() {
    return OK;
}

status_t GLConsumer::attachToContext(GLuint tex) {
status_t GLConsumer::attachToContext(uint32_t tex) {
    ATRACE_CALL();
    ST_LOGV("attachToContext");
    Mutex::Autolock lock(mMutex);
@@ -554,7 +554,7 @@ status_t GLConsumer::attachToContext(GLuint tex) {

    // We need to bind the texture regardless of whether there's a current
    // buffer.
    glBindTexture(mTexTarget, tex);
    glBindTexture(mTexTarget, GLuint(tex));

    if (mCurrentTextureBuf != NULL) {
        // The EGLImageKHR that was associated with the slot was destroyed when
@@ -689,7 +689,7 @@ bool GLConsumer::isExternalFormat(uint32_t format)
    return false;
}

GLenum GLConsumer::getCurrentTextureTarget() const {
uint32_t GLConsumer::getCurrentTextureTarget() const {
    return mTexTarget;
}

+7 −1
Original line number Diff line number Diff line
@@ -19,10 +19,15 @@ LOCAL_SRC_FILES:= \
    DisplayHardware/VirtualDisplaySurface.cpp \
    EventLog/EventLogTags.logtags \
    EventLog/EventLog.cpp \
    RenderEngine/Description.cpp \
    RenderEngine/Mesh.cpp \
    RenderEngine/Program.cpp \
    RenderEngine/ProgramCache.cpp \
    RenderEngine/GLExtensions.cpp \
    RenderEngine/RenderEngine.cpp \
    RenderEngine/GLES10RenderEngine.cpp \
    RenderEngine/GLES11RenderEngine.cpp
    RenderEngine/GLES11RenderEngine.cpp \
    RenderEngine/GLES20RenderEngine.cpp


LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\"
@@ -56,6 +61,7 @@ LOCAL_SHARED_LIBRARIES := \
	libutils \
	libEGL \
	libGLESv1_CM \
	libGLESv2 \
	libbinder \
	libui \
	libgui
+1 −1
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ EGLBoolean DisplayDevice::makeCurrent(EGLDisplay dpy, EGLContext ctx) const {
void DisplayDevice::setViewportAndProjection() const {
    size_t w = mDisplayWidth;
    size_t h = mDisplayHeight;
    mFlinger->getRenderEngine().setViewportAndProjection(w, h);
    mFlinger->getRenderEngine().setViewportAndProjection(w, h, w, h, false);
}

// ----------------------------------------------------------------------------
Loading