Commit ad493d60 authored by maurossi's avatar maurossi
Browse files

drm_hwcomposer: set primary display only if connected (v4)

Android-x86 supports one display which has to be connected, so when looking for
primary disaply we add check for condition 'conn->state() == DRM_MODE_CONNECTED'
we set found_primary flag only for connected display and skip the treatment of
additional displays.

(v2) Same logic but Changes in implementation due to following commits:
     0f5abd79 ("drm_hwcomposer: Rename DrmResources to DrmDevice")
     c5463587 ("drm_hwcomposer: Add resource manager support")

(v3) Due to commit 27cd4805 ("drm_hwcomposer: Organize files into subdirs")

(v4) Due to commit d07c3705

 ("drm_hwcomposer: Add property hwc.drm.primary_display_order")

This is essential to avoid following logcat errors on integrated and dedicated GPUs:

... 2245  2245 E hwc-drm-device: Could not find a suitable encoder/crtc for display 3
... 2245  2245 E hwc-drm-device: Failed CreateDisplayPipe 90 with -19

Tested with i965 on Skylake GT2, amdgpu on HD7790, RX560 and nouveau on GT610, GT1030

Signed-off-by: maurossi's avatarMauro Rossi <issor.oruam@gmail.com>
parent 0d1a2cdb
Pipeline #86390 passed with stage
in 27 seconds
......@@ -261,10 +261,12 @@ std::tuple<int, int> DrmDevice::Init(const char *path, int num_displays) {
primary_candidates = make_primary_display_candidates(connectors_);
if (!primary_candidates.empty() && !found_primary) {
DrmConnector &conn = **std::begin(primary_candidates);
conn.set_display(num_displays);
displays_[num_displays] = num_displays;
++num_displays;
found_primary = true;
if (conn.state() == DRM_MODE_CONNECTED) {
conn.set_display(num_displays);
displays_[num_displays] = num_displays;
++num_displays;
found_primary = true;
}
} else {
ALOGE(
"Failed to find primary display from \"hwc.drm.primary_display_order\" "
......@@ -274,7 +276,7 @@ std::tuple<int, int> DrmDevice::Init(const char *path, int num_displays) {
// If no priority display were found then pick first available as primary and
// for the others assign consecutive display_numbers.
for (auto &conn : connectors_) {
if (conn->external() || conn->internal()) {
if((conn->state() == DRM_MODE_CONNECTED) && (conn->external() || conn->internal()) {
if (!found_primary) {
conn->set_display(num_displays);
displays_[num_displays] = num_displays;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment