Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: kevin.rogovin@intel.com
To: intel-gfx@lists.freedesktop.org
Cc: Kevin Rogovin <kevin.rogovin@intel.com>
Subject: [PATCH 3/3] i965: check scratch page in a locked fashion on each ioctl
Date: Tue,  5 Dec 2017 09:48:14 +0200	[thread overview]
Message-ID: <1512460094-4615-4-git-send-email-kevin.rogovin@intel.com> (raw)
In-Reply-To: <1512460094-4615-1-git-send-email-kevin.rogovin@intel.com>

From: Kevin Rogovin <kevin.rogovin@intel.com>

---
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 216073129b..53b3eaf49b 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -804,7 +804,8 @@ static int
 submit_batch(struct brw_context *brw, int in_fence_fd, int *out_fence_fd)
 {
    const struct gen_device_info *devinfo = &brw->screen->devinfo;
-   __DRIscreen *dri_screen = brw->screen->driScrnPriv;
+   struct intel_screen *screen = brw->screen;
+   __DRIscreen *dri_screen = screen->driScrnPriv;
    struct intel_batchbuffer *batch = &brw->batch;
    int ret = 0;
 
@@ -875,10 +876,34 @@ submit_batch(struct brw_context *brw, int in_fence_fd, int *out_fence_fd)
          batch->validation_list[index] = tmp;
       }
 
+      if (unlikely(screen->debug_batchbuffer.enabled)) {
+         simple_mtx_lock(&screen->debug_batchbuffer.mutex);
+      }
+
       ret = execbuffer(dri_screen->fd, batch, hw_ctx,
                        4 * USED_BATCH(*batch),
                        in_fence_fd, out_fence_fd, flags);
 
+      if (unlikely(screen->debug_batchbuffer.enabled)) {
+         struct drm_i915_scratch_page sc;
+         int ret;
+
+         while (brw_bo_busy(batch->bo)) {
+            usleep(10);
+         }
+
+         sc.buffer_size = screen->debug_batchbuffer.buffer_size;
+         sc.buffer_ptr = (__u64)(uintptr_t) screen->debug_batchbuffer.tmp;
+
+         ret = drmIoctl(dri_screen->fd, DRM_IOCTL_I915_READ_SCRATCH_PAGE, &sc);
+         assert(ret == 0);
+         assert(sc.buffer_size == screen->debug_batchbuffer.buffer_size);
+         assert(memcmp(screen->debug_batchbuffer.tmp,
+                       screen->debug_batchbuffer.noise_values,
+                       screen->debug_batchbuffer.buffer_size) == 0);
+         simple_mtx_unlock(&screen->debug_batchbuffer.mutex);
+      }
+
       throttle(brw);
    }
 
-- 
2.15.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-12-05  7:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05  7:48 [PATCH 0/3] RFC: Scratch page checking kevin.rogovin
2017-12-05  7:48 ` [PATCH 1/3] drm-uapi: define interface to kernel for scratch page read kevin.rogovin
2017-12-05  7:57   ` Rogovin, Kevin
2017-12-05  7:48 ` [PATCH 2/3] i965: define stuff for scratch page checking in intel_screen kevin.rogovin
2017-12-05  7:58   ` Rogovin, Kevin
2017-12-05  7:48 ` kevin.rogovin [this message]
2017-12-05 10:07   ` [PATCH 3/3] i965: check scratch page in a locked fashion on each ioctl Chris Wilson
2017-12-05 10:30     ` Rogovin, Kevin
2017-12-05 10:39       ` Chris Wilson
2017-12-05 10:41         ` Rogovin, Kevin
2017-12-05 13:59           ` Joonas Lahtinen

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=1512460094-4615-4-git-send-email-kevin.rogovin@intel.com \
    --to=kevin.rogovin@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox