From 70afa1a51f4ffc4db404514af0b2990b23d56fee Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 10 Jun 2022 02:34:00 +0300 Subject: tests: Rename kms-test-planeposition.py to kms-test-plane-position.py Match the name scheme of other tests by renaming kms-test-planeposition.py to kms-test-plane-position.py. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- tests/kms-test-plane-position.py | 126 +++++++++++++++++++++++++++++++++++++++ tests/kms-test-planeposition.py | 126 --------------------------------------- 2 files changed, 126 insertions(+), 126 deletions(-) create mode 100755 tests/kms-test-plane-position.py delete mode 100755 tests/kms-test-planeposition.py diff --git a/tests/kms-test-plane-position.py b/tests/kms-test-plane-position.py new file mode 100755 index 0000000..aceb849 --- /dev/null +++ b/tests/kms-test-plane-position.py @@ -0,0 +1,126 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: 2017-2019 Renesas Electronics Corporation + +import kmstest +import pykms +import time + +class PlanePositionTest(kmstest.KMSTest): + """Test boundaries of plane positioning.""" + + def main(self): + self.start('plane positioning boundaries') + + # Find a CRTC with a connected connector and at least two planes + for connector in self.output_connectors(): + if not connector.connected(): + self.skip('unconnected connector') + continue + + try: + mode = connector.get_default_mode() + except ValueError: + continue + + crtcs = connector.get_possible_crtcs() + for crtc in crtcs: + planes = [] + for plane in self.card.planes: + if plane.supports_crtc(crtc): + planes.append(plane) + + if len(planes) > 1: + break + else: + crtc = None + + if crtc: + break + + else: + self.skip('no CRTC available with connector and at least two planes') + return + + self.logger.log(f'Testing connector {connector.fullname}, CRTC {crtc.id}, ' + f'mode {mode.name} with {len(planes)} planes') + + # Create a frame buffer + fb = pykms.DumbFramebuffer(self.card, mode.hdisplay, mode.vdisplay, 'XR24') + pykms.draw_test_pattern(fb) + + # Set the mode with no plane, wait 5s for the monitor to wake up + ret = self.atomic_crtc_mode_set(crtc, connector, mode, sync=True) + if ret < 0: + self.fail(f'atomic mode set failed with {ret}') + return + + self.logger.log('Initial atomic mode set completed') + time.sleep(5) + + # Add the first plane to cover half of the CRTC + source = kmstest.Rect(0, 0, fb.width // 2, fb.height) + destination = kmstest.Rect(0, 0, fb.width // 2, fb.height) + ret = self.atomic_plane_set(planes[0], crtc, source, destination, fb, sync=True) + if ret < 0: + self.fail(f'atomic plane set for first plane failed with {ret}') + return + + self.logger.log('Root plane enabled') + time.sleep(3) + + # Add the second plane and move it around to cross all CRTC boundaries + offsets = ((50, 50), (150, 50), (50, 150), (-50, 50), (50, -50)) + for offset in offsets: + width = fb.width - 100 + height = fb.height - 100 + source = kmstest.Rect(0, 0, width, height) + destination = kmstest.Rect(offset[0], offset[1], width, height) + + ret = self.atomic_plane_set(planes[1], crtc, source, destination, fb, sync=True) + if ret < 0: + self.fail(f'atomic plane set with offset {offset}') + return + + self.logger.log(f'Moved overlay plane to {offset}') + time.sleep(3) + + # Try to move the plane completely off-screen. The device is expected + # to accept this and not to show the plane on the screen. + offsets = ((mode.hdisplay, 50), (50, mode.vdisplay), + (-mode.hdisplay, 50), (50, -mode.vdisplay)) + for offset in offsets: + width = fb.width - 100 + height = fb.height - 100 + source = kmstest.Rect(0, 0, width, height) + destination = kmstest.Rect(offset[0], offset[1], width, height) + + ret = self.atomic_plane_set(planes[1], crtc, source, destination, fb, sync=True) + if ret < 0: + self.fail(f'atomic plane set with offset {offset}') + return + + self.logger.log(f'Moved overlay plane to {offset}') + time.sleep(3) + + # Disable and re-enable the plane when it is off-screen. The device is + # still expected to handle this gracefully. + ret = self.atomic_plane_disable(planes[1]) + if ret < 0: + self.fail('off-screen atomic plane disable failed') + return + + width = fb.width - 100 + height = fb.height - 100 + source = kmstest.Rect(0, 0, width, height) + destination = kmstest.Rect(mode.hdisplay, 50, width, height) + + ret = self.atomic_plane_set(planes[1], crtc, source, destination, fb, sync=True) + if ret < 0: + self.fail('off-scrren atomic plane enable failed') + return + + self.atomic_crtc_disable(crtc) + self.success() + +PlanePositionTest().execute() diff --git a/tests/kms-test-planeposition.py b/tests/kms-test-planeposition.py deleted file mode 100755 index aceb849..0000000 --- a/tests/kms-test-planeposition.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/python3 -# SPDX-License-Identifier: GPL-2.0-or-later -# SPDX-FileCopyrightText: 2017-2019 Renesas Electronics Corporation - -import kmstest -import pykms -import time - -class PlanePositionTest(kmstest.KMSTest): - """Test boundaries of plane positioning.""" - - def main(self): - self.start('plane positioning boundaries') - - # Find a CRTC with a connected connector and at least two planes - for connector in self.output_connectors(): - if not connector.connected(): - self.skip('unconnected connector') - continue - - try: - mode = connector.get_default_mode() - except ValueError: - continue - - crtcs = connector.get_possible_crtcs() - for crtc in crtcs: - planes = [] - for plane in self.card.planes: - if plane.supports_crtc(crtc): - planes.append(plane) - - if len(planes) > 1: - break - else: - crtc = None - - if crtc: - break - - else: - self.skip('no CRTC available with connector and at least two planes') - return - - self.logger.log(f'Testing connector {connector.fullname}, CRTC {crtc.id}, ' - f'mode {mode.name} with {len(planes)} planes') - - # Create a frame buffer - fb = pykms.DumbFramebuffer(self.card, mode.hdisplay, mode.vdisplay, 'XR24') - pykms.draw_test_pattern(fb) - - # Set the mode with no plane, wait 5s for the monitor to wake up - ret = self.atomic_crtc_mode_set(crtc, connector, mode, sync=True) - if ret < 0: - self.fail(f'atomic mode set failed with {ret}') - return - - self.logger.log('Initial atomic mode set completed') - time.sleep(5) - - # Add the first plane to cover half of the CRTC - source = kmstest.Rect(0, 0, fb.width // 2, fb.height) - destination = kmstest.Rect(0, 0, fb.width // 2, fb.height) - ret = self.atomic_plane_set(planes[0], crtc, source, destination, fb, sync=True) - if ret < 0: - self.fail(f'atomic plane set for first plane failed with {ret}') - return - - self.logger.log('Root plane enabled') - time.sleep(3) - - # Add the second plane and move it around to cross all CRTC boundaries - offsets = ((50, 50), (150, 50), (50, 150), (-50, 50), (50, -50)) - for offset in offsets: - width = fb.width - 100 - height = fb.height - 100 - source = kmstest.Rect(0, 0, width, height) - destination = kmstest.Rect(offset[0], offset[1], width, height) - - ret = self.atomic_plane_set(planes[1], crtc, source, destination, fb, sync=True) - if ret < 0: - self.fail(f'atomic plane set with offset {offset}') - return - - self.logger.log(f'Moved overlay plane to {offset}') - time.sleep(3) - - # Try to move the plane completely off-screen. The device is expected - # to accept this and not to show the plane on the screen. - offsets = ((mode.hdisplay, 50), (50, mode.vdisplay), - (-mode.hdisplay, 50), (50, -mode.vdisplay)) - for offset in offsets: - width = fb.width - 100 - height = fb.height - 100 - source = kmstest.Rect(0, 0, width, height) - destination = kmstest.Rect(offset[0], offset[1], width, height) - - ret = self.atomic_plane_set(planes[1], crtc, source, destination, fb, sync=True) - if ret < 0: - self.fail(f'atomic plane set with offset {offset}') - return - - self.logger.log(f'Moved overlay plane to {offset}') - time.sleep(3) - - # Disable and re-enable the plane when it is off-screen. The device is - # still expected to handle this gracefully. - ret = self.atomic_plane_disable(planes[1]) - if ret < 0: - self.fail('off-screen atomic plane disable failed') - return - - width = fb.width - 100 - height = fb.height - 100 - source = kmstest.Rect(0, 0, width, height) - destination = kmstest.Rect(mode.hdisplay, 50, width, height) - - ret = self.atomic_plane_set(planes[1], crtc, source, destination, fb, sync=True) - if ret < 0: - self.fail('off-scrren atomic plane enable failed') - return - - self.atomic_crtc_disable(crtc) - self.success() - -PlanePositionTest().execute() -- cgit v1.2.3