<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 Wed, Aug 2, 2023 at 10:12 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 Tue-01-08-2023 02:18 pm, Albert Esteve wrote:<br>
> Add a test for modesetting an atomic cursor plane<br>
> hotspot property. Test added to verify the kernel<br>
> patch at [1]. The test first checks if the<br>
> plane is atomic and has the hotspot property.<br>
> and if it does, it sets different random hot_x<br>
> and hot_y values and checks that it is updated<br>
> correctly after an atomic commit.<br>
> <br>
> [1] <a href="https://lists.freedesktop.org/archives/dri-devel/2023-July/414509.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/dri-devel/2023-July/414509.html</a><br>
> <br>
<br>
Please keep maintain the history of the patch.<br>
<br>
Example:<br>
<br>
V2: - Changes on top of Initial version<br>
V3: - Changes between V2 & Current version<br>
<br>
You can update this info while merging the patch. With above comments <br>
addressed, this patch is<br>
<br>
Reviewed-by: Bhanuprakash Modem <<a href="mailto:bhanuprakash.modem@intel.com" target="_blank">bhanuprakash.modem@intel.com</a>><br></blockquote><div><br></div><div>Thanks.</div><div><br></div><div>I should've tracked the history in the cover letters, my bad.</div><div><br></div><div>Do you mean to track it in the commit message?</div><div>Also, what do you mean I can update it while merging? I do not have</div><div>permissions to merge. Should I push a new revision?</div><div><br></div><div>BR,</div><div>Albert.</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>
> Signed-off-by: Albert Esteve <<a href="mailto:aesteve@redhat.com" target="_blank">aesteve@redhat.com</a>><br>
> Acked-by: Javier Martinez Canillas <<a href="mailto:javierm@redhat.com" target="_blank">javierm@redhat.com</a>><br>
> Acked-by: Zbigniew Kempczyński <<a href="mailto:zbigniew.kempczynski@intel.com" target="_blank">zbigniew.kempczynski@intel.com</a>><br>
> ---<br>
> tests/kms_cursor_legacy.c | 79 +++++++++++++++++++++++++++++++++++++++<br>
> 1 file changed, 79 insertions(+)<br>
> <br>
> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c<br>
> index 1ebac9d31..87cfb9e64 100644<br>
> --- a/tests/kms_cursor_legacy.c<br>
> +++ b/tests/kms_cursor_legacy.c<br>
> @@ -218,6 +218,12 @@ static igt_plane_t<br>
> return cursor;<br>
> }<br>
> <br>
> +static void set_cursor_hotspot(igt_plane_t *cursor, int hot_x, int hot_y)<br>
> +{<br>
> + igt_output_set_prop_value(cursor, IGT_PLANE_HOTSPOT_X, hot_x);<br>
> + igt_output_set_prop_value(cursor, IGT_PLANE_HOTSPOT_Y, hot_y);<br>
> +}<br>
> +<br>
> static void populate_cursor_args(igt_display_t *display, enum pipe pipe,<br>
> struct drm_mode_cursor *arg, struct igt_fb *fb)<br>
> {<br>
> @@ -1607,6 +1613,68 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)<br>
> put_ahnd(ahnd);<br>
> }<br>
> <br>
> +static void modeset_atomic_cursor_hotspot(igt_display_t *display)<br>
> +{<br>
> + struct igt_fb cursor_fb;<br>
> + igt_output_t *output;<br>
> + enum pipe pipe;<br>
> + igt_plane_t *cursor = NULL;<br>
> + bool has_hotspot_prop;<br>
> + uint64_t cursor_width, cursor_height;<br>
> + uint32_t hot_x, hot_y, init_hot_x, init_hot_y;<br>
> +<br>
> + igt_require(display->is_atomic);<br>
> + igt_require(display->has_virt_cursor_plane);<br>
> + pipe = find_connected_pipe(display, false, &output);<br>
> + igt_require(output);<br>
> +<br>
> + igt_info("Using pipe %s & %s\n",<br>
> + kmstest_pipe_name(pipe), igt_output_name(output));<br>
> +<br>
> + cursor_width = cursor_height = 64;<br>
> + igt_create_color_fb(display->drm_fd, cursor_width, cursor_height, DRM_FORMAT_ARGB8888,<br>
> + DRM_FORMAT_MOD_LINEAR, 1., 1., 1., &cursor_fb);<br>
> +<br>
> + igt_display_commit2(display, COMMIT_ATOMIC);<br>
> +<br>
> + cursor = set_cursor_on_pipe(display, pipe, &cursor_fb);<br>
> +<br>
> + has_hotspot_prop = cursor->props[IGT_PLANE_HOTSPOT_X] ||<br>
> + cursor->props[IGT_PLANE_HOTSPOT_Y];<br>
> + igt_require_f(has_hotspot_prop, "Cursor plane lacks the hotspot property");<br>
> +<br>
> + init_hot_x = igt_plane_get_prop(cursor, IGT_PLANE_HOTSPOT_X);<br>
> + init_hot_y = igt_plane_get_prop(cursor, IGT_PLANE_HOTSPOT_Y);<br>
> +<br>
> + /*<br>
> + * Change the hotspot coordinates randomly and check that the property<br>
> + * is updated accordingly.<br>
> + */<br>
> + srand(time(NULL));<br>
> + for (int i = 0; i < 20; i++) {<br>
> + hot_x = rand() % cursor_width;<br>
> + hot_y = rand() % cursor_height;<br>
> + igt_debug("Update cursor hotspot: (%d, %d)\n", hot_x, hot_y);<br>
> +<br>
> + /* Set cursor hotspot property values */<br>
> + set_cursor_hotspot(cursor, hot_x, hot_y);<br>
> +<br>
> + igt_display_commit2(display, COMMIT_ATOMIC);<br>
> +<br>
> + /* After the commit, the cursor hotspot property values are updated */<br>
> + igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_HOTSPOT_X), hot_x);<br>
> + igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_HOTSPOT_Y), hot_y);<br>
> + }<br>
> +<br>
> + /* Clean-up */<br>
> + set_cursor_hotspot(cursor, init_hot_x, init_hot_y);<br>
> + igt_plane_set_fb(cursor, NULL);<br>
> + igt_output_set_pipe(output, PIPE_NONE);<br>
> + igt_display_commit2(display, COMMIT_ATOMIC);<br>
> +<br>
> + igt_remove_fb(display->drm_fd, &cursor_fb);<br>
> +}<br>
> +<br>
> igt_main<br>
> {<br>
> const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);<br>
> @@ -1681,6 +1749,17 @@ igt_main<br>
> nonblocking_modeset_vs_cursor(&display, 16);<br>
> }<br>
> <br>
> + igt_describe("Test changes the cursor hotspot and checks that the "<br>
> + "property is updated accordignly");<br>
> + igt_subtest_group {<br>
> + igt_fixture<br>
> + igt_display_require_output(&display);<br>
> +<br>
> + igt_subtest("modeset-atomic-cursor-hotspot") {<br>
> + modeset_atomic_cursor_hotspot(&display);<br>
> + }<br>
> + }<br>
> +<br>
> igt_describe("This test executes flips on both CRTCs "<br>
> "while running cursor updates in parallel");<br>
> igt_subtest_group {<br>
<br>
</blockquote></div></div>