From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Takanari Hayama <taki@igel.co.jp>
Cc: linux-renesas-soc@vger.kernel.org,
kieran.bingham+renesas@ideasonboard.com
Subject: Re: [PATCH 3/3] tests: Add pixel blend mode test
Date: Sun, 31 Jul 2022 21:50:33 +0300 [thread overview]
Message-ID: <YubO+TZkrR8bz2DB@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220704025632.3911253-4-taki@igel.co.jp>
Hi Hayama-san,
Thank you for the patch.
On Mon, Jul 04, 2022 at 11:56:32AM +0900, Takanari Hayama wrote:
> Add a test that blends a plane with different pixel blend modes.
>
> Signed-off-by: Takanari Hayama <taki@igel.co.jp>
> ---
> tests/kms-test-plane-blendmode.py | 100 ++++++++++++++++++++++++++++++
> 1 file changed, 100 insertions(+)
> create mode 100755 tests/kms-test-plane-blendmode.py
>
> diff --git a/tests/kms-test-plane-blendmode.py b/tests/kms-test-plane-blendmode.py
> new file mode 100755
> index 000000000000..a9c009b74a8c
> --- /dev/null
> +++ b/tests/kms-test-plane-blendmode.py
> @@ -0,0 +1,100 @@
> +#!/usr/bin/python3
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# SPDX-FileCopyrightText: 2022 Renesas Electronics Corporation
> +
> +import kmstest
> +import pykms
> +
> +class PlaneBlendModeTest(kmstest.KMSTest):
> + """Test composition in different blend modes."""
> +
> + 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 blend modes')
> +
> + 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 primary plane
This only creates a framebuffer, not a plane, so I'd write
# Create a frame buffer for the primary plane
and name the variable fb_primary.
> + primary = pykms.DumbFramebuffer(self.card, mode.hdisplay, mode.vdisplay, 'XR24')
> + pykms.draw_test_pattern(primary)
> + #pykms.draw_rect(primary, 0, 0, mode.hdisplay, mode.vdisplay, pykms.RGB(0, 0, 255))
This line can be dropped.
> +
> + # Set the mode with a primary plane
> + ret = self.atomic_crtc_mode_set(crtc, connector, mode, primary)
> + if ret < 0:
> + self.fail(f'atomic mode set failed with {ret}')
> + return
> +
> + # Create a overlay plane (half of the screen size)
Small indentation issue, this should use spaces instead of tabs. As
above, I'd write
# Create a frame buffer for the overlay planes (half of the screen size)
and name the variable fb_overlay.
I would also create both frame buffers before setting the mode.
> + fb = pykms.DumbFramebuffer(self.card, mode.hdisplay // 2, mode.vdisplay, 'AR24')
> + self.logger.log(f'Create fb: {fb} ({fb.width}x{fb.height})')
> + width = mode.hdisplay // 4
> + height = mode.vdisplay // 5
> + for n in range(0, 5):
> + v = 255 - 63 * n
> + pykms.draw_rect(fb, 0, height * n, width, height, pykms.RGB(v, 255, 255, 255))
> + pykms.draw_rect(fb, width, height * n, width, height, pykms.RGB(v, v, v, v))
> +
> + self.run(3)
> +
> + # Add all other planes one by one
You're only adding a second plane, so
# Add the overlay plane, testing all blend modes sequentially
> + source = kmstest.Rect(0, 0, fb.width, fb.height)
> + destination = kmstest.Rect(fb.width, 0, fb.width, fb.height)
> + alpha = '50%'
> + for blendmode in ('Pre-multiplied', 'Coverage', 'None'):
> + pykms.draw_text(fb, 10, 10, f'alpha={alpha}, mode={blendmode} ', pykms.white)
> + ret = self.atomic_plane_set(planes[1], crtc, source, destination, fb, alpha=alpha, blendmode=blendmode)
A bit of line wrap would be nice.
I'll fix thse small issues when applying the patches.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + if ret < 0:
> + self.fail(f'atomic plane set failed with {ret}')
> + break
> +
> + self.logger.log(f'Adding plane {planes[1].id} with blendmode {blendmode}')
> + self.run(1)
> +
> + if self.flips == 0:
> + self.fail('No page flip registered')
> + break
> +
> + self.run(3)
> +
> + else:
> + self.success()
> +
> + self.atomic_crtc_disable(crtc)
> +
> +PlaneBlendModeTest().execute()
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2022-07-31 18:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 2:56 [PATCH 0/3] Test pixel blend mode Takanari Hayama
2022-07-04 2:56 ` [PATCH 1/3] tests: Support enum property type Takanari Hayama
2022-07-04 8:43 ` Sergei Shtylyov
2022-07-04 8:53 ` Takanari Hayama
2022-07-04 9:00 ` Sergei Shtylyov
2022-07-04 9:13 ` Takanari Hayama
2022-07-31 16:00 ` Laurent Pinchart
2022-07-31 16:18 ` Laurent Pinchart
2022-08-01 8:29 ` Takanari Hayama
2022-07-04 2:56 ` [PATCH 2/3] kmstest: Support specifying pixel blend mode for planes Takanari Hayama
2022-07-31 16:02 ` Laurent Pinchart
2022-07-04 2:56 ` [PATCH 3/3] tests: Add pixel blend mode test Takanari Hayama
2022-07-31 18:50 ` Laurent Pinchart [this message]
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=YubO+TZkrR8bz2DB@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=kieran.bingham+renesas@ideasonboard.com \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=taki@igel.co.jp \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox