From 0c6b5f6ec38b14add24c44360aa60d91ab61ff34 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 27 Apr 2009 18:50:06 -0700 Subject: fix 1803886 android15 Translucent GLSurfaceView demo does not display properly --- libs/surfaceflinger/GPUHardware/GPUHardware.cpp | 6 +++++- libs/surfaceflinger/Layer.cpp | 2 +- libs/surfaceflinger/SurfaceFlinger.cpp | 14 ++++++++++++-- libs/surfaceflinger/VRamHeap.cpp | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) (limited to 'libs/surfaceflinger') diff --git a/libs/surfaceflinger/GPUHardware/GPUHardware.cpp b/libs/surfaceflinger/GPUHardware/GPUHardware.cpp index eb75f99..7168bf2 100644 --- a/libs/surfaceflinger/GPUHardware/GPUHardware.cpp +++ b/libs/surfaceflinger/GPUHardware/GPUHardware.cpp @@ -573,7 +573,11 @@ void GPUHardware::binderDied(const wp& who) sp GPUFactory::getGPU() { - return new GPUHardware(); + sp gpu; + if (access("/dev/hw3d", F_OK) == 0) { + gpu = new GPUHardware(); + } + return gpu; } // --------------------------------------------------------------------------- diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index f65d669..96395a8 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -108,7 +108,7 @@ status_t Layer::setBuffers( Client* client, // we always force a 4-byte aligned bpr. uint32_t alignment = 1; - if (flags & ISurfaceComposer::eGPU) { + if ((flags & ISurfaceComposer::eGPU) && (mFlinger->getGPU() != 0)) { // FIXME: this value should come from the h/w alignment = 8; // FIXME: this is msm7201A specific, as its GPU only supports diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index de64f55..167a59b 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -241,6 +241,9 @@ sp SurfaceFlinger::getCblk() const status_t SurfaceFlinger::requestGPU(const sp& callback, gpu_info_t* gpu) { + if (mGPU == 0) + return INVALID_OPERATION; + IPCThreadState* ipc = IPCThreadState::self(); const int pid = ipc->getCallingPid(); status_t err = mGPU->request(pid, callback, gpu); @@ -249,6 +252,9 @@ status_t SurfaceFlinger::requestGPU(const sp& callback, status_t SurfaceFlinger::revokeGPU() { + if (mGPU == 0) + return INVALID_OPERATION; + return mGPU->friendlyRevoke(); } @@ -1600,10 +1606,14 @@ status_t SurfaceFlinger::onTransact( } return NO_ERROR; case 1005: // ask GPU revoke - mGPU->friendlyRevoke(); + if (mGPU != 0) { + mGPU->friendlyRevoke(); + } return NO_ERROR; case 1006: // revoke GPU - mGPU->unconditionalRevoke(); + if (mGPU != 0) { + mGPU->unconditionalRevoke(); + } return NO_ERROR; case 1007: // set mFreezeCount mFreezeCount = data.readInt32(); diff --git a/libs/surfaceflinger/VRamHeap.cpp b/libs/surfaceflinger/VRamHeap.cpp index 0ccd71f..238c602 100644 --- a/libs/surfaceflinger/VRamHeap.cpp +++ b/libs/surfaceflinger/VRamHeap.cpp @@ -98,7 +98,7 @@ sp SurfaceHeapManager::createHeap( } } - if (flags & ISurfaceComposer::eGPU) { + if ((flags & ISurfaceComposer::eGPU) && (mFlinger->getGPU() != 0)) { // FIXME: this is msm7201A specific, where gpu surfaces may not be secure if (!(flags & ISurfaceComposer::eSecure)) { // if GPU doesn't work, we try eHardware -- cgit v1.1