All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
Subject: Re: [kms-test] [PATCH 09/10] tests: Add plane zpos test
Date: Wed, 29 Jun 2022 21:08:07 +0300	[thread overview]
Message-ID: <YryVBwNB5tS3JKog@pendragon.ideasonboard.com> (raw)
In-Reply-To: <165651793098.2049236.2538448937224001374@Monstersaurus>

On Wed, Jun 29, 2022 at 04:52:10PM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2022-06-10 00:40:30)
> > Add a test that enables multiple planes with different zpos values.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  tests/kms-test-plane-zpos.py | 102 +++++++++++++++++++++++++++++++++++
> >  1 file changed, 102 insertions(+)
> >  create mode 100755 tests/kms-test-plane-zpos.py
> > 
> > diff --git a/tests/kms-test-plane-zpos.py b/tests/kms-test-plane-zpos.py
> > new file mode 100755
> > index 000000000000..052eea542ec0
> > --- /dev/null
> > +++ b/tests/kms-test-plane-zpos.py
> > @@ -0,0 +1,102 @@
> > +#!/usr/bin/python3
> > +# SPDX-License-Identifier: GPL-2.0-or-later
> > +# SPDX-FileCopyrightText: 2022 Renesas Electronics Corporation
> > +
> > +import kmstest
> > +import pykms
> > +
> > +class PlaneZPosTest(kmstest.KMSTest):
> > +    """Test composition with multiple planes and custom z-pos."""
> > +
> > +    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 z-pos 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, and position it on top of the
> > +        # stack. Make it transparent to visualize the overlay planes that will
> 
> How handy that there's now transparency ;-)
> 
> > +        # be positioned underneath.
> > +        zpos = len(planes)
> > +        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%')
> > +        req.add(crtc.primary_plane, 'zpos', zpos)
> 
> Not that it matters, but those could both be added in a single statement
> right?

Yes, that's right.

> (not needed, just understanding the API of .add() )
> 
> > +        ret = req.commit_sync(True)
> > +        if ret < 0:
> > +            self.fail(f'failed to set properties for primary plane: {ret}')
> > +            return
> > +
> > +        self.run(3)
> > +
> > +        # Add all other planes one by one
> > +        offset = 100 + 50 * (len(planes) - 1)
> > +
> > +        for plane in planes:
> > +            zpos -= 1
> > +
> > +            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='100%', zpos=zpos)
> 
> Seems pretty good to me.
> 
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > +            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
> > +
> > +            offset -= 50
> > +
> > +        else:
> > +            self.success()
> > +
> > +        self.atomic_crtc_disable(crtc)
> > +
> > +PlaneZPosTest().execute()

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-06-29 18:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 23:40 [kms-test] [PATCH 00/10] Test plane alpha and zpos control Laurent Pinchart
2022-06-09 23:40 ` [kms-test] [PATCH 01/10] tests: Replace double quotes with single quotes Laurent Pinchart
2022-06-29 13:22   ` Kieran Bingham
2022-06-09 23:40 ` [kms-test] [PATCH 02/10] tests: Convert to formatted string literals Laurent Pinchart
2022-06-29 15:28   ` Kieran Bingham
2022-06-09 23:40 ` [kms-test] [PATCH 03/10] tests: allplanes: Log the plane IDs Laurent Pinchart
2022-06-29 15:30   ` Kieran Bingham
2022-06-29 18:06     ` Laurent Pinchart
2022-06-09 23:40 ` [kms-test] [PATCH 04/10] kmstest: Move props value formatting to AtomicRequest Laurent Pinchart
2022-06-29 15:36   ` Kieran Bingham
2022-06-29 18:13     ` Laurent Pinchart
2022-06-09 23:40 ` [kms-test] [PATCH 05/10] kmstest: Support specifying property values in percents Laurent Pinchart
2022-06-29 15:39   ` Kieran Bingham
2022-06-09 23:40 ` [kms-test] [PATCH 06/10] kmstest: Support specifying alpha value for planes Laurent Pinchart
2022-06-29 15:45   ` Kieran Bingham
2022-06-09 23:40 ` [kms-test] [PATCH 07/10] tests: Add plane alpha test Laurent Pinchart
2022-06-29 15:48   ` Kieran Bingham
2022-06-09 23:40 ` [kms-test] [PATCH 08/10] kmstest: Support specifying zpos value for planes Laurent Pinchart
2022-06-29 15:48   ` Kieran Bingham
2022-06-09 23:40 ` [kms-test] [PATCH 09/10] tests: Add plane zpos test Laurent Pinchart
2022-06-29 15:52   ` Kieran Bingham
2022-06-29 18:08     ` Laurent Pinchart [this message]
2022-06-09 23:40 ` [kms-test] [PATCH 10/10] tests: Rename kms-test-planeposition.py to kms-test-plane-position.py Laurent Pinchart
2022-06-29 15:44   ` Kieran Bingham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YryVBwNB5tS3JKog@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.