Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D drm-hwcomposer
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 13
    • Issues 13
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • drm-hwcomposer
  • drm-hwcomposer
  • Issues
  • #33
Closed
Open
Issue created Jun 21, 2020 by Adam Serbinski@aserbinski

Display freezing frequently, AOSP Master w/automotive on Dragonboard 820c

I've been working with db820c to get AOSP master w/automotive running well on it. The biggest issue I've been having with it is with regards to the display frequently locking up.

My work is all here; https://gitlab.com/aosp-automotive
My builds can be reproduces with instructions in the readme in this repository;
https://gitlab.com/aosp-automotive/pinned-manifests

The bulk of the issue has been related to the following line;
https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/blob/master/drmhwctwo.cpp#L973

Any time that conditional evaluates as TRUE, the display freezes for some period of time ranging from several seconds to permanently (requiring a reboot).

I've identified two situations where that conditional evaluates as TRUE on db820c;

  1. When the number of planes to be composited exceeds 6,
  2. When ValidatePlane fails here;
    https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/blob/master/platform/platform.cpp#L49

In the below patch, I've got 2 hacks, which together seem to eliminate the display freezes (and add some very noisy debug messages). Obviously, the patch is unsuited for inclusion in the project.

I'm not sure where to go from here. Obviously it would be nice to come up with a solution to the freezing that doesn't involve adding hacks.

From 9424274e9e5b980e06a82450e83505124f0f8254 Mon Sep 17 00:00:00 2001
Date: Sun, 21 Jun 2020 08:15:02 -0400
Subject: [PATCH] HACKS: stop display from freezing on db820c

drmhwctwo.cpp:
Limit maximum number of planes to 6.
- This avoids the kernel error:
[   76.351693] msm 900000.mdss: [drm:mdp5_crtc_atomic_check [msm]] *ERROR* too many planes! cnt=7, start stage=2

platform/platform.cpp:
Ignore "Alpha is not supported on plane X" error.
- This error caused drm compositing to abort, and the screen to freeze.

The errors were causing CreateComposition(true) to return failure,
which results in the screen freezing.

There is still an occasional freeze even with this, reason unknown, however,
it is fairly rare.

There are some color glitches observable in OsmAnd.

Change-Id: Ifb53455dd597723d62d1e3e5ff85babd43ff819e
---
 drmhwctwo.cpp         | 8 ++++++++
 platform/platform.cpp | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index 605406b..1cfe273 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -889,6 +889,7 @@ void DrmHwcTwo::HwcDisplay::MarkValidated(
     std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map, size_t client_first_z,
     size_t client_size) {
   for (std::pair<const uint32_t, DrmHwcTwo::HwcLayer *> &l : z_map) {
+    ALOGE("CDBG MarkValidated: z_map.size(): %zu, l.first: %u, client_first_z: %zd, client_size: %zu", z_map.size(), l.first, client_first_z, client_size);
     if (l.first >= client_first_z && l.first < client_first_z + client_size)
       l.second->set_validated_type(HWC2::Composition::Client);
     else
@@ -903,6 +904,10 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
   *num_requests = 0;
   size_t avail_planes = primary_planes_.size() + overlay_planes_.size();
 
+  ALOGE("CDBG avail_planes: %zd, primary_planes_.size(): %zd, overlay_planes_.size(): %zd", avail_planes, primary_planes_.size(), overlay_planes_.size());
+
+  if (avail_planes > 6) avail_planes = 6;
+
   /*
    * If more layers then planes, save one plane
    * for client composited layers
@@ -932,12 +937,14 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
         if (client_start < 0)
           client_start = l.first;
         client_size = (l.first - client_start) + 1;
+	ALOGE("CDBG unsupported layer: client_start: %d, client_size: %d", client_start, client_size);
       }
     }
 
     int extra_client = (z_map.size() - client_size) - avail_planes;
     if (extra_client > 0) {
       int start = 0, steps;
+      ALOGE("CDBG extra client: %d", extra_client);
       if (client_size != 0) {
         int prepend = std::min(client_start, extra_client);
         int append = std::min(int(z_map.size() - (client_start + client_size)),
@@ -964,6 +971,7 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
     MarkValidated(z_map, client_start, client_size);
 
     if (CreateComposition(true) != HWC2::Error::None) {
+      ALOGE("CDBG CreateComposition(true) failed");
       ++total_stats_.failed_kms_validate_;
       gpu_pixops = total_pixops;
       client_size = z_map.size();
diff --git a/platform/platform.cpp b/platform/platform.cpp
index b7a47c7..02e417c 100644
--- a/platform/platform.cpp
+++ b/platform/platform.cpp
@@ -48,7 +48,8 @@ int Planner::PlanStage::ValidatePlane(DrmPlane *plane, DrmHwcLayer *layer) {
 
   if (plane->alpha_property().id() == 0 && layer->alpha != 0xffff) {
     ALOGE("Alpha is not supported on plane %d", plane->id());
-    return -EINVAL;
+    //return -EINVAL;
+    layer->alpha = 0xffff;
   }
 
   if (plane->blend_property().id() == 0) {
-- 
2.21.0
Edited Jul 04, 2020 by Adam Serbinski
Assignee
Assign to
Time tracking