drm_hwcomposer: Add missing assert.h include
am: 15d6a22ad6
Change-Id: I220404e3d70396f602fd41e754a314a6dd54367a
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 1880549..ca9d7fc 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"