Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Lyude Paul <lyude@redhat.com>
Cc: igt-dev@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	Martin Peres <martin.peres@free.fr>,
	Ben Skeggs <bskeggs@redhat.com>
Subject: Re: [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_cursor_crc: Probe kernel for cursor size support
Date: Fri, 19 Mar 2021 23:21:32 +0200	[thread overview]
Message-ID: <YFUV3LNYs/DUEzsV@intel.com> (raw)
In-Reply-To: <51b473f2905a444868a1878bbbd0578ad888963c.camel@redhat.com>

On Fri, Mar 19, 2021 at 02:43:56PM -0400, Lyude Paul wrote:
> On Fri, 2021-03-19 at 20:00 +0200, Ville Syrjälä wrote:
> > On Fri, Mar 19, 2021 at 01:40:52PM -0400, Lyude Paul wrote:
> > > On Fri, 2021-03-19 at 17:01 +0200, Ville Syrjälä wrote:
> > > > On Thu, Mar 18, 2021 at 06:21:23PM -0400, Lyude wrote:
> > > > > From: Lyude Paul <lyude@redhat.com>
> > > > > 
> > > > > Currently we just assume that every cursor size up to data-
> > > > > >cursor_max_w/h
> > > > > will
> > > > > be supported by the driver, and check for support of nonsquare cursors
> > > > > by
> > > > > checking if we're running on u815 and if so, which variant of intel
> > > > > hardware
> > > > > we're running on. This isn't really ideal as we're about to enable 32x32
> > > > > cursor
> > > > > size tests for nouveau, and Intel hardware doesn't support cursor sizes
> > > > > that
> > > > > small.
> > > > > 
> > > > > So, fix this by removing has_nonsquare_cursors() and replacing it with a
> > > > > more
> > > > > generic require_cursor_size() function which checks whether or not the
> > > > > driver
> > > > > we're using supports a given cursor size by attempting a test-only
> > > > > atomic
> > > > > commit.
> > > > > 
> > > > > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > > > > Cc: Martin Peres <martin.peres@free.fr>
> > > > > Cc: Ben Skeggs <bskeggs@redhat.com>
> > > > > Cc: Jeremy Cline <jcline@redhat.com>
> > > > > ---
> > > > >  tests/kms_cursor_crc.c | 131 ++++++++++++++++++++++++-----------------
> > > > >  1 file changed, 76 insertions(+), 55 deletions(-)
> > > > > 
> > > > > diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> > > > > index 3541ea06..b9c05472 100644
> > > > > --- a/tests/kms_cursor_crc.c
> > > > > +++ b/tests/kms_cursor_crc.c
> > > > > @@ -523,26 +523,43 @@ static void create_cursor_fb(data_t *data, int
> > > > > cur_w,
> > > > > int cur_h)
> > > > >         igt_put_cairo_ctx(cr);
> > > > >  }
> > > > >  
> > > > > -static bool has_nonsquare_cursors(data_t *data)
> > > > > +static void require_cursor_size(data_t *data, int w, int h)
> > > > >  {
> > > > > -       uint32_t devid;
> > > > > +       igt_fb_t primary_fb;
> > > > > +       drmModeModeInfo *mode;
> > > > > +       igt_display_t *display = &data->display;
> > > > > +       igt_output_t *output = data->output;
> > > > > +       igt_plane_t *primary, *cursor;
> > > > > +       int ret;
> > > > >  
> > > > > -       if (!is_i915_device(data->drm_fd))
> > > > > -               return false;
> > > > > +       igt_output_set_pipe(output, data->pipe);
> > > > >  
> > > > > -       devid = intel_get_drm_devid(data->drm_fd);
> > > > > +       mode = igt_output_get_mode(output);
> > > > > +       primary = igt_output_get_plane_type(output,
> > > > > DRM_PLANE_TYPE_PRIMARY);
> > > > > +       cursor = igt_output_get_plane_type(output,
> > > > > DRM_PLANE_TYPE_CURSOR);
> > > > >  
> > > > > -       /*
> > > > > -        * Test non-square cursors a bit on the platforms
> > > > > -        * that support such things.
> > > > > -        */
> > > > > -       if (devid == PCI_CHIP_845_G || devid == PCI_CHIP_I865_G)
> > > > > -               return true;
> > > > > +       /* Create temporary primary fb for testing */
> > > > > +       igt_assert(igt_create_fb(data->drm_fd, mode->hdisplay, mode-
> > > > > > vdisplay, DRM_FORMAT_XRGB8888,
> > > > > +                                LOCAL_DRM_FORMAT_MOD_NONE,
> > > > > &primary_fb));
> > > > >  
> > > > > -       if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid))
> > > > > -               return false;
> > > > > +       igt_plane_set_fb(primary, &primary_fb);
> > > > > +       igt_plane_set_fb(cursor, &data->fb);
> > > > > +       igt_plane_set_size(cursor, w, h);
> > > > > +       igt_fb_set_size(&data->fb, cursor, w, h);
> > > > > +
> > > > > +       /* Test if the kernel supports the given cursor size or not */
> > > > > +       ret = igt_display_try_commit_atomic(display,
> > > > > +                                           DRM_MODE_ATOMIC_TEST_ONLY |
> > > > > +                                          
> > > > > DRM_MODE_ATOMIC_ALLOW_MODESET,
> > > > > +                                           NULL);
> > > > 
> > > > Would be better to not depend on atomic. We have platforms
> > > > that don't expose it yet.
> > > 
> > > Do you have any other ideas how we could probe for this then? it seems like
> > > the
> > > only alternative would be to add intel-specific checks to fix that, or add
> > > some
> > > ioctl for querying the minimum cursor size (which sounds preferable imo).
> > > would
> > > the latter work for you, or do you have another idea?
> > 
> > Just do it for real instead of TEST_ONLY.
> 
> ah-and it'll still fail in that case I assume?

Yeah, should fail just the same if the driver doesn't like it.

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2021-03-19 21:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 22:21 [igt-dev] [PATCH i-g-t v2 0/2] tests/kms_cursor_crc: Test 32x32 cursors Lyude
2021-03-18 22:21 ` [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_cursor_crc: Probe kernel for cursor size support Lyude
2021-03-19  7:20   ` Martin Peres
2021-03-19 15:01   ` Ville Syrjälä
2021-03-19 17:40     ` Lyude Paul
2021-03-19 18:00       ` Ville Syrjälä
2021-03-19 18:43         ` Lyude Paul
2021-03-19 21:21           ` Ville Syrjälä [this message]
2021-03-21 12:59             ` Daniel Vetter
2021-03-23 17:25   ` [igt-dev] [PATCH i-g-t v3] " Lyude
2021-03-24  8:59     ` Petri Latvala
2021-03-24 16:12     ` Ville Syrjälä
2021-03-18 22:21 ` [igt-dev] [PATCH i-g-t v2 2/2] tests/kms_cursor_crc: Test 32x32 cursors Lyude
2021-03-18 22:58 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-03-19  3:52 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-03-23 18:46 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_cursor_crc: Test 32x32 cursors (rev2) Patchwork
2021-03-24 11:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=YFUV3LNYs/DUEzsV@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=bskeggs@redhat.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    --cc=martin.peres@free.fr \
    --cc=nouveau@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox