am 0188eeff: Merge "only use glReadPixels() when needed when taking screenshots" into jb-mr2-dev

* commit '0188eeff1fecc3813ddb236be3e2b7a9ad156482':
  only use glReadPixels() when needed when taking screenshots
This commit is contained in:
Mathias Agopian 2013-03-22 00:18:27 +00:00 committed by Android Git Automerger
commit 5a120411f0
2 changed files with 9 additions and 4 deletions

View File

@ -109,6 +109,9 @@ SurfaceFlinger::SurfaceFlinger()
// debugging stuff... // debugging stuff...
char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX];
property_get("ro.bq.gpu_to_cpu_unsupported", value, "0");
mGpuToCpuSupported = !!atoi(value);
property_get("debug.sf.showupdates", value, "0"); property_get("debug.sf.showupdates", value, "0");
mDebugRegion = atoi(value); mDebugRegion = atoi(value);
@ -2546,15 +2549,16 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display,
virtual bool handler() { virtual bool handler() {
Mutex::Autolock _l(flinger->mStateLock); Mutex::Autolock _l(flinger->mStateLock);
sp<const DisplayDevice> hw(flinger->getDisplayDevice(display)); sp<const DisplayDevice> hw(flinger->getDisplayDevice(display));
// TODO: if we know the GL->CPU path works, we can call // When we know the GL->CPU path works, we can call
// captureScreenImplLocked() directly, instead of using the // captureScreenImplLocked() directly, instead of using the
// "CpuConsumer" version, which is much less efficient -- it is // "CpuConsumer" version, which is much less efficient -- it is
// however needed by some older drivers. // however needed by some older drivers.
if (isCpuConsumer) {
result = flinger->captureScreenImplCpuConsumerLocked(hw, if (flinger->mGpuToCpuSupported || !isCpuConsumer) {
result = flinger->captureScreenImplLocked(hw,
producer, reqWidth, reqHeight, minLayerZ, maxLayerZ); producer, reqWidth, reqHeight, minLayerZ, maxLayerZ);
} else { } else {
result = flinger->captureScreenImplLocked(hw, result = flinger->captureScreenImplCpuConsumerLocked(hw,
producer, reqWidth, reqHeight, minLayerZ, maxLayerZ); producer, reqWidth, reqHeight, minLayerZ, maxLayerZ);
} }
return true; return true;

View File

@ -412,6 +412,7 @@ private:
HWComposer* mHwc; HWComposer* mHwc;
GLuint mProtectedTexName; GLuint mProtectedTexName;
nsecs_t mBootTime; nsecs_t mBootTime;
bool mGpuToCpuSupported;
sp<EventThread> mEventThread; sp<EventThread> mEventThread;
GLint mMaxViewportDims[2]; GLint mMaxViewportDims[2];
GLint mMaxTextureSize; GLint mMaxTextureSize;