<div dir="ltr"><div dir="ltr"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 31, 2023 at 10:49 AM Modem, Bhanuprakash <<a href="mailto:bhanuprakash.modem@intel.com">bhanuprakash.modem@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On Mon-31-07-2023 01:42 pm, Albert Esteve wrote:<br>
> <br>
> <br>
> <br>
> On Mon, Jul 31, 2023 at 8:30 AM Modem, Bhanuprakash <br>
> <<a href="mailto:bhanuprakash.modem@intel.com" target="_blank">bhanuprakash.modem@intel.com</a> <mailto:<a href="mailto:bhanuprakash.modem@intel.com" target="_blank">bhanuprakash.modem@intel.com</a>>> wrote:<br>
> <br>
>     Hello,<br>
> <br>
>     On Fri-28-07-2023 08:07 pm, Albert Esteve wrote:<br>
>      > Introduce LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT<br>
>      > capability definition until patched drm.h uapi header<br>
>      > is upstreamed and lands on IGT.<br>
>      ><br>
>      > CURSOR_PLANE_HOTSPOT capability is enabled<br>
>      > conditionally, and then tracked in the igt_display<br>
>      > struct.<br>
>      ><br>
>      > Add HOTSPOT_X and HOTSPOT_Y properties<br>
>      > to the atomic_plane_properties struct.<br>
>      ><br>
>      > Signed-off-by: Albert Esteve <<a href="mailto:aesteve@redhat.com" target="_blank">aesteve@redhat.com</a><br>
>     <mailto:<a href="mailto:aesteve@redhat.com" target="_blank">aesteve@redhat.com</a>>><br>
>      > ---<br>
>      >   lib/igt_kms.c | 10 ++++++++++<br>
>      >   lib/igt_kms.h | 11 ++++++++++-<br>
>      >   2 files changed, 20 insertions(+), 1 deletion(-)<br>
>      ><br>
>      > diff --git a/lib/igt_kms.c b/lib/igt_kms.c<br>
>      > index f2b0eed57..73119d0e5 100644<br>
>      > --- a/lib/igt_kms.c<br>
>      > +++ b/lib/igt_kms.c<br>
>      > @@ -601,6 +601,8 @@ const char * const<br>
>     igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {<br>
>      >       [IGT_PLANE_CRTC_Y] = "CRTC_Y",<br>
>      >       [IGT_PLANE_CRTC_W] = "CRTC_W",<br>
>      >       [IGT_PLANE_CRTC_H] = "CRTC_H",<br>
>      > +     [IGT_PLANE_HOTSPOT_X] = "HOTSPOT_X",<br>
>      > +     [IGT_PLANE_HOTSPOT_Y] = "HOTSPOT_Y",<br>
>      >       [IGT_PLANE_FB_ID] = "FB_ID",<br>
>      >       [IGT_PLANE_CRTC_ID] = "CRTC_ID",<br>
>      >       [IGT_PLANE_IN_FENCE_FD] = "IN_FENCE_FD",<br>
>      > @@ -2296,6 +2298,11 @@ static void igt_plane_reset(igt_plane_t<br>
>     *plane)<br>
>      >       if (igt_plane_has_prop(plane, IGT_PLANE_SCALING_FILTER))<br>
>      >               igt_plane_set_prop_enum(plane,<br>
>     IGT_PLANE_SCALING_FILTER, "Default");<br>
>      ><br>
>      > +     if (igt_plane_has_prop(plane, IGT_PLANE_HOTSPOT_X))<br>
>      > +             igt_plane_set_prop_value(plane,<br>
>     IGT_PLANE_HOTSPOT_X, 0);<br>
>      > +     if (igt_plane_has_prop(plane, IGT_PLANE_HOTSPOT_Y))<br>
>      > +             igt_plane_set_prop_value(plane,<br>
>     IGT_PLANE_HOTSPOT_Y, 0);<br>
>      > +<br>
>      >       igt_plane_clear_prop_changed(plane, IGT_PLANE_IN_FENCE_FD);<br>
>      >       plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;<br>
>      >       plane->gem_handle = 0;<br>
>      > @@ -2679,6 +2686,9 @@ void igt_display_require(igt_display_t<br>
>     *display, int drm_fd)<br>
>      >       drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);<br>
>      >       if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0)<br>
>      >               display->is_atomic = 1;<br>
>      > +<br>
>      > +     if (drmSetClientCap(drm_fd,<br>
>     LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 1) == 0)<br>
>      > +             display->set_hotspots = 1;<br>
> <br>
>     Any special reason to add this to display struct?<br>
>     IMHO, it is better to handle it at test level.<br>
> <br>
> <br>
> Hi Bhanu,<br>
> <br>
> Mostly for keeping it consistent with the `is_atomic` capability.<br>
> <br>
> Are you suggesting moving the `drmSetClientCap` to the test?<br>
<br>
Yes.<br>
<br>
> I am ok with changing this, just trying to understand what would<br>
> be the preferred way here.<br>
<br>
Either way (adding to display struct or checking at test level) is fine.<br>
<br>
Generally to maintain the re-usability (ex: checking for the same <br>
capability multiple times) we used to cache the capabilities to display <br>
struct. If multiple tests (or multiple places in your test) want to use <br>
this hotspot capability, you can add it to the display struct.<br></blockquote><div><br></div><div>ATM it is only this test. If there is a need for more tests,</div><div>we can move capability setting back to display, but for the time being I will follow</div><div>your advice and move it to the test.</div><div><br></div><div>Something like...?</div><div>igt_subtest("modeset-atomic-cursor-hotspot") {<br></div><div>    igt_require(drmSetClientCap(display.drm_fd, LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 1) == 0);<br>    modeset_atomic_cursor_hotspot(&display);<br>    igt_assert_eq(drmSetClientCap(display.drm_fd, LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 0), 0);<br>         }<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
- Bhanu<br>
<br>
> <br>
> Thanks!<br>
> <br>
> <br>
>     - Bhanu<br>
> <br>
>      ><br>
>      >       plane_resources = drmModeGetPlaneResources(display->drm_fd);<br>
>      >       igt_assert(plane_resources);<br>
>      > diff --git a/lib/igt_kms.h b/lib/igt_kms.h<br>
>      > index 1b6988c17..cf0a6d82b 100644<br>
>      > --- a/lib/igt_kms.h<br>
>      > +++ b/lib/igt_kms.h<br>
>      > @@ -41,6 +41,12 @@<br>
>      ><br>
>      >   /* Low-level helpers with kmstest_ prefix */<br>
>      ><br>
>      > +/**<br>
>      > + * Clients which do set cursor hotspot and treat the cursor plane<br>
>      > + * like a mouse cursor should set this property.<br>
>      > + */<br>
>      > +#define LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT    6<br>
>      > +<br>
>      >   /**<br>
>      >    * pipe:<br>
>      >    * @PIPE_NONE: Invalid pipe, used for disconnecting a output<br>
>     from a pipe.<br>
>      > @@ -318,7 +324,9 @@ enum igt_atomic_plane_properties {<br>
>      >          IGT_PLANE_ZPOS,<br>
>      >          IGT_PLANE_FB_DAMAGE_CLIPS,<br>
>      >          IGT_PLANE_SCALING_FILTER,<br>
>      > -       IGT_NUM_PLANE_PROPS<br>
>      > +       IGT_PLANE_HOTSPOT_X,<br>
>      > +       IGT_PLANE_HOTSPOT_Y,<br>
>      > +       IGT_NUM_PLANE_PROPS<br>
>      >   };<br>
>      ><br>
>      >   /**<br>
>      > @@ -448,6 +456,7 @@ struct igt_display {<br>
>      >       igt_pipe_t *pipes;<br>
>      >       bool has_cursor_plane;<br>
>      >       bool is_atomic;<br>
>      > +     bool set_hotspots;<br>
>      >       bool first_commit;<br>
>      ><br>
>      >       uint64_t *modifiers;<br>
> <br>
<br>
</blockquote></div></div>