aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Firago <alexey_firago@mentor.com>2018-11-27 14:17:55 +0300
committerAlexey Firago <alexey_firago@mentor.com>2018-12-03 23:15:42 +0300
commitc385afe4f7e53c4d4eff1069e48454748c2de940 (patch)
tree97bd562f0380c1be256806dfed76b664c48ee9bc
parent18ec688fadef2319092389407f98bb1f377ef8d7 (diff)
downloaddrm_hwcomposer-c385afe4f7e53c4d4eff1069e48454748c2de940.tar.gz
drm_hwcomposer: platformhisi: Remove fake-importing
With CanImportBuffer() in place we don't need fake importing anymore. Buffers should be checked before supplied to ImportBuffer() and plane planner. Instead of fake importing return -EINVAL for non HW_FB buffers in ImportBuffer() and skip non HW_FB in planner. Additionally, return error from planner if we didn't emplace any layer to force client compositing. Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
-rw-r--r--platformhisi.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/platformhisi.cpp b/platformhisi.cpp
index c5cadf6..76fe1e7 100644
--- a/platformhisi.cpp
+++ b/platformhisi.cpp
@@ -78,10 +78,10 @@ int HisiImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) {
if (!hnd)
return -EINVAL;
- // We can't import these types of buffers, so pretend we did and rely on the
- // planner to skip them when choosing layers for planes
+ // We can't import these types of buffers.
+ // These buffers should have been filtered out with CanImportBuffer()
if (!(hnd->usage & GRALLOC_USAGE_HW_FB))
- return 0;
+ return -EINVAL;
uint32_t gem_handle;
int ret = drmPrimeFDToHandle(drm_->fd(), hnd->share_fd, &gem_handle);
@@ -151,9 +151,9 @@ class PlanStageHiSi : public Planner::PlanStage {
std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc *crtc,
std::vector<DrmPlane *> *planes) {
int layers_added = 0;
- int initial_layers = layers.size();
- // Fill up as many planes as we can with buffers that do not have HW_FB
- // usage
+ // Fill up as many DRM planes as we can with buffers that have HW_FB usage.
+ // Buffers without HW_FB should have been filtered out with
+ // CanImportBuffer(), if we meet one here, just skip it.
for (auto i = layers.begin(); i != layers.end(); i = layers.erase(i)) {
if (!(i->second->gralloc_buffer_usage & GRALLOC_USAGE_HW_FB))
continue;
@@ -169,14 +169,9 @@ class PlanStageHiSi : public Planner::PlanStage {
return ret;
}
}
- /*
- * If we only have one layer, but we didn't emplace anything, we
- * can run into trouble, as we might try to device composite a
- * buffer we fake-imported, which can cause things to jamb up.
- * So return an error in this case to ensure we force client
- * compositing.
- */
- if (!layers_added && (initial_layers <= 1))
+ // If we didn't emplace anything, return an error to ensure we force client
+ // compositing.
+ if (!layers_added)
return -EINVAL;
return 0;