Re: [kms-test] [PATCH 07/10] tests: Add plane alpha test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Laurent Pinchart (2022-06-10 00:40:28)
> Add a test that enables multiple planes with different alpha values.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> ---
>  tests/kms-test-plane-alpha.py | 97 +++++++++++++++++++++++++++++++++++
>  1 file changed, 97 insertions(+)
>  create mode 100755 tests/kms-test-plane-alpha.py
> 
> diff --git a/tests/kms-test-plane-alpha.py b/tests/kms-test-plane-alpha.py
> new file mode 100755
> index 000000000000..8802bfeae40c
> --- /dev/null
> +++ b/tests/kms-test-plane-alpha.py
> @@ -0,0 +1,97 @@
> +#!/usr/bin/python3
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# SPDX-FileCopyrightText: 2022 Renesas Electronics Corporation
> +
> +import kmstest
> +import pykms
> +
> +class PlaneAlphaTest(kmstest.KMSTest):
> +    """Test composition with multiple planes and alpha channels."""
> +
> +    def handle_page_flip(self, frame, time):
> +        self.logger.log('Page flip complete')
> +
> +    def find_pipeline(self):
> +        # Find a CRTC that has multiple planes with a connected connector
> +        for connector in self.output_connectors():
> +            # Skip disconnected connectors
> +            if not connector.connected():
> +                continue
> +
> +            # Add the connector to the map
> +            for crtc in connector.get_possible_crtcs():
> +                planes = []
> +                for plane in self.card.planes:
> +                    if plane.supports_crtc(crtc) and plane != crtc.primary_plane:
> +                        planes.append(plane)
> +
> +                if len(planes):
> +                    return crtc, connector, planes
> +
> +        return None, None, None
> +
> +    def main(self):
> +        self.start('composition with alpha control')
> +
> +        crtc, connector, planes = self.find_pipeline()
> +        if crtc is None:
> +            self.skip('no suitable pipeline')
> +            return
> +
> +        # Get the default mode
> +        try:
> +            mode = connector.get_default_mode()
> +        except KeyError:
> +            self.skip('no mode available')
> +            return
> +
> +        self.logger.log(f'Testing connector {connector.fullname}, CRTC {crtc.id}, '
> +                        f'mode {mode.name} with {len(planes)} planes '
> +                        f'(P: {crtc.primary_plane.id}, O: {[plane.id for plane in planes]})')
> +
> +        # Create a frame buffer
> +        fb = pykms.DumbFramebuffer(self.card, mode.hdisplay, mode.vdisplay, 'XR24')
> +        pykms.draw_test_pattern(fb)
> +
> +        # Set the mode with a primary plane
> +        ret = self.atomic_crtc_mode_set(crtc, connector, mode, fb)
> +        if ret < 0:
> +            self.fail(f'atomic mode set failed with {ret}')
> +            return
> +
> +        req = kmstest.AtomicRequest(self)
> +        req.add(crtc.primary_plane, 'alpha', '50%')

Nice. That's better than having to identify the range and set it
explicitly.


> +        ret = req.commit_sync(True)
> +        if ret < 0:
> +            self.fail(f'failed to set alpha for primary plane: {ret}')
> +            return
> +
> +        self.run(3)
> +
> +        # Add all other planes one by one
> +        alpha = 20
> +        offset = 100
> +        for plane in planes:
> +            source = kmstest.Rect(0, 0, fb.width, fb.height)
> +            destination = kmstest.Rect(offset, offset, fb.width, fb.height)
> +            ret = self.atomic_plane_set(plane, crtc, source, destination, fb, alpha=f'{alpha}%')
> +            if ret < 0:
> +                self.fail(f'atomic plane set failed with {ret}')
> +                break
> +
> +            self.logger.log(f'Adding plane {plane.id}')
> +            self.run(1)
> +
> +            if self.flips == 0:
> +                self.fail('No page flip registered')
> +                break
> +
> +            alpha = min(alpha + 20, 100)

Curious to see this. I'll have to spin up a board and display.


Reviewed-by: Kieran Bingham <kieran.bingham@xxxxxxxxxxxxxxxx>

> +            offset += 50
> +
> +        else:
> +            self.success()
> +
> +        self.atomic_crtc_disable(crtc)
> +
> +PlaneAlphaTest().execute()
> -- 
> Regards,
> 
> Laurent Pinchart
>




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux