From 1faed6608655409cdd9c703cdbceedc03cb40bde Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 20 Jan 2010 13:24:14 -0800 Subject: [PATCH] fix [2363506] [Sapphire] Video playback broken don't try to use copybit for incompatible buffers --- libs/surfaceflinger/LayerBuffer.cpp | 10 ++++------ libs/surfaceflinger/LayerBuffer.h | 4 ++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp index 2ff61673d..dbcb367a9 100644 --- a/libs/surfaceflinger/LayerBuffer.cpp +++ b/libs/surfaceflinger/LayerBuffer.cpp @@ -261,7 +261,7 @@ sp LayerBuffer::SurfaceLayerBuffer::createOverlay( // ============================================================================ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) - : mBufferHeap(buffers) + : mBufferHeap(buffers), mSupportsCopybit(false) { NativeBuffer& src(mNativeBuffer); src.crop.l = 0; @@ -283,10 +283,8 @@ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) offset, buffers.heap->base(), &src.img.handle); - LOGE_IF(err, "CREATE_HANDLE_FROM_BUFFER (heapId=%d, size=%d, " - "offset=%ld, base=%p) failed (%s)", - buffers.heap->heapID(), buffers.heap->getSize(), - offset, buffers.heap->base(), strerror(-err)); + // we can fail here is the passed buffer is purely software + mSupportsCopybit = (err == NO_ERROR); } } @@ -453,7 +451,7 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const #if defined(EGL_ANDROID_image_native_buffer) if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) { copybit_device_t* copybit = mLayer.mBlitEngine; - if (copybit) { + if (copybit && ourBuffer->supportsCopybit()) { // create our EGLImageKHR the first time err = initTempBuffer(); if (err == NO_ERROR) { diff --git a/libs/surfaceflinger/LayerBuffer.h b/libs/surfaceflinger/LayerBuffer.h index 2ca63aca7..90f83c4c1 100644 --- a/libs/surfaceflinger/LayerBuffer.h +++ b/libs/surfaceflinger/LayerBuffer.h @@ -99,6 +99,9 @@ private: class Buffer : public LightRefBase { public: Buffer(const ISurface::BufferHeap& buffers, ssize_t offset); + inline bool supportsCopybit() const { + return mSupportsCopybit; + } inline status_t getStatus() const { return mBufferHeap.heap!=0 ? NO_ERROR : NO_INIT; } @@ -113,6 +116,7 @@ private: private: ISurface::BufferHeap mBufferHeap; NativeBuffer mNativeBuffer; + bool mSupportsCopybit; }; class BufferSource : public Source {