* [PATCH 0/3] Test pixel blend mode @ 2022-07-04 2:56 Takanari Hayama 2022-07-04 2:56 ` [PATCH 1/3] tests: Support enum property type Takanari Hayama ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Takanari Hayama @ 2022-07-04 2:56 UTC (permalink / raw) To: linux-renesas-soc; +Cc: laurent.pinchart, kieran.bingham+renesas Hello, This patch series extends the kms-test scripts to test pixel blend mode. The patches are based on series of patches posted by Laurent ([1]). [1] https://lore.kernel.org/linux-renesas-soc/20220609234031.14803-1-laurent.pinchart@ideasonboard.com/T/#t Takanari Hayama (3): tests: Support enum property type kmstest: Support specifying pixel blend mode for planes tests: Add pixel blend mode test tests/kms-test-plane-blendmode.py | 100 ++++++++++++++++++++++++++++++ tests/kmstest.py | 16 ++++- 2 files changed, 114 insertions(+), 2 deletions(-) create mode 100755 tests/kms-test-plane-blendmode.py -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/3] tests: Support enum property type 2022-07-04 2:56 [PATCH 0/3] Test pixel blend mode Takanari Hayama @ 2022-07-04 2:56 ` Takanari Hayama 2022-07-04 8:43 ` Sergei Shtylyov 2022-07-31 16:00 ` Laurent Pinchart 2022-07-04 2:56 ` [PATCH 2/3] kmstest: Support specifying pixel blend mode for planes Takanari Hayama 2022-07-04 2:56 ` [PATCH 3/3] tests: Add pixel blend mode test Takanari Hayama 2 siblings, 2 replies; 13+ messages in thread From: Takanari Hayama @ 2022-07-04 2:56 UTC (permalink / raw) To: linux-renesas-soc; +Cc: laurent.pinchart, kieran.bingham+renesas Add a support for enum property type to AtomicRequest. Signed-off-by: Takanari Hayama <taki@igel.co.jp> --- tests/kmstest.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/kmstest.py b/tests/kmstest.py index 11cc328b5b32..224c160e32fa 100755 --- a/tests/kmstest.py +++ b/tests/kmstest.py @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq): min, max = prop.values v = min + int((max - min) * int(v[:-1]) / 100) - else: + elif v.isnumeric(): v = int(v) + else: + prop = obj.get_prop(k) + if prop.type != pykms.PropertyType.Enum: + raise RuntimeError(f'Unsupported property type {prop.type} for value {v}') + for value, mode in prop.enums.items(): + if mode == v: + v = value + break + else: + raise RuntimeError(f'Enum value with name "{v}" not found in property {k}') if not isinstance(v, int): raise RuntimeError(f'Unsupported value type {type(v)} for property {k}') -- 2.25.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] tests: Support enum property type 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-31 16:00 ` Laurent Pinchart 1 sibling, 1 reply; 13+ messages in thread From: Sergei Shtylyov @ 2022-07-04 8:43 UTC (permalink / raw) To: Takanari Hayama, linux-renesas-soc Cc: laurent.pinchart, kieran.bingham+renesas Hello! On 7/4/22 5:56 AM, Takanari Hayama wrote: > Add a support for enum property type to AtomicRequest. > > Signed-off-by: Takanari Hayama <taki@igel.co.jp> > --- > tests/kmstest.py | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/tests/kmstest.py b/tests/kmstest.py > index 11cc328b5b32..224c160e32fa 100755 > --- a/tests/kmstest.py > +++ b/tests/kmstest.py > @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq): > > min, max = prop.values > v = min + int((max - min) * int(v[:-1]) / 100) > - else: > + elif v.isnumeric(): > v = int(v) > + else: > + prop = obj.get_prop(k) > + if prop.type != pykms.PropertyType.Enum: > + raise RuntimeError(f'Unsupported property type {prop.type} for value {v}') > + for value, mode in prop.enums.items(): > + if mode == v: > + v = value > + break > + else: Hm, doesn't seem to be correctly aligned? > + raise RuntimeError(f'Enum value with name "{v}" not found in property {k}') > > if not isinstance(v, int): > raise RuntimeError(f'Unsupported value type {type(v)} for property {k}') MBR, Sergey ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] tests: Support enum property type 2022-07-04 8:43 ` Sergei Shtylyov @ 2022-07-04 8:53 ` Takanari Hayama 2022-07-04 9:00 ` Sergei Shtylyov 0 siblings, 1 reply; 13+ messages in thread From: Takanari Hayama @ 2022-07-04 8:53 UTC (permalink / raw) To: Sergei Shtylyov Cc: linux-renesas-soc, laurent.pinchart, kieran.bingham+renesas Hi Sergei, > 2022/07/04 17:43、Sergei Shtylyov <sergei.shtylyov@gmail.com>のメール: > > Hello! > > On 7/4/22 5:56 AM, Takanari Hayama wrote: > >> Add a support for enum property type to AtomicRequest. >> >> Signed-off-by: Takanari Hayama <taki@igel.co.jp> >> --- >> tests/kmstest.py | 12 +++++++++++- >> 1 file changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/tests/kmstest.py b/tests/kmstest.py >> index 11cc328b5b32..224c160e32fa 100755 >> --- a/tests/kmstest.py >> +++ b/tests/kmstest.py >> @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq): >> >> min, max = prop.values >> v = min + int((max - min) * int(v[:-1]) / 100) >> - else: >> + elif v.isnumeric(): >> v = int(v) >> + else: >> + prop = obj.get_prop(k) >> + if prop.type != pykms.PropertyType.Enum: >> + raise RuntimeError(f'Unsupported property type {prop.type} for value {v}') >> + for value, mode in prop.enums.items(): >> + if mode == v: >> + v = value >> + break >> + else: > > Hm, doesn't seem to be correctly aligned? That ‘else’ is for ‘for’-loop. Am I missing something here? >> + raise RuntimeError(f'Enum value with name "{v}" not found in property {k}') >> >> if not isinstance(v, int): >> raise RuntimeError(f'Unsupported value type {type(v)} for property {k}') > > MBR, Sergey Many Thanks, Takanari Hayama, Ph.D. <taki@igel.co.jp> IGEL Co., Ltd. https://www.igel.co.jp/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] tests: Support enum property type 2022-07-04 8:53 ` Takanari Hayama @ 2022-07-04 9:00 ` Sergei Shtylyov 2022-07-04 9:13 ` Takanari Hayama 0 siblings, 1 reply; 13+ messages in thread From: Sergei Shtylyov @ 2022-07-04 9:00 UTC (permalink / raw) To: Takanari Hayama Cc: linux-renesas-soc, laurent.pinchart, kieran.bingham+renesas On 7/4/22 11:53 AM, Takanari Hayama wrote: [...] >>> Add a support for enum property type to AtomicRequest. >>> >>> Signed-off-by: Takanari Hayama <taki@igel.co.jp> >>> --- >>> tests/kmstest.py | 12 +++++++++++- >>> 1 file changed, 11 insertions(+), 1 deletion(-) >>> >>> diff --git a/tests/kmstest.py b/tests/kmstest.py >>> index 11cc328b5b32..224c160e32fa 100755 >>> --- a/tests/kmstest.py >>> +++ b/tests/kmstest.py >>> @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq): >>> >>> min, max = prop.values >>> v = min + int((max - min) * int(v[:-1]) / 100) >>> - else: >>> + elif v.isnumeric(): >>> v = int(v) >>> + else: >>> + prop = obj.get_prop(k) >>> + if prop.type != pykms.PropertyType.Enum: >>> + raise RuntimeError(f'Unsupported property type {prop.type} for value {v}') >>> + for value, mode in prop.enums.items(): >>> + if mode == v: >>> + v = value >>> + break >>> + else: >> >> Hm, doesn't seem to be correctly aligned? > > That ‘else’ is for ‘for’-loop. Am I missing something here? Hm, I don't really know Python, can it actually have else for a loop? >>> + raise RuntimeError(f'Enum value with name "{v}" not found in property {k}') >>> >>> if not isinstance(v, int): >>> raise RuntimeError(f'Unsupported value type {type(v)} for property {k}') MBR, Sergey [...] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] tests: Support enum property type 2022-07-04 9:00 ` Sergei Shtylyov @ 2022-07-04 9:13 ` Takanari Hayama 0 siblings, 0 replies; 13+ messages in thread From: Takanari Hayama @ 2022-07-04 9:13 UTC (permalink / raw) To: Sergei Shtylyov Cc: linux-renesas-soc, laurent.pinchart, kieran.bingham+renesas Hi, > 2022/07/04 18:00、Sergei Shtylyov <sergei.shtylyov@gmail.com>のメール: > > On 7/4/22 11:53 AM, Takanari Hayama wrote: > [...] >>>> Add a support for enum property type to AtomicRequest. >>>> >>>> Signed-off-by: Takanari Hayama <taki@igel.co.jp> >>>> --- >>>> tests/kmstest.py | 12 +++++++++++- >>>> 1 file changed, 11 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/tests/kmstest.py b/tests/kmstest.py >>>> index 11cc328b5b32..224c160e32fa 100755 >>>> --- a/tests/kmstest.py >>>> +++ b/tests/kmstest.py >>>> @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq): >>>> >>>> min, max = prop.values >>>> v = min + int((max - min) * int(v[:-1]) / 100) >>>> - else: >>>> + elif v.isnumeric(): >>>> v = int(v) >>>> + else: >>>> + prop = obj.get_prop(k) >>>> + if prop.type != pykms.PropertyType.Enum: >>>> + raise RuntimeError(f'Unsupported property type {prop.type} for value {v}') >>>> + for value, mode in prop.enums.items(): >>>> + if mode == v: >>>> + v = value >>>> + break >>>> + else: >>> >>> Hm, doesn't seem to be correctly aligned? >> >> That ‘else’ is for ‘for’-loop. Am I missing something here? > > Hm, I don't really know Python, can it actually have else for > a loop? Yes. :) > When the items are exhausted (which is immediately when the sequence is empty or an iterator raises a StopIteration exception), the suite in the else clause, if present, is executed, and the loop terminates. From https://docs.python.org/3/reference/compound_stmts.html#the-for-statement > >>>> + raise RuntimeError(f'Enum value with name "{v}" not found in property {k}') >>>> >>>> if not isinstance(v, int): >>>> raise RuntimeError(f'Unsupported value type {type(v)} for property {k}') > > MBR, Sergey Many Thanks, Takanari Hayama, Ph.D. <taki@igel.co.jp> IGEL Co., Ltd. https://www.igel.co.jp/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] tests: Support enum property type 2022-07-04 2:56 ` [PATCH 1/3] tests: Support enum property type Takanari Hayama 2022-07-04 8:43 ` Sergei Shtylyov @ 2022-07-31 16:00 ` Laurent Pinchart 2022-07-31 16:18 ` Laurent Pinchart 1 sibling, 1 reply; 13+ messages in thread From: Laurent Pinchart @ 2022-07-31 16:00 UTC (permalink / raw) To: Takanari Hayama; +Cc: linux-renesas-soc, kieran.bingham+renesas Hi Hayama-san, Thank you for the patch. On Mon, Jul 04, 2022 at 11:56:30AM +0900, Takanari Hayama wrote: > Add a support for enum property type to AtomicRequest. > > Signed-off-by: Takanari Hayama <taki@igel.co.jp> > --- > tests/kmstest.py | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/tests/kmstest.py b/tests/kmstest.py > index 11cc328b5b32..224c160e32fa 100755 > --- a/tests/kmstest.py > +++ b/tests/kmstest.py > @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq): > > min, max = prop.values > v = min + int((max - min) * int(v[:-1]) / 100) > - else: > + elif v.isnumeric(): > v = int(v) > + else: > + prop = obj.get_prop(k) > + if prop.type != pykms.PropertyType.Enum: > + raise RuntimeError(f'Unsupported property type {prop.type} for value {v}') > + for value, mode in prop.enums.items(): I'd replace "mode" with "name" here. Apart from that, Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> I'll change this when applying the patch. > + if mode == v: > + v = value > + break > + else: > + raise RuntimeError(f'Enum value with name "{v}" not found in property {k}') > > if not isinstance(v, int): > raise RuntimeError(f'Unsupported value type {type(v)} for property {k}') -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] tests: Support enum property type 2022-07-31 16:00 ` Laurent Pinchart @ 2022-07-31 16:18 ` Laurent Pinchart 2022-08-01 8:29 ` Takanari Hayama 0 siblings, 1 reply; 13+ messages in thread From: Laurent Pinchart @ 2022-07-31 16:18 UTC (permalink / raw) To: Takanari Hayama; +Cc: linux-renesas-soc, kieran.bingham+renesas One more comment. On Sun, Jul 31, 2022 at 07:01:00PM +0300, Laurent Pinchart wrote: > Hi Hayama-san, > > Thank you for the patch. > > On Mon, Jul 04, 2022 at 11:56:30AM +0900, Takanari Hayama wrote: > > Add a support for enum property type to AtomicRequest. > > > > Signed-off-by: Takanari Hayama <taki@igel.co.jp> > > --- > > tests/kmstest.py | 12 +++++++++++- > > 1 file changed, 11 insertions(+), 1 deletion(-) > > > > diff --git a/tests/kmstest.py b/tests/kmstest.py > > index 11cc328b5b32..224c160e32fa 100755 > > --- a/tests/kmstest.py > > +++ b/tests/kmstest.py > > @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq): > > > > min, max = prop.values > > v = min + int((max - min) * int(v[:-1]) / 100) > > - else: > > + elif v.isnumeric(): > > v = int(v) > > + else: > > + prop = obj.get_prop(k) I've run this test on a kernel that doesn't support the blend mode property, and the prop.type access below raised an exception that isn't very nice to read. If that's fine with you, I'll add if not prop: raise RuntimeError(f'Property {k} not supported by object {obj}') here to make error messages more readable. > > + if prop.type != pykms.PropertyType.Enum: > > + raise RuntimeError(f'Unsupported property type {prop.type} for value {v}') > > + for value, mode in prop.enums.items(): > > I'd replace "mode" with "name" here. Apart from that, > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > I'll change this when applying the patch. > > > + if mode == v: > > + v = value > > + break > > + else: > > + raise RuntimeError(f'Enum value with name "{v}" not found in property {k}') > > > > if not isinstance(v, int): > > raise RuntimeError(f'Unsupported value type {type(v)} for property {k}') -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] tests: Support enum property type 2022-07-31 16:18 ` Laurent Pinchart @ 2022-08-01 8:29 ` Takanari Hayama 0 siblings, 0 replies; 13+ messages in thread From: Takanari Hayama @ 2022-08-01 8:29 UTC (permalink / raw) To: Laurent Pinchart; +Cc: linux-renesas-soc, kieran.bingham+renesas Hi Laurent, Thank you for reviewing the patches. > 2022/08/01 1:18、Laurent Pinchart <laurent.pinchart@ideasonboard.com>のメール: > > One more comment. > > On Sun, Jul 31, 2022 at 07:01:00PM +0300, Laurent Pinchart wrote: >> Hi Hayama-san, >> >> Thank you for the patch. >> >> On Mon, Jul 04, 2022 at 11:56:30AM +0900, Takanari Hayama wrote: >>> Add a support for enum property type to AtomicRequest. >>> >>> Signed-off-by: Takanari Hayama <taki@igel.co.jp> >>> --- >>> tests/kmstest.py | 12 +++++++++++- >>> 1 file changed, 11 insertions(+), 1 deletion(-) >>> >>> diff --git a/tests/kmstest.py b/tests/kmstest.py >>> index 11cc328b5b32..224c160e32fa 100755 >>> --- a/tests/kmstest.py >>> +++ b/tests/kmstest.py >>> @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq): >>> >>> min, max = prop.values >>> v = min + int((max - min) * int(v[:-1]) / 100) >>> - else: >>> + elif v.isnumeric(): >>> v = int(v) >>> + else: >>> + prop = obj.get_prop(k) > > I've run this test on a kernel that doesn't support the blend mode > property, and the prop.type access below raised an exception that isn't > very nice to read. If that's fine with you, I'll add > > if not prop: > raise RuntimeError(f'Property {k} not supported by object {obj}') > > here to make error messages more readable. Right. That makes more sense. > >>> + if prop.type != pykms.PropertyType.Enum: >>> + raise RuntimeError(f'Unsupported property type {prop.type} for value {v}') >>> + for value, mode in prop.enums.items(): >> >> I'd replace "mode" with "name" here. Apart from that, >> >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> >> >> I'll change this when applying the patch. Thank you. >> >>> + if mode == v: >>> + v = value >>> + break >>> + else: >>> + raise RuntimeError(f'Enum value with name "{v}" not found in property {k}') >>> >>> if not isinstance(v, int): >>> raise RuntimeError(f'Unsupported value type {type(v)} for property {k}') > > -- > Regards, > > Laurent Pinchart Cheers, Takanari Hayama, Ph.D. <taki@igel.co.jp> IGEL Co., Ltd. https://www.igel.co.jp/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] kmstest: Support specifying pixel blend mode for planes 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 2:56 ` 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 2 siblings, 1 reply; 13+ messages in thread From: Takanari Hayama @ 2022-07-04 2:56 UTC (permalink / raw) To: linux-renesas-soc; +Cc: laurent.pinchart, kieran.bingham+renesas Add an optional pixel blend mode argument to the atomic_plane_set() function to specify the pixel blend mode for the plane. Signed-off-by: Takanari Hayama <taki@igel.co.jp> --- tests/kmstest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/kmstest.py b/tests/kmstest.py index 224c160e32fa..a39ceab3891b 100755 --- a/tests/kmstest.py +++ b/tests/kmstest.py @@ -395,7 +395,7 @@ class KMSTest(object): else: return req.commit(0, True) - def atomic_plane_set(self, plane, crtc, source, destination, fb, alpha=None, zpos=None, sync=False): + def atomic_plane_set(self, plane, crtc, source, destination, fb, alpha=None, zpos=None, blendmode=None, sync=False): req = AtomicRequest(self) req.add(plane, { 'FB_ID': fb.id, @@ -413,6 +413,8 @@ class KMSTest(object): req.add(plane, 'alpha', alpha) if zpos is not None: req.add(plane, 'zpos', zpos) + if blendmode is not None: + req.add(plane, 'pixel blend mode', blendmode) if sync: return req.commit_sync() else: -- 2.25.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] kmstest: Support specifying pixel blend mode for planes 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 0 siblings, 0 replies; 13+ messages in thread From: Laurent Pinchart @ 2022-07-31 16:02 UTC (permalink / raw) To: Takanari Hayama; +Cc: linux-renesas-soc, kieran.bingham+renesas Hi Hayama-san, Thank you for the patch. On Mon, Jul 04, 2022 at 11:56:31AM +0900, Takanari Hayama wrote: > Add an optional pixel blend mode argument to the atomic_plane_set() > function to specify the pixel blend mode for the plane. > > Signed-off-by: Takanari Hayama <taki@igel.co.jp> > --- > tests/kmstest.py | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tests/kmstest.py b/tests/kmstest.py > index 224c160e32fa..a39ceab3891b 100755 > --- a/tests/kmstest.py > +++ b/tests/kmstest.py > @@ -395,7 +395,7 @@ class KMSTest(object): > else: > return req.commit(0, True) > > - def atomic_plane_set(self, plane, crtc, source, destination, fb, alpha=None, zpos=None, sync=False): > + def atomic_plane_set(self, plane, crtc, source, destination, fb, alpha=None, zpos=None, blendmode=None, sync=False): I'll add a line break while at it as the line is getting long. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > req = AtomicRequest(self) > req.add(plane, { > 'FB_ID': fb.id, > @@ -413,6 +413,8 @@ class KMSTest(object): > req.add(plane, 'alpha', alpha) > if zpos is not None: > req.add(plane, 'zpos', zpos) > + if blendmode is not None: > + req.add(plane, 'pixel blend mode', blendmode) > if sync: > return req.commit_sync() > else: -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/3] tests: Add pixel blend mode test 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 2:56 ` [PATCH 2/3] kmstest: Support specifying pixel blend mode for planes Takanari Hayama @ 2022-07-04 2:56 ` Takanari Hayama 2022-07-31 18:50 ` Laurent Pinchart 2 siblings, 1 reply; 13+ messages in thread From: Takanari Hayama @ 2022-07-04 2:56 UTC (permalink / raw) To: linux-renesas-soc; +Cc: laurent.pinchart, kieran.bingham+renesas 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 + 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)) + + # 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) + 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 + 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) + 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() -- 2.25.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] tests: Add pixel blend mode test 2022-07-04 2:56 ` [PATCH 3/3] tests: Add pixel blend mode test Takanari Hayama @ 2022-07-31 18:50 ` Laurent Pinchart 0 siblings, 0 replies; 13+ messages in thread From: Laurent Pinchart @ 2022-07-31 18:50 UTC (permalink / raw) To: Takanari Hayama; +Cc: linux-renesas-soc, kieran.bingham+renesas 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-08-01 8:29 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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.