drm.py: Find a card node that has CRTC resources
GPU card nodes have resources(), but do not contain any CRTC, and
therefore screenshot cannot be taken from these devices.
Make sure at least 1 CRTC is available before selecting a drm
card node.
BUG=chrome-os-partner:51788
TEST=Run display_Resolution.extended on elm
Change-Id: Ie5523a593d6dafa8409c3eefb68d06466a578b9d
Reviewed-on: https://chromium-review.googlesource.com/335676
Commit-Ready: Ilja Friedel <ihf@chromium.org>
Tested-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
diff --git a/client/cros/graphics/drm.py b/client/cros/graphics/drm.py
index 7739dc9..f5dfce7 100644
--- a/client/cros/graphics/drm.py
+++ b/client/cros/graphics/drm.py
@@ -394,7 +394,7 @@
paths = ["/dev/dri/" + n for n in os.listdir("/dev/dri")]
for p in paths:
d = drmFromPath(p)
- if d.resources():
+ if d.resources() and d.resources().count_crtcs > 0:
_drm = d
break