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

Commit 7a602035 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am b881700a: am 56f825e7: Merge "SurfaceFlinger now uses GLES 2.x when available" into klp-dev

* commit 'b881700a':
  SurfaceFlinger now uses GLES 2.x when available
parents 6d92b740 b881700a
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -19,8 +19,6 @@


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


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


@@ -82,7 +82,7 @@ public:
    // context to another. If such a transfer is not needed there is no
    // context to another. If such a transfer is not needed there is no
    // requirement that either of these methods be called.
    // requirement that either of these methods be called.
    GLConsumer(const sp<IGraphicBufferConsumer>& bq,
    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);
            bool useFenceSync = true, bool isControlledByApp = false);


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


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


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


protected:
protected:


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


    // mUseFenceSync indicates whether creation of the EGL_KHR_fence_sync
    // mUseFenceSync indicates whether creation of the EGL_KHR_fence_sync
    // extension should be used to prevent buffers from being dequeued before
    // 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
    // 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
    // around a GL driver limitation on the number of FBO attachments, which the
    // browser's tile cache exceeds.
    // browser's tile cache exceeds.
    const GLenum mTexTarget;
    const uint32_t mTexTarget;


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


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


#include <ui/ANativeObjectBase.h>
#include <ui/ANativeObjectBase.h>
+5 −5
Original line number Original line 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;
Mutex GLConsumer::sStaticInitLock;
sp<GraphicBuffer> GLConsumer::sReleasedTexImageBuffer;
sp<GraphicBuffer> GLConsumer::sReleasedTexImageBuffer;


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


status_t GLConsumer::attachToContext(GLuint tex) {
status_t GLConsumer::attachToContext(uint32_t tex) {
    ATRACE_CALL();
    ATRACE_CALL();
    ST_LOGV("attachToContext");
    ST_LOGV("attachToContext");
    Mutex::Autolock lock(mMutex);
    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
    // We need to bind the texture regardless of whether there's a current
    // buffer.
    // buffer.
    glBindTexture(mTexTarget, tex);
    glBindTexture(mTexTarget, GLuint(tex));


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


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


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




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


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