diff options
author | David Riley <davidriley@google.com> | 2015-11-20 22:24:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-11-20 22:24:09 +0000 |
commit | 4fdafe6d988b5cac91b5448e197891508b5e6e2d (patch) | |
tree | 64565ed4c0988f8c5984cb6a4afc0962df41ba2f /drmdisplaycompositor.cpp | |
parent | d4bd44dba3559738a0124a875a109ca11ec57acd (diff) | |
parent | 647beb27af04c33d415c75149c4c93d767693caf (diff) |
Merge "drm_hwcomposer: Check the composition before sending to frame worker" into mnc-dr-dev
Diffstat (limited to 'drmdisplaycompositor.cpp')
-rw-r--r-- | drmdisplaycompositor.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp index 07b4254..4a904b2 100644 --- a/drmdisplaycompositor.cpp +++ b/drmdisplaycompositor.cpp @@ -922,6 +922,25 @@ int DrmDisplayCompositor::Composite() { switch (composition->type()) { case DRM_COMPOSITION_TYPE_FRAME: ret = PrepareFrame(composition.get()); + if (ret) { + ALOGE("Failed to prepare frame for display %d", display_); + return ret; + } + // Send the composition to the kernel to ensure we can commit it. This is + // just a test, it won't actually commit the frame. If the kernel rejects + // it, squash the frame into one layer and use the squashed composition + ret = CommitFrame(composition.get(), true); + if (ret) { + ALOGI("Commit test failed, squashing frame for display %d", display_); + std::unique_ptr<DrmDisplayComposition> squashed = CreateComposition(); + ret = SquashFrame(composition.get(), squashed.get()); + if (!ret) { + composition = std::move(squashed); + } else { + ALOGE("Failed to squash frame for display %d", display_); + return ret; + } + } frame_worker_.QueueFrame(std::move(composition), ret); break; case DRM_COMPOSITION_TYPE_DPMS: |