Revert "drm_hwcomposer: have DrmDisplayCompositor do its own OpenGL composition"
This reverts commit 2317bb19d8663efc31e6fcd8cf7fd2a73577253d.
For now until we figure out a more stable SF/hwc
Change-Id: Ia5ca089610a487bf036a1ddd5fb62e504e02ad98
diff --git a/drmcomposition.cpp b/drmcomposition.cpp
index f4e8d9d..805fd26 100644
--- a/drmcomposition.cpp
+++ b/drmcomposition.cpp
@@ -63,9 +63,26 @@
return 0;
}
-unsigned DrmComposition::GetRemainingLayers(int /*display*/,
+unsigned DrmComposition::GetRemainingLayers(int display,
unsigned num_needed) const {
- return num_needed;
+ DrmCrtc *crtc = drm_->GetCrtcForDisplay(display);
+ if (!crtc) {
+ ALOGE("Failed to find crtc for display %d", display);
+ return 0;
+ }
+
+ unsigned num_planes = 0;
+ for (std::vector<DrmPlane *>::const_iterator iter = primary_planes_.begin();
+ iter != primary_planes_.end(); ++iter) {
+ if ((*iter)->GetCrtcSupported(*crtc))
+ ++num_planes;
+ }
+ for (std::vector<DrmPlane *>::const_iterator iter = overlay_planes_.begin();
+ iter != overlay_planes_.end(); ++iter) {
+ if ((*iter)->GetCrtcSupported(*crtc))
+ ++num_planes;
+ }
+ return std::min(num_planes, num_needed);
}
int DrmComposition::AddLayer(int display, hwc_layer_1_t *layer,
@@ -94,6 +111,10 @@
break;
}
}
+ if (!plane) {
+ ALOGE("Failed to find plane for display %d", display);
+ return -ENOENT;
+ }
return composition_map_[display]->AddLayer(layer, bo, crtc, plane);
}