From ded84bf2620313b701af9c88b0f6c6ada2c70eaa Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 6 Jun 2016 19:56:26 +0300 Subject: py: fix scripts when there's no current crtc --- py/helpers.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'py/helpers.py') diff --git a/py/helpers.py b/py/helpers.py index fd67d41..e92163c 100644 --- a/py/helpers.py +++ b/py/helpers.py @@ -52,3 +52,15 @@ def disable_planes(card): if areq.commit_sync() != 0: print("disabling planes failed") + +def get_crtc_for_connector(conn): + crtc = conn.get_current_crtc() + + if crtc != None: + return crtc + + for crtc in conn.get_possible_crtcs(): + if crtc.mode_valid == False: + return crtc + + raise RuntimeError("No free crtc found") -- cgit v1.2.3