Merge "drm_hwcomposer: Don't pass hwc_procs_t to VsyncWorker"
am: 57b56d03f6
Change-Id: I5103fda1c9735237e6929f2a3f171230a75956f8
diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index 92323b6..5da9152 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -191,6 +191,16 @@
void DrmDisplayCompositor::FrameWorker::QueueFrame(
std::unique_ptr<DrmDisplayComposition> composition, int status) {
Lock();
+
+ // Block queue if it gets too large. Otherwise composition will
+ // start stacking up and eat limited resources (file descriptors)
+ // allocated for these.
+ while (frame_queue_.size() >= DRM_DISPLAY_COMPOSITOR_MAX_QUEUE_DEPTH) {
+ Unlock();
+ sched_yield();
+ Lock();
+ }
+
FrameState frame;
frame.composition = std::move(composition);
frame.status = status;
diff --git a/drmeventlistener.cpp b/drmeventlistener.cpp
index 0514aa6..2607eef 100644
--- a/drmeventlistener.cpp
+++ b/drmeventlistener.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <assert.h>
+
#define LOG_TAG "hwc-drm-event-listener"
#include "drmeventlistener.h"