diff options
author | Mathias Agopian <mathias@google.com> | 2013-06-07 15:35:48 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2013-07-03 14:39:27 -0700 |
commit | 875d8e1323536e16dcfc90c9674d7ad32116a69a (patch) | |
tree | 7e3c584f2791aeca5abe25ba036c7d628948a9ab /services/surfaceflinger/DisplayDevice.cpp | |
parent | 9c3e2dd97e100a3effe617cacb00cf163577ba13 (diff) | |
download | frameworks_native-875d8e1323536e16dcfc90c9674d7ad32116a69a.zip frameworks_native-875d8e1323536e16dcfc90c9674d7ad32116a69a.tar.gz frameworks_native-875d8e1323536e16dcfc90c9674d7ad32116a69a.tar.bz2 |
Refactor SF. Move all GL operations in their own class.
this is the first step to add support for GLES 2.x, this
change breaks the dependency of SF on GLES 1.x by moving
all operation into their own class.
Bug: 8679321
Change-Id: I0d2741eca2cefe67dfd9cf837cac10c4d126928b
Diffstat (limited to 'services/surfaceflinger/DisplayDevice.cpp')
-rw-r--r-- | services/surfaceflinger/DisplayDevice.cpp | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index b001bdb..2eae9c2 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -29,18 +29,14 @@ #include <gui/Surface.h> -#include <GLES/gl.h> -#include <EGL/egl.h> -#include <EGL/eglext.h> - #include <hardware/gralloc.h> #include "DisplayHardware/DisplaySurface.h" #include "DisplayHardware/HWComposer.h" +#include "RenderEngine/RenderEngine.h" #include "clz.h" #include "DisplayDevice.h" -#include "GLExtensions.h" #include "SurfaceFlinger.h" #include "Layer.h" @@ -48,20 +44,6 @@ using namespace android; // ---------------------------------------------------------------------------- -static __attribute__((noinline)) -void checkGLErrors() -{ - do { - // there could be more than one error flag - GLenum error = glGetError(); - if (error == GL_NO_ERROR) - break; - ALOGE("GL error 0x%04x", int(error)); - } while(true); -} - -// ---------------------------------------------------------------------------- - /* * Initialize the display to the specified values. * @@ -189,7 +171,7 @@ status_t DisplayDevice::compositionComplete() const { void DisplayDevice::flip(const Region& dirty) const { - checkGLErrors(); + mFlinger->getRenderEngine().checkErrors(); EGLDisplay dpy = mDisplay; EGLSurface surface = mSurface; @@ -246,28 +228,22 @@ uint32_t DisplayDevice::getFlags() const return mFlags; } -EGLBoolean DisplayDevice::makeCurrent(EGLDisplay dpy, - const sp<const DisplayDevice>& hw, EGLContext ctx) { +EGLBoolean DisplayDevice::makeCurrent(EGLDisplay dpy, EGLContext ctx) const { EGLBoolean result = EGL_TRUE; EGLSurface sur = eglGetCurrentSurface(EGL_DRAW); - if (sur != hw->mSurface) { - result = eglMakeCurrent(dpy, hw->mSurface, hw->mSurface, ctx); + if (sur != mSurface) { + result = eglMakeCurrent(dpy, mSurface, mSurface, ctx); if (result == EGL_TRUE) { - setViewportAndProjection(hw); + setViewportAndProjection(); } } return result; } -void DisplayDevice::setViewportAndProjection(const sp<const DisplayDevice>& hw) { - GLsizei w = hw->mDisplayWidth; - GLsizei h = hw->mDisplayHeight; - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - // put the origin in the left-bottom corner - glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h - glMatrixMode(GL_MODELVIEW); +void DisplayDevice::setViewportAndProjection() const { + size_t w = mDisplayWidth; + size_t h = mDisplayHeight; + mFlinger->getRenderEngine().setViewportAndProjection(w, h); } // ---------------------------------------------------------------------------- |