Loading libs/surfaceflinger/Layer.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -156,7 +156,11 @@ void Layer::reloadTexture(const Region& dirty) if (mFlags & DisplayHardware::DIRECT_TEXTURE) { if (buffer->usage & GraphicBuffer::USAGE_HW_TEXTURE) { if (mTextures[index].dirty) { initializeEglImage(buffer, &mTextures[index]); if (initializeEglImage(buffer, &mTextures[index]) != NO_ERROR) { // not sure what we can do here... mFlags &= ~DisplayHardware::DIRECT_TEXTURE; goto slowpath; } } } else { if (mHybridBuffer==0 || (mHybridBuffer->width != buffer->width || Loading @@ -166,8 +170,13 @@ void Layer::reloadTexture(const Region& dirty) buffer->width, buffer->height, buffer->format, GraphicBuffer::USAGE_SW_WRITE_OFTEN | GraphicBuffer::USAGE_HW_TEXTURE); initializeEglImage( mHybridBuffer, &mTextures[0]); if (initializeEglImage( mHybridBuffer, &mTextures[0]) != NO_ERROR) { // not sure what we can do here... mFlags &= ~DisplayHardware::DIRECT_TEXTURE; mHybridBuffer.clear(); goto slowpath; } } GGLSurface t; Loading Loading @@ -236,6 +245,7 @@ void Layer::reloadTexture(const Region& dirty) } else #endif { slowpath: for (size_t i=0 ; i<NUM_BUFFERS ; i++) { mTextures[i].image = EGL_NO_IMAGE_KHR; } Loading libs/surfaceflinger/LayerBase.cpp +2 −7 Original line number Diff line number Diff line Loading @@ -666,22 +666,15 @@ status_t LayerBase::initializeEglImage( dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, (EGLClientBuffer)clientBuf, attrs); LOGE_IF(texture->image == EGL_NO_IMAGE_KHR, "eglCreateImageKHR() failed. err=0x%4x", eglGetError()); if (texture->image != EGL_NO_IMAGE_KHR) { glBindTexture(GL_TEXTURE_2D, texture->name); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)texture->image); GLint error = glGetError(); if (UNLIKELY(error != GL_NO_ERROR)) { // this failed, for instance, because we don't support NPOT. // FIXME: do something! LOGE("layer=%p, glEGLImageTargetTexture2DOES(%p) " "failed err=0x%04x", this, texture->image, error); mFlags &= ~DisplayHardware::DIRECT_TEXTURE; err = INVALID_OPERATION; } else { // Everything went okay! Loading @@ -691,6 +684,8 @@ status_t LayerBase::initializeEglImage( texture->height = clientBuf->height; } } else { LOGE("layer=%p, eglCreateImageKHR() failed. err=0x%4x", this, eglGetError()); err = INVALID_OPERATION; } return err; Loading libs/surfaceflinger/LayerBuffer.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -261,7 +261,8 @@ sp<OverlayRef> LayerBuffer::SurfaceLayerBuffer::createOverlay( // LayerBuffer::Buffer // ============================================================================ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset, size_t bufferSize) : mBufferHeap(buffers), mSupportsCopybit(false) { NativeBuffer& src(mNativeBuffer); Loading @@ -280,7 +281,7 @@ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) if (module && module->perform) { int err = module->perform(module, GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER, buffers.heap->heapID(), buffers.heap->getSize(), buffers.heap->heapID(), bufferSize, offset, buffers.heap->base(), &src.img.handle); Loading Loading @@ -415,7 +416,7 @@ void LayerBuffer::BufferSource::postBuffer(ssize_t offset) sp<Buffer> buffer; if (buffers.heap != 0) { buffer = new LayerBuffer::Buffer(buffers, offset); buffer = new LayerBuffer::Buffer(buffers, offset, mBufferSize); if (buffer->getStatus() != NO_ERROR) buffer.clear(); setBuffer(buffer); Loading Loading @@ -469,6 +470,11 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) { err = INVALID_OPERATION; if (ourBuffer->supportsCopybit()) { // there are constraints on buffers used by the GPU and these may not // be honored here. We need to change the API so the buffers // are allocated with gralloc. For now disable this code-path #if 0 // First, try to use the buffer as an EGLImage directly if (mUseEGLImageDirectly) { // NOTE: Assume the buffer is allocated with the proper USAGE flags Loading @@ -483,6 +489,8 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const mUseEGLImageDirectly = false; } } #endif copybit_device_t* copybit = mLayer.mBlitEngine; if (copybit && err != NO_ERROR) { // create our EGLImageKHR the first time Loading libs/surfaceflinger/LayerBuffer.h +2 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,8 @@ private: class Buffer : public LightRefBase<Buffer> { public: Buffer(const ISurface::BufferHeap& buffers, ssize_t offset); Buffer(const ISurface::BufferHeap& buffers, ssize_t offset, size_t bufferSize); inline bool supportsCopybit() const { return mSupportsCopybit; } Loading Loading
libs/surfaceflinger/Layer.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -156,7 +156,11 @@ void Layer::reloadTexture(const Region& dirty) if (mFlags & DisplayHardware::DIRECT_TEXTURE) { if (buffer->usage & GraphicBuffer::USAGE_HW_TEXTURE) { if (mTextures[index].dirty) { initializeEglImage(buffer, &mTextures[index]); if (initializeEglImage(buffer, &mTextures[index]) != NO_ERROR) { // not sure what we can do here... mFlags &= ~DisplayHardware::DIRECT_TEXTURE; goto slowpath; } } } else { if (mHybridBuffer==0 || (mHybridBuffer->width != buffer->width || Loading @@ -166,8 +170,13 @@ void Layer::reloadTexture(const Region& dirty) buffer->width, buffer->height, buffer->format, GraphicBuffer::USAGE_SW_WRITE_OFTEN | GraphicBuffer::USAGE_HW_TEXTURE); initializeEglImage( mHybridBuffer, &mTextures[0]); if (initializeEglImage( mHybridBuffer, &mTextures[0]) != NO_ERROR) { // not sure what we can do here... mFlags &= ~DisplayHardware::DIRECT_TEXTURE; mHybridBuffer.clear(); goto slowpath; } } GGLSurface t; Loading Loading @@ -236,6 +245,7 @@ void Layer::reloadTexture(const Region& dirty) } else #endif { slowpath: for (size_t i=0 ; i<NUM_BUFFERS ; i++) { mTextures[i].image = EGL_NO_IMAGE_KHR; } Loading
libs/surfaceflinger/LayerBase.cpp +2 −7 Original line number Diff line number Diff line Loading @@ -666,22 +666,15 @@ status_t LayerBase::initializeEglImage( dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, (EGLClientBuffer)clientBuf, attrs); LOGE_IF(texture->image == EGL_NO_IMAGE_KHR, "eglCreateImageKHR() failed. err=0x%4x", eglGetError()); if (texture->image != EGL_NO_IMAGE_KHR) { glBindTexture(GL_TEXTURE_2D, texture->name); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)texture->image); GLint error = glGetError(); if (UNLIKELY(error != GL_NO_ERROR)) { // this failed, for instance, because we don't support NPOT. // FIXME: do something! LOGE("layer=%p, glEGLImageTargetTexture2DOES(%p) " "failed err=0x%04x", this, texture->image, error); mFlags &= ~DisplayHardware::DIRECT_TEXTURE; err = INVALID_OPERATION; } else { // Everything went okay! Loading @@ -691,6 +684,8 @@ status_t LayerBase::initializeEglImage( texture->height = clientBuf->height; } } else { LOGE("layer=%p, eglCreateImageKHR() failed. err=0x%4x", this, eglGetError()); err = INVALID_OPERATION; } return err; Loading
libs/surfaceflinger/LayerBuffer.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -261,7 +261,8 @@ sp<OverlayRef> LayerBuffer::SurfaceLayerBuffer::createOverlay( // LayerBuffer::Buffer // ============================================================================ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset, size_t bufferSize) : mBufferHeap(buffers), mSupportsCopybit(false) { NativeBuffer& src(mNativeBuffer); Loading @@ -280,7 +281,7 @@ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) if (module && module->perform) { int err = module->perform(module, GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER, buffers.heap->heapID(), buffers.heap->getSize(), buffers.heap->heapID(), bufferSize, offset, buffers.heap->base(), &src.img.handle); Loading Loading @@ -415,7 +416,7 @@ void LayerBuffer::BufferSource::postBuffer(ssize_t offset) sp<Buffer> buffer; if (buffers.heap != 0) { buffer = new LayerBuffer::Buffer(buffers, offset); buffer = new LayerBuffer::Buffer(buffers, offset, mBufferSize); if (buffer->getStatus() != NO_ERROR) buffer.clear(); setBuffer(buffer); Loading Loading @@ -469,6 +470,11 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) { err = INVALID_OPERATION; if (ourBuffer->supportsCopybit()) { // there are constraints on buffers used by the GPU and these may not // be honored here. We need to change the API so the buffers // are allocated with gralloc. For now disable this code-path #if 0 // First, try to use the buffer as an EGLImage directly if (mUseEGLImageDirectly) { // NOTE: Assume the buffer is allocated with the proper USAGE flags Loading @@ -483,6 +489,8 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const mUseEGLImageDirectly = false; } } #endif copybit_device_t* copybit = mLayer.mBlitEngine; if (copybit && err != NO_ERROR) { // create our EGLImageKHR the first time Loading
libs/surfaceflinger/LayerBuffer.h +2 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,8 @@ private: class Buffer : public LightRefBase<Buffer> { public: Buffer(const ISurface::BufferHeap& buffers, ssize_t offset); Buffer(const ISurface::BufferHeap& buffers, ssize_t offset, size_t bufferSize); inline bool supportsCopybit() const { return mSupportsCopybit; } Loading