From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH igt] igt/kms_cursor_legacy: Use common spinbatch
Date: Thu, 21 Sep 2017 14:14:05 +0300 [thread overview]
Message-ID: <20170921111405.GF4914@intel.com> (raw)
In-Reply-To: <20170914131934.17637-1-chris@chris-wilson.co.uk>
On Thu, Sep 14, 2017 at 02:19:34PM +0100, Chris Wilson wrote:
> Remove the local recursive spinner in favour of igt_spin_t.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> tests/kms_cursor_legacy.c | 103 ++++------------------------------------------
> 1 file changed, 9 insertions(+), 94 deletions(-)
>
> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
> index 2d32d3a9..fb365f12 100644
> --- a/tests/kms_cursor_legacy.c
> +++ b/tests/kms_cursor_legacy.c
> @@ -490,92 +490,6 @@ enum basic_flip_cursor {
> FLIP_AFTER_CURSOR
> };
>
> -static uint32_t *make_busy(int fd, uint32_t target)
> -{
> - const int gen = intel_gen(intel_get_drm_devid(fd));
> - struct drm_i915_gem_exec_object2 obj[2];
> - struct drm_i915_gem_relocation_entry reloc[2];
> - struct drm_i915_gem_execbuffer2 execbuf;
> - uint32_t *batch;
> - int i;
> -
> - memset(&execbuf, 0, sizeof(execbuf));
> - execbuf.buffers_ptr = (uintptr_t)obj;
> - execbuf.buffer_count = 2;
> -
> - memset(obj, 0, sizeof(obj));
> - obj[0].handle = target;
> - obj[1].handle = gem_create(fd, 4096);
> - batch = gem_mmap__wc(fd, obj[1].handle, 0, 4096, PROT_WRITE);
> - gem_set_domain(fd, obj[1].handle,
> - I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> -
> -
> - obj[1].relocs_ptr = (uintptr_t)reloc;
> - obj[1].relocation_count = 2;
> - memset(reloc, 0, sizeof(reloc));
> -
> - reloc[0].target_handle = obj[1].handle; /* recurse */
> - reloc[0].presumed_offset = 0;
> - reloc[0].offset = sizeof(uint32_t);
> - reloc[0].delta = 0;
> - reloc[0].read_domains = I915_GEM_DOMAIN_COMMAND;
> - reloc[0].write_domain = 0;
> -
> - reloc[1].target_handle = target;
> - reloc[1].presumed_offset = 0;
> - reloc[1].offset = 1024;
> - reloc[1].delta = 0;
> - reloc[1].read_domains = I915_GEM_DOMAIN_COMMAND;
> - reloc[1].write_domain = I915_GEM_DOMAIN_COMMAND;
> -
> - i = 0;
> - batch[i] = MI_BATCH_BUFFER_START;
> - if (gen >= 8) {
> - batch[i] |= 1 << 8 | 1;
> - batch[++i] = 0;
> - batch[++i] = 0;
> - } else if (gen >= 6) {
> - batch[i] |= 1 << 8;
> - batch[++i] = 0;
> - } else {
> - batch[i] |= 2 << 6;
> - batch[++i] = 0;
> - if (gen < 4) {
> - batch[i] |= 1;
> - reloc[0].delta = 1;
> - }
> - }
> - i++;
> -
> - gem_execbuf(fd, &execbuf);
> - gem_close(fd, obj[1].handle);
> -
> - return batch;
> -}
> -
> -static void cancel_busy(uint32_t *busy)
> -{
> - *busy = MI_BATCH_BUFFER_END;
> - munmap(busy, 4096);
> -}
> -
> -static uint32_t *
> -make_fb_busy(int fd, const struct igt_fb *fb)
> -{
> - uint32_t *busy;
> -
> - busy = make_busy(fd, fb->gem_handle);
> - igt_assert(gem_bo_busy(fd, fb->gem_handle));
> -
> - return busy;
> -}
> -
> -static void finish_fb_busy(uint32_t *busy)
> -{
> - cancel_busy(busy);
> -}
> -
> #define BASIC_BUSY 0x1
>
> static void basic_flip_cursor(igt_display_t *display,
> @@ -588,7 +502,7 @@ static void basic_flip_cursor(igt_display_t *display,
> struct igt_fb fb_info, cursor_fb, cursor_fb2, argb_fb;
> unsigned vblank_start;
> enum pipe pipe = find_connected_pipe(display, false);
> - uint32_t *busy;
> + igt_spin_t *spin;
> int i, miss1 = 0, miss2 = 0, delta;
>
> if (mode >= flip_test_atomic)
> @@ -616,9 +530,9 @@ static void basic_flip_cursor(igt_display_t *display,
> /* Bind the cursor first to warm up */
> do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg[0]);
>
> - busy = NULL;
> + spin = NULL;
> if (flags & BASIC_BUSY)
> - busy = make_fb_busy(display->drm_fd, &fb_info);
> + spin = igt_spin_batch_new(display->drm_fd, 0, 0, fb_info.gem_handle);
>
> /* Start with a synchronous query to align with the vblank */
> vblank_start = get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
> @@ -660,10 +574,10 @@ static void basic_flip_cursor(igt_display_t *display,
>
> delta = get_vblank(display->drm_fd, pipe, 0) - vblank_start;
>
> - if (busy) {
> + if (spin) {
> struct pollfd pfd = { display->drm_fd, POLLIN };
> igt_assert(poll(&pfd, 1, 0) == 0);
> - finish_fb_busy(busy);
> + igt_spin_batch_free(display->drm_fd, spin);
> }
>
> if (miss)
> @@ -1373,9 +1287,10 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>
> /* Disable cursor, and immediately queue a flip. Check if resulting crc is correct. */
> for (int i = 1; i >= 0; i--) {
> - uint32_t *busy;
> + igt_spin_t *spin;
>
> - busy = make_fb_busy(display->drm_fd, &fb_info[1]);
> + spin = igt_spin_batch_new(display->drm_fd, 0, 0,
> + fb_info[1].gem_handle);
>
> vblank_start = get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
>
> @@ -1386,7 +1301,7 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
>
> igt_pipe_crc_collect_crc(pipe_crc, &crcs[2]);
>
> - finish_fb_busy(busy);
> + igt_spin_batch_free(display->drm_fd, spin);
>
> igt_set_timeout(1, "Stuck page flip");
> igt_ignore_warn(read(display->drm_fd, &vbl, sizeof(vbl)));
> --
> 2.14.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2017-09-21 11:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 13:19 [PATCH igt] igt/kms_cursor_legacy: Use common spinbatch Chris Wilson
2017-09-14 13:41 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-09-14 16:11 ` ✓ Fi.CI.IGT: " Patchwork
2017-09-21 11:14 ` Ville Syrjälä [this message]
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=20170921111405.GF4914@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@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 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.