intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: intel-gfx@lists.freedesktop.org
Cc: mesa-dev@lists.freedesktop.org, Ben Widawsky <ben@bwidawsk.net>
Subject: [PATCH 03/10] i965: Reserve scratch space for debugger communication
Date: Sun, 17 Jul 2011 16:25:41 -0700	[thread overview]
Message-ID: <1310945148-6777-4-git-send-email-ben@bwidawsk.net> (raw)
In-Reply-To: <1310945148-6777-1-git-send-email-ben@bwidawsk.net>

Since the debug system routine will share scratch space with threads
doing register spilling, we must offset the registers to accommodate.
This is more easily accomplished (and less bug prone) in Mesa.

The debugger will only work with the new fragment shader backend.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp |   15 +++++++++++++--
 src/mesa/drivers/dri/i965/brw_wm_emit.c   |    2 ++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
index 1d89b8f..2cd613a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
@@ -455,6 +455,17 @@ fs_visitor::generate_discard(fs_inst *inst)
    }
 }
 
+static GLuint
+brw_get_scratch_offset(struct brw_context *brw, fs_inst *inst)
+{
+   /* Split buffer 50-50 */
+   if (brw->wm.debugging) {
+      return inst->offset + (brw->wm.scratch_bo->size / brw->wm_max_threads) / 2;
+   } else {
+      return inst->offset;
+   }
+}
+
 void
 fs_visitor::generate_spill(fs_inst *inst, struct brw_reg src)
 {
@@ -464,7 +475,7 @@ fs_visitor::generate_spill(fs_inst *inst, struct brw_reg src)
 	   retype(brw_message_reg(inst->base_mrf + 1), BRW_REGISTER_TYPE_UD),
 	   retype(src, BRW_REGISTER_TYPE_UD));
    brw_oword_block_write_scratch(p, brw_message_reg(inst->base_mrf), 1,
-				 inst->offset);
+				 brw_get_scratch_offset(brw, inst));
 }
 
 void
@@ -486,7 +497,7 @@ fs_visitor::generate_unspill(fs_inst *inst, struct brw_reg dst)
       brw_MOV(p, brw_null_reg(), dst);
 
    brw_oword_block_read_scratch(p, dst, brw_message_reg(inst->base_mrf), 1,
-				inst->offset);
+				brw_get_scratch_offset(brw, inst));
 
    if (intel->gen == 4 && !intel->is_g4x) {
       /* gen4 errata: destination from a send can't be used as a
diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index f61757a..4ac94ee 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -1560,6 +1560,8 @@ static void emit_spill( struct brw_wm_compile *c,
      mov (1) r0.2<1>:d    0x00000080:d     { Align1 NoMask }
      send (16) null.0<1>:uw m1               r0.0<8;8,1>:uw   0x053003ff:ud    { Align1 }
    */
+   if (p->brw->wm.debugging)
+      abort();
    brw_oword_block_write_scratch(p, brw_message_reg(1), 2, slot);
 }
 
-- 
1.7.6

  parent reply	other threads:[~2011-07-17 23:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-17 23:25 [PATCH 00/10] fs debugging: incorporated Chris' feedback Ben Widawsky
2011-07-17 23:25 ` [PATCH 01/10] intel: shared header for shader debugging Ben Widawsky
2011-07-17 23:25 ` [PATCH 02/10] i965: copy in system routine, reserve extra scratch Ben Widawsky
2011-07-17 23:25 ` Ben Widawsky [this message]
2011-07-17 23:25 ` [PATCH 04/10] i965: setup system routine Ben Widawsky
2011-07-18 18:19   ` [Intel-gfx] " Eric Anholt
2011-07-19  4:48     ` Ben Widawsky
2011-07-17 23:25 ` [PATCH 05/10] i965: emit breakpoints Ben Widawsky
2011-07-17 23:25 ` [PATCH 06/10] i965: attach to a listening debugger Ben Widawsky
2011-07-17 23:25 ` [PATCH 07/10] intel-gpu-tools: register range handling for forcewake hooks Ben Widawsky
2011-07-17 23:25 ` [PATCH 08/10] intel-gpu-tools/forcewaked: sample forcewake app Ben Widawsky
2011-07-17 23:25 ` [PATCH 09/10] debugging: add important debug regs Ben Widawsky
2011-07-17 23:25 ` [PATCH 10/10] debugging: shader debugging Ben Widawsky
  -- strict thread matches above, loose matches on Subject: below --
2011-07-13 20:51 [PATCH 0/10] fs " Ben Widawsky
2011-07-13 20:51 ` [PATCH 03/10] i965: Reserve scratch space for debugger communication Ben Widawsky

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=1310945148-6777-4-git-send-email-ben@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mesa-dev@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;
as well as URLs for NNTP newsgroup(s).