fix [2363506] [Sapphire] Video playback broken

don't try to use copybit for incompatible buffers
This commit is contained in:
Mathias Agopian 2010-01-20 13:24:14 -08:00
parent 084e7c4ee8
commit 1faed66086
2 changed files with 8 additions and 6 deletions

View File

@ -261,7 +261,7 @@ sp<OverlayRef> LayerBuffer::SurfaceLayerBuffer::createOverlay(
// ============================================================================ // ============================================================================
LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset)
: mBufferHeap(buffers) : mBufferHeap(buffers), mSupportsCopybit(false)
{ {
NativeBuffer& src(mNativeBuffer); NativeBuffer& src(mNativeBuffer);
src.crop.l = 0; src.crop.l = 0;
@ -283,10 +283,8 @@ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset)
offset, buffers.heap->base(), offset, buffers.heap->base(),
&src.img.handle); &src.img.handle);
LOGE_IF(err, "CREATE_HANDLE_FROM_BUFFER (heapId=%d, size=%d, " // we can fail here is the passed buffer is purely software
"offset=%ld, base=%p) failed (%s)", mSupportsCopybit = (err == NO_ERROR);
buffers.heap->heapID(), buffers.heap->getSize(),
offset, buffers.heap->base(), strerror(-err));
} }
} }
@ -453,7 +451,7 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const
#if defined(EGL_ANDROID_image_native_buffer) #if defined(EGL_ANDROID_image_native_buffer)
if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) { if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) {
copybit_device_t* copybit = mLayer.mBlitEngine; copybit_device_t* copybit = mLayer.mBlitEngine;
if (copybit) { if (copybit && ourBuffer->supportsCopybit()) {
// create our EGLImageKHR the first time // create our EGLImageKHR the first time
err = initTempBuffer(); err = initTempBuffer();
if (err == NO_ERROR) { if (err == NO_ERROR) {

View File

@ -99,6 +99,9 @@ private:
class Buffer : public LightRefBase<Buffer> { class Buffer : public LightRefBase<Buffer> {
public: public:
Buffer(const ISurface::BufferHeap& buffers, ssize_t offset); Buffer(const ISurface::BufferHeap& buffers, ssize_t offset);
inline bool supportsCopybit() const {
return mSupportsCopybit;
}
inline status_t getStatus() const { inline status_t getStatus() const {
return mBufferHeap.heap!=0 ? NO_ERROR : NO_INIT; return mBufferHeap.heap!=0 ? NO_ERROR : NO_INIT;
} }
@ -113,6 +116,7 @@ private:
private: private:
ISurface::BufferHeap mBufferHeap; ISurface::BufferHeap mBufferHeap;
NativeBuffer mNativeBuffer; NativeBuffer mNativeBuffer;
bool mSupportsCopybit;
}; };
class BufferSource : public Source { class BufferSource : public Source {