summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-14 22:20:50 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-16 21:45:26 +0300
commit7881bfd6586bd8ffa9b766cdba332c7a1015c9dd (patch)
tree1fe85dcc749aa5762ca342c2d94e28c245309efe
parent84d89b1659b6eb3e7707f2fe107b9cada516f053 (diff)
py: use ResourceManager
-rwxr-xr-xpy/alpha-test.py6
-rwxr-xr-xpy/db.py5
-rwxr-xr-xpy/functest.py7
-rwxr-xr-xpy/gamma.py6
-rw-r--r--py/helpers.py12
-rwxr-xr-xpy/iact.py7
-rwxr-xr-xpy/test.py7
-rwxr-xr-xpy/trans-test.py6
8 files changed, 21 insertions, 35 deletions
diff --git a/py/alpha-test.py b/py/alpha-test.py
index 113fab0..c6ec8ee 100755
--- a/py/alpha-test.py
+++ b/py/alpha-test.py
@@ -9,10 +9,10 @@ card = pykms.Card()
card = 0
card = pykms.Card()
-
-conn = card.get_first_connected_connector()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector()
+crtc = res.reserve_crtc(conn)
mode = conn.get_default_mode()
-crtc = get_crtc_for_connector(conn)
planes = []
for p in card.planes:
diff --git a/py/db.py b/py/db.py
index 6073765..3ffb716 100755
--- a/py/db.py
+++ b/py/db.py
@@ -41,9 +41,10 @@ class FlipHandler(pykms.PageFlipHandlerBase):
card = pykms.Card()
-conn = card.get_first_connected_connector()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector()
+crtc = res.reserve_crtc(conn)
mode = conn.get_default_mode()
-crtc = get_crtc_for_connector(conn)
fliphandler = FlipHandler()
diff --git a/py/functest.py b/py/functest.py
index c2548fa..44c29fb 100755
--- a/py/functest.py
+++ b/py/functest.py
@@ -4,16 +4,15 @@ import pykms
from helpers import *
card = pykms.Card()
-
-conn = card.get_first_connected_connector()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector()
+crtc = res.reserve_crtc(conn)
mode = conn.get_default_mode()
fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
pykms.draw_test_pattern(fb);
-crtc = get_crtc_for_connector(conn)
-
crtc.set_mode(conn, fb, mode)
print("OK")
diff --git a/py/gamma.py b/py/gamma.py
index e1daa43..a6b68cc 100755
--- a/py/gamma.py
+++ b/py/gamma.py
@@ -8,10 +8,10 @@ card = pykms.Card()
card = 0
card = pykms.Card()
-
-conn = card.get_first_connected_connector()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector()
+crtc = res.reserve_crtc(conn)
mode = conn.get_default_mode()
-crtc = get_crtc_for_connector(conn)
fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
pykms.draw_test_pattern(fb);
diff --git a/py/helpers.py b/py/helpers.py
index e92163c..fd67d41 100644
--- a/py/helpers.py
+++ b/py/helpers.py
@@ -52,15 +52,3 @@ 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")
diff --git a/py/iact.py b/py/iact.py
index 518dbfa..fecd899 100755
--- a/py/iact.py
+++ b/py/iact.py
@@ -9,16 +9,15 @@ from math import cos
from helpers import *
card = pykms.Card()
-
-conn = card.get_first_connected_connector()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector()
+crtc = res.reserve_crtc(conn)
mode = conn.get_default_mode()
fb = pykms.DumbFramebuffer(card, 200, 200, "XR24");
pykms.draw_test_pattern(fb);
-crtc = get_crtc_for_connector(conn)
-
#crtc.set_mode(conn, fb, mode)
i = 0
diff --git a/py/test.py b/py/test.py
index 7625f10..9c23b5b 100755
--- a/py/test.py
+++ b/py/test.py
@@ -4,16 +4,15 @@ import pykms
from helpers import *
card = pykms.Card()
-
-conn = card.get_first_connected_connector()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector()
+crtc = res.reserve_crtc(conn)
mode = conn.get_default_mode()
fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
pykms.draw_test_pattern(fb);
-crtc = get_crtc_for_connector(conn)
-
crtc.set_mode(conn, fb, mode)
input("press enter to exit\n")
diff --git a/py/trans-test.py b/py/trans-test.py
index e80802b..8c1f964 100755
--- a/py/trans-test.py
+++ b/py/trans-test.py
@@ -9,10 +9,10 @@ card = pykms.Card()
card = 0
card = pykms.Card()
-
-conn = card.get_first_connected_connector()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector()
+crtc = res.reserve_crtc(conn)
mode = conn.get_default_mode()
-crtc = get_crtc_for_connector(conn)
planes = []
for p in card.planes: