]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blob - py/tests/helpers.py
py: Reorganize source directory
[android/external-libkmsxx.git] / py / tests / helpers.py
1 import pykms
3 def add_props(areq, ob, map):
4     for key, value in map.items():
5         areq.add(ob, key, value)
7 def props(o):
8     o.refresh_props()
9     map = o.prop_map
10     for propid,propval in map.items():
11         prop = o.card.get_prop(propid)
12         print("%-15s %d (%#x)" % (prop.name, propval, propval))
14 def set_prop(ob, prop, value):
15     if ob.card.has_atomic:
16         areq = pykms.AtomicReq(ob.card)
17         areq.add(ob, prop, value)
18         if areq.commit_sync() != 0:
19             print("commit failed")
20     else:
21         if ob.set_prop_value(prop, value) != 0:
22             print("setting property failed")
24 def set_props(ob, map):
25     if ob.card.has_atomic:
26         areq = pykms.AtomicReq(ob.card)
28         for key, value in map.items():
29             areq.add(ob, key, value)
31         if areq.commit_sync() != 0:
32             print("commit failed")
33     else:
34         for propid,propval in map.items():
35             if ob.set_prop_value(propid, propval) != 0:
36                 print("setting property failed")
38 red = pykms.RGB(255, 0, 0)
39 green = pykms.RGB(0, 255, 0)
40 blue = pykms.RGB(0, 0, 255)
41 yellow = pykms.RGB(255, 255, 0)
42 purple = pykms.RGB(255, 0, 255)
43 white = pykms.RGB(255, 255, 255)
44 cyan = pykms.RGB(0, 255, 255)
46 def disable_planes(card):
47     areq = pykms.AtomicReq(card)
49     for p in card.planes:
50         areq.add(p, "FB_ID", 0)
51         areq.add(p, "CRTC_ID", 0)
53     if areq.commit_sync() != 0:
54         print("disabling planes failed")