Loading libs/surfaceflinger/Layer.cpp +5 −7 Original line number Diff line number Diff line Loading @@ -188,6 +188,8 @@ void Layer::reloadTexture(const Region& dirty) } else { // Everything went okay! mTextures[index].dirty = false; mTextures[index].width = clientBuf->width; mTextures[index].height = clientBuf->height; } } } Loading @@ -200,8 +202,7 @@ void Layer::reloadTexture(const Region& dirty) if (UNLIKELY(mTextures[0].name == -1U)) { mTextures[0].name = createTexture(); } loadTexture(dirty, mTextures[0].name, t, mTextures[0].width, mTextures[0].height); loadTexture(&mTextures[0], mTextures[0].name, dirty, t); buffer->unlock(); } } Loading @@ -222,10 +223,7 @@ void Layer::onDraw(const Region& clip) const clearWithOpenGL(clip); return; } GGLSurface t; sp<const Buffer> buffer(frontBuffer().getBuffer()); drawWithOpenGL(clip, textureName, buffer); drawWithOpenGL(clip, mTextures[index]); } sp<SurfaceBuffer> Layer::peekBuffer() Loading libs/surfaceflinger/Layer.h +0 −10 Original line number Diff line number Diff line Loading @@ -123,16 +123,6 @@ private: }; friend class SurfaceLayer; struct Texture { Texture() : name(-1U), width(0), height(0), image(EGL_NO_IMAGE_KHR), dirty(true) { } GLuint name; GLuint width; GLuint height; EGLImageKHR image; bool dirty; }; sp<Surface> mSurface; bool mSecure; Loading libs/surfaceflinger/LayerBase.cpp +14 −9 Original line number Diff line number Diff line Loading @@ -380,17 +380,17 @@ void LayerBase::clearWithOpenGL(const Region& clip) const } } void LayerBase::drawWithOpenGL(const Region& clip, GLint textureName, const sp<const Buffer>& buffer, int transform) const void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const { const DisplayHardware& hw(graphicPlane(0).displayHardware()); const uint32_t fbHeight = hw.getHeight(); const State& s(drawingState()); const uint32_t width = buffer->width; const uint32_t height = buffer->height; // bind our texture validateTexture(textureName); validateTexture(texture.name); uint32_t width = texture.width; uint32_t height = texture.height; glEnable(GL_TEXTURE_2D); // Dithering... Loading Loading @@ -457,7 +457,9 @@ void LayerBase::drawWithOpenGL(const Region& clip, glMatrixMode(GL_TEXTURE); glLoadIdentity(); if (transform == HAL_TRANSFORM_ROT_90) { // the texture's source is rotated if (texture.transform == HAL_TRANSFORM_ROT_90) { // TODO: handle the other orientations glTranslatef(0, 1, 0); glRotatef(-90, 0, 0, 1); } Loading Loading @@ -518,13 +520,16 @@ void LayerBase::validateTexture(GLint textureName) const // this is currently done in loadTexture() below } void LayerBase::loadTexture(const Region& dirty, GLint textureName, const GGLSurface& t, GLuint& textureWidth, GLuint& textureHeight) const void LayerBase::loadTexture(Texture* texture, GLint textureName, const Region& dirty, const GGLSurface& t) const { // TODO: defer the actual texture reload until LayerBase::validateTexture // is called. texture->name = textureName; GLuint& textureWidth(texture->width); GLuint& textureHeight(texture->height); uint32_t flags = mFlags; glBindTexture(GL_TEXTURE_2D, textureName); Loading libs/surfaceflinger/LayerBase.h +18 −9 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ #include <stdint.h> #include <sys/types.h> #include <EGL/egl.h> #include <EGL/eglext.h> #include <private/ui/LayerState.h> #include <utils/RefBase.h> Loading Loading @@ -238,16 +241,22 @@ protected: GLuint createTexture() const; void drawWithOpenGL(const Region& clip, GLint textureName, const sp<const Buffer>& buffer, int transform = 0) const; struct Texture { Texture() : name(-1U), width(0), height(0), image(EGL_NO_IMAGE_KHR), transform(0), dirty(true) { } GLuint name; GLuint width; GLuint height; EGLImageKHR image; uint32_t transform; bool dirty; }; void clearWithOpenGL(const Region& clip) const; void drawWithOpenGL(const Region& clip, const Texture& texture) const; void loadTexture(Texture* texture, GLint textureName, const Region& dirty, const GGLSurface& t) const; void loadTexture(const Region& dirty, GLint textureName, const GGLSurface& t, GLuint& textureWidth, GLuint& textureHeight) const; sp<SurfaceFlinger> mFlinger; uint32_t mFlags; Loading libs/surfaceflinger/LayerBuffer.cpp +24 −26 Original line number Diff line number Diff line Loading @@ -276,8 +276,7 @@ bool LayerBuffer::Source::transformed() const { LayerBuffer::BufferSource::BufferSource(LayerBuffer& layer, const ISurface::BufferHeap& buffers) : Source(layer), mStatus(NO_ERROR), mBufferSize(0), mTextureName(-1U) : Source(layer), mStatus(NO_ERROR), mBufferSize(0) { if (buffers.heap == NULL) { // this is allowed, but in this case, it is illegal to receive Loading Loading @@ -321,8 +320,8 @@ LayerBuffer::BufferSource::BufferSource(LayerBuffer& layer, LayerBuffer::BufferSource::~BufferSource() { if (mTextureName != -1U) { glDeleteTextures(1, &mTextureName); if (mTexture.name != -1U) { glDeleteTextures(1, &mTexture.name); } } Loading Loading @@ -380,37 +379,36 @@ bool LayerBuffer::BufferSource::transformed() const void LayerBuffer::BufferSource::onDraw(const Region& clip) const { // FIXME: we should get a native buffer here /* sp<Buffer> ourBbuffer(getBuffer()); if (UNLIKELY(buffer == 0)) { sp<Buffer> ourBuffer(getBuffer()); if (UNLIKELY(ourBuffer == 0)) { // nothing to do, we don't have a buffer mLayer.clearWithOpenGL(clip); return; } // FIXME: We should model this after the overlay stuff if (UNLIKELY(mTextureName == -1LU)) { mTextureName = mLayer.createTexture(); } // FIXME: Use EGLImage extension for this const NativeBuffer& src( ourBuffer->getBuffer() ); GGLSurface t; status_t res = buffer->lock(&t, GRALLOC_USAGE_SW_READ_RARELY); if (res == NO_ERROR) { //if (!can_use_copybit || err) { // OpenGL fall-back if (UNLIKELY(mTexture.name == -1LU)) { mTexture.name = mLayer.createTexture(); } GLuint w = 0; GLuint h = 0; const Region dirty(Rect(buffer->width, buffer->height)); mLayer.loadTexture(dirty, mTextureName, t, w, h); buffer->unlock(); } if (res == NO_ERROR) { mLayer.drawWithOpenGL(clip, mTextureName, buffer, mBufferHeap.transform); GGLSurface t; t.version = sizeof(GGLSurface); t.width = src.crop.r; t.height = src.crop.b; t.stride = src.img.w; t.vstride= src.img.h; t.format = src.img.format; t.data = (GGLubyte*)(intptr_t(src.img.base) + src.img.offset); const Region dirty(Rect(t.width, t.height)); mLayer.loadTexture(&mTexture, mTexture.name, dirty, t); mTexture.transform = mBufferHeap.transform; mLayer.drawWithOpenGL(clip, mTexture); } */ } Loading Loading
libs/surfaceflinger/Layer.cpp +5 −7 Original line number Diff line number Diff line Loading @@ -188,6 +188,8 @@ void Layer::reloadTexture(const Region& dirty) } else { // Everything went okay! mTextures[index].dirty = false; mTextures[index].width = clientBuf->width; mTextures[index].height = clientBuf->height; } } } Loading @@ -200,8 +202,7 @@ void Layer::reloadTexture(const Region& dirty) if (UNLIKELY(mTextures[0].name == -1U)) { mTextures[0].name = createTexture(); } loadTexture(dirty, mTextures[0].name, t, mTextures[0].width, mTextures[0].height); loadTexture(&mTextures[0], mTextures[0].name, dirty, t); buffer->unlock(); } } Loading @@ -222,10 +223,7 @@ void Layer::onDraw(const Region& clip) const clearWithOpenGL(clip); return; } GGLSurface t; sp<const Buffer> buffer(frontBuffer().getBuffer()); drawWithOpenGL(clip, textureName, buffer); drawWithOpenGL(clip, mTextures[index]); } sp<SurfaceBuffer> Layer::peekBuffer() Loading
libs/surfaceflinger/Layer.h +0 −10 Original line number Diff line number Diff line Loading @@ -123,16 +123,6 @@ private: }; friend class SurfaceLayer; struct Texture { Texture() : name(-1U), width(0), height(0), image(EGL_NO_IMAGE_KHR), dirty(true) { } GLuint name; GLuint width; GLuint height; EGLImageKHR image; bool dirty; }; sp<Surface> mSurface; bool mSecure; Loading
libs/surfaceflinger/LayerBase.cpp +14 −9 Original line number Diff line number Diff line Loading @@ -380,17 +380,17 @@ void LayerBase::clearWithOpenGL(const Region& clip) const } } void LayerBase::drawWithOpenGL(const Region& clip, GLint textureName, const sp<const Buffer>& buffer, int transform) const void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const { const DisplayHardware& hw(graphicPlane(0).displayHardware()); const uint32_t fbHeight = hw.getHeight(); const State& s(drawingState()); const uint32_t width = buffer->width; const uint32_t height = buffer->height; // bind our texture validateTexture(textureName); validateTexture(texture.name); uint32_t width = texture.width; uint32_t height = texture.height; glEnable(GL_TEXTURE_2D); // Dithering... Loading Loading @@ -457,7 +457,9 @@ void LayerBase::drawWithOpenGL(const Region& clip, glMatrixMode(GL_TEXTURE); glLoadIdentity(); if (transform == HAL_TRANSFORM_ROT_90) { // the texture's source is rotated if (texture.transform == HAL_TRANSFORM_ROT_90) { // TODO: handle the other orientations glTranslatef(0, 1, 0); glRotatef(-90, 0, 0, 1); } Loading Loading @@ -518,13 +520,16 @@ void LayerBase::validateTexture(GLint textureName) const // this is currently done in loadTexture() below } void LayerBase::loadTexture(const Region& dirty, GLint textureName, const GGLSurface& t, GLuint& textureWidth, GLuint& textureHeight) const void LayerBase::loadTexture(Texture* texture, GLint textureName, const Region& dirty, const GGLSurface& t) const { // TODO: defer the actual texture reload until LayerBase::validateTexture // is called. texture->name = textureName; GLuint& textureWidth(texture->width); GLuint& textureHeight(texture->height); uint32_t flags = mFlags; glBindTexture(GL_TEXTURE_2D, textureName); Loading
libs/surfaceflinger/LayerBase.h +18 −9 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ #include <stdint.h> #include <sys/types.h> #include <EGL/egl.h> #include <EGL/eglext.h> #include <private/ui/LayerState.h> #include <utils/RefBase.h> Loading Loading @@ -238,16 +241,22 @@ protected: GLuint createTexture() const; void drawWithOpenGL(const Region& clip, GLint textureName, const sp<const Buffer>& buffer, int transform = 0) const; struct Texture { Texture() : name(-1U), width(0), height(0), image(EGL_NO_IMAGE_KHR), transform(0), dirty(true) { } GLuint name; GLuint width; GLuint height; EGLImageKHR image; uint32_t transform; bool dirty; }; void clearWithOpenGL(const Region& clip) const; void drawWithOpenGL(const Region& clip, const Texture& texture) const; void loadTexture(Texture* texture, GLint textureName, const Region& dirty, const GGLSurface& t) const; void loadTexture(const Region& dirty, GLint textureName, const GGLSurface& t, GLuint& textureWidth, GLuint& textureHeight) const; sp<SurfaceFlinger> mFlinger; uint32_t mFlags; Loading
libs/surfaceflinger/LayerBuffer.cpp +24 −26 Original line number Diff line number Diff line Loading @@ -276,8 +276,7 @@ bool LayerBuffer::Source::transformed() const { LayerBuffer::BufferSource::BufferSource(LayerBuffer& layer, const ISurface::BufferHeap& buffers) : Source(layer), mStatus(NO_ERROR), mBufferSize(0), mTextureName(-1U) : Source(layer), mStatus(NO_ERROR), mBufferSize(0) { if (buffers.heap == NULL) { // this is allowed, but in this case, it is illegal to receive Loading Loading @@ -321,8 +320,8 @@ LayerBuffer::BufferSource::BufferSource(LayerBuffer& layer, LayerBuffer::BufferSource::~BufferSource() { if (mTextureName != -1U) { glDeleteTextures(1, &mTextureName); if (mTexture.name != -1U) { glDeleteTextures(1, &mTexture.name); } } Loading Loading @@ -380,37 +379,36 @@ bool LayerBuffer::BufferSource::transformed() const void LayerBuffer::BufferSource::onDraw(const Region& clip) const { // FIXME: we should get a native buffer here /* sp<Buffer> ourBbuffer(getBuffer()); if (UNLIKELY(buffer == 0)) { sp<Buffer> ourBuffer(getBuffer()); if (UNLIKELY(ourBuffer == 0)) { // nothing to do, we don't have a buffer mLayer.clearWithOpenGL(clip); return; } // FIXME: We should model this after the overlay stuff if (UNLIKELY(mTextureName == -1LU)) { mTextureName = mLayer.createTexture(); } // FIXME: Use EGLImage extension for this const NativeBuffer& src( ourBuffer->getBuffer() ); GGLSurface t; status_t res = buffer->lock(&t, GRALLOC_USAGE_SW_READ_RARELY); if (res == NO_ERROR) { //if (!can_use_copybit || err) { // OpenGL fall-back if (UNLIKELY(mTexture.name == -1LU)) { mTexture.name = mLayer.createTexture(); } GLuint w = 0; GLuint h = 0; const Region dirty(Rect(buffer->width, buffer->height)); mLayer.loadTexture(dirty, mTextureName, t, w, h); buffer->unlock(); } if (res == NO_ERROR) { mLayer.drawWithOpenGL(clip, mTextureName, buffer, mBufferHeap.transform); GGLSurface t; t.version = sizeof(GGLSurface); t.width = src.crop.r; t.height = src.crop.b; t.stride = src.img.w; t.vstride= src.img.h; t.format = src.img.format; t.data = (GGLubyte*)(intptr_t(src.img.base) + src.img.offset); const Region dirty(Rect(t.width, t.height)); mLayer.loadTexture(&mTexture, mTexture.name, dirty, t); mTexture.transform = mBufferHeap.transform; mLayer.drawWithOpenGL(clip, mTexture); } */ } Loading