diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/kmstest.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/kmstest.py b/tests/kmstest.py index 14e28cd..cecaaaf 100755 --- a/tests/kmstest.py +++ b/tests/kmstest.py @@ -258,15 +258,22 @@ class AtomicRequest(pykms.AtomicReq): self.__test = test self.__props = {} + def __format_props(self, props): + # Convert negative values to a 64-bit unsigned integer as required + # by the bindings for AtomicRequest::add(). + return {k: v & ((1 << 64) - 1) for k, v in props.items()} + def add(self, obj, *kwargs): if obj.id not in self.__props: self.__props[obj.id] = {} - props = self.__props[obj.id] + obj_props = self.__props[obj.id] if len(kwargs) == 1 and isinstance(kwargs[0], collections.abc.Mapping): - props.update(kwargs[0]) + props = self.__format_props(kwargs[0]) elif len(kwargs) == 2: - props[kwargs[0]] = kwargs[1] + props = self.__format_props({ kwargs[0]: = kwargs[1] }) + + obj_props.update(props) super().add(obj, *kwargs) @@ -309,9 +316,6 @@ class KMSTest(object): def __del__(self): self.logger.close() - def __format_props(self, props): - return {k: v & ((1 << 64) - 1) for k, v in props.items()} - def atomic_crtc_disable(self, crtc, sync=True): req = AtomicRequest(self) req.add(crtc, {'ACTIVE': 0, 'MODE_ID': 0}) @@ -368,7 +372,7 @@ class KMSTest(object): def atomic_plane_set(self, plane, crtc, source, destination, fb, sync=False): req = AtomicRequest(self) - req.add(plane, self.__format_props({ + req.add(plane, { 'FB_ID': fb.id, 'CRTC_ID': crtc.id, 'SRC_X': int(source.left * 65536), @@ -379,7 +383,7 @@ class KMSTest(object): 'CRTC_Y': destination.top, 'CRTC_W': destination.width, 'CRTC_H': destination.height, - })) + }) if sync: return req.commit_sync() else: |