summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Prathmesh Prabhu <pprabhu@google.com> 2016-03-10 19:51:59 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-03-10 19:52:00 +0000
commitc334549ae303be666a9008d7364cd388e18ea448 (patch)
treee1a0c2aa2bffd8c1ba2456bdd8fe3ad4aa92663d
parent91531884ddca48dcec107860ac263e88603a0af3 (diff)
parentf3209b03b3adbf6868c2dcadb07adc5f865f5688 (diff)
Merge "Do not queue trivial buffer for unsupported screenshot request." into nyc-dev
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp8
-rw-r--r--services/surfaceflinger/SurfaceFlinger_hwc1.cpp8
2 files changed, 12 insertions, 4 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index db03c23b36..3a0e21fb76 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3440,14 +3440,18 @@ status_t SurfaceFlinger::captureScreenImplLocked(
} else {
ALOGE("got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot");
result = INVALID_OPERATION;
+ window->cancelBuffer(window, buffer, syncFd);
+ buffer = NULL;
}
// destroy our image
eglDestroyImageKHR(mEGLDisplay, image);
} else {
result = BAD_VALUE;
}
- // queueBuffer takes ownership of syncFd
- result = window->queueBuffer(window, buffer, syncFd);
+ if (buffer) {
+ // queueBuffer takes ownership of syncFd
+ result = window->queueBuffer(window, buffer, syncFd);
+ }
}
} else {
result = BAD_VALUE;
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index 16332f34cd..d864874a55 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -3478,14 +3478,18 @@ status_t SurfaceFlinger::captureScreenImplLocked(
} else {
ALOGE("got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot");
result = INVALID_OPERATION;
+ window->cancelBuffer(window, buffer, syncFd);
+ buffer = NULL;
}
// destroy our image
eglDestroyImageKHR(mEGLDisplay, image);
} else {
result = BAD_VALUE;
}
- // queueBuffer takes ownership of syncFd
- result = window->queueBuffer(window, buffer, syncFd);
+ if (buffer) {
+ // queueBuffer takes ownership of syncFd
+ result = window->queueBuffer(window, buffer, syncFd);
+ }
}
} else {
result = BAD_VALUE;