[i-g-t] tests/kms_plane_scaling: Test if pixel format supports rotation

Submitted by Kahola, Mika on April 12, 2019, 11:07 a.m.

Details

Message ID 20190412110740.8036-1-mika.kahola@intel.com
State New
Headers show
Series "tests/kms_plane_scaling: Test if pixel format supports rotation" ( rev: 1 ) in IGT

Not browsing as part of any series.

Commit Message

Kahola, Mika April 12, 2019, 11:07 a.m.
Before actually do the commit with plane rotation, test if the pixel format
supports requested rotation. Kernel replies with -EINVAL when requested to do
rotation with the pixel format that is not supported. The patch uses this fact
to filter out unsupported pixel formats.

References: https://bugs.freedesktop.org/show_bug.cgi?id=109052
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110369
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 tests/kms_plane_scaling.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index e843bf86..57092263 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -138,6 +138,7 @@  static void check_scaling_pipe_plane_rot(data_t *d, igt_plane_t *plane,
 	igt_display_t *display = &d->display;
 	int width, height;
 	drmModeModeInfo *mode;
+	int errno;
 
 	cleanup_crtc(d);
 
@@ -158,7 +159,15 @@  static void check_scaling_pipe_plane_rot(data_t *d, igt_plane_t *plane,
 	igt_plane_set_position(plane, 0, 0);
 	igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
 	igt_plane_set_rotation(plane, rot);
-	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	/*
+	 * Test first, if pixel format supports rotation.
+	 * We expect from kernel to return with -EINVAL
+	 * if format is not supported.
+	 */
+	errno = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY, NULL);
+	if (errno != -EINVAL)
+		igt_display_commit2(display, COMMIT_ATOMIC);
 
 	igt_plane_set_fb(plane, NULL);
 	igt_plane_set_position(plane, 0, 0);

Comments


On Fri, 2019-04-12 at 07:54 -0700, Souza, Jose wrote:
> On Fri, 2019-04-12 at 14:07 +0300, Mika Kahola wrote:
> > Before actually do the commit with plane rotation, test if the
> > pixel
> > format
> > supports requested rotation. Kernel replies with -EINVAL when
> > requested to do
> > rotation with the pixel format that is not supported. The patch
> > uses
> > this fact
> > to filter out unsupported pixel formats.
> > 
> > References: https://bugs.freedesktop.org/show_bug.cgi?id=109052
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110369
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  tests/kms_plane_scaling.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> > index e843bf86..57092263 100644
> > --- a/tests/kms_plane_scaling.c
> > +++ b/tests/kms_plane_scaling.c
> > @@ -138,6 +138,7 @@ static void check_scaling_pipe_plane_rot(data_t
> > *d, igt_plane_t *plane,
> >  	igt_display_t *display = &d->display;
> >  	int width, height;
> >  	drmModeModeInfo *mode;
> > +	int errno;
> >  
> >  	cleanup_crtc(d);
> >  
> > @@ -158,7 +159,15 @@ static void
> > check_scaling_pipe_plane_rot(data_t
> > *d, igt_plane_t *plane,
> >  	igt_plane_set_position(plane, 0, 0);
> >  	igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
> >  	igt_plane_set_rotation(plane, rot);
> > -	igt_display_commit2(display, COMMIT_ATOMIC);
> > +
> > +	/*
> > +	 * Test first, if pixel format supports rotation.
> > +	 * We expect from kernel to return with -EINVAL
> > +	 * if format is not supported.
> > +	 */
> > +	errno = igt_display_try_commit_atomic(display,
> > DRM_MODE_ATOMIC_TEST_ONLY, NULL);
> > +	if (errno != -EINVAL)
> > +		igt_display_commit2(display, COMMIT_ATOMIC);
> 
> This is going to cause the test to always pass, becoming useless.
DRM_MODE_ATOMIC_TEST_ONLY is only used to filter out unsupported pixel
formats. On various checks the scaling can still fail with -ERANGE.
This is still tested with actual commit.

> It is already filtering out the know format and rotation combination
> that should not work in the caller, if a combination is not covered
> it
> should be added to those:
> 
> if (igt_fb_supported_format(format) &&
> igt_plane_has_format_mod(plane,
> format, tiling) && can_rotate(d, format))
> 	check_scaling_pipe_plane_rot(d, plane, format, tiling, pipe,
> output, rot);
We have merged these patches that add igt_plane_has_format_mod() check.
Unfortunately, this wasn't able to filter out formats that doesn't
support rotation. That's why we need find another solution.

Cheers,
Mika
> 
> 
> >  
> >  	igt_plane_set_fb(plane, NULL);
> >  	igt_plane_set_position(plane, 0, 0);