<div dir="ltr">On 6 February 2013 23:26, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Untyped Atomic Operation messages are illegal for non-RAW formats.<br>
I have no idea why it worked before; the documentation claims it<br>
shouldn't be allowed and the simulator enforces it.<br>
<br>
Some arithmetic sleight of hand happens in this patch:<br>
<br>
Previously, we allocated a R32G32B32A32 buffer. However, atomic<br>
operations only access the first DWord (the 'R' channel). Thus, we<br>
multiplied all of our offsets (measured in DWords) by 4 to skip over<br>
the other three channels.<br>
<br>
Now, we allocate a single component (effectively R32) buffer,<br>
eliminating the wasted space. Using the RAW format means that our<br>
offsets must be measured in bytes (and must be DWord-aligned). This<br>
means that the multiplication by 4 is still necessary. However, instead<br>
of skipping over the BGA components, it converts DWords to bytes.<br>
<br>
We ought to change the size of the buffer, but I'm pretty sure it was<br>
just wrong before: brw->shader_time.bo->size is measured in bytes, so<br>
we were allocating it too large in the past.<br>
<br>
NOTE: This is a candidate for the 9.1 branch.<br>
Cc: Eric Anholt <<a href="mailto:eric@anholt.net">eric@anholt.net</a>><br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br></blockquote><div><br></div><div>Thanks for explaining the arithmetic sleight of hand here :) This patch is:<br>
<br></div><div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/mesa/drivers/dri/i965/brw_defines.h | 1 +<br>
src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 5 ++---<br>
2 files changed, 3 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h<br>
index 849d127..6652cad 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_defines.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_defines.h<br>
@@ -437,6 +437,7 @@<br>
#define BRW_SURFACEFORMAT_B10G10R10A2_SSCALED 0x1B9<br>
#define BRW_SURFACEFORMAT_B10G10R10A2_UINT 0x1BA<br>
#define BRW_SURFACEFORMAT_B10G10R10A2_SINT 0x1BB<br>
+#define BRW_SURFACEFORMAT_RAW 0x1FF<br>
#define BRW_SURFACE_FORMAT_SHIFT 18<br>
#define BRW_SURFACE_FORMAT_MASK INTEL_MASK(26, 18)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c<br>
index 6a4c009..5cf9da0 100644<br>
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c<br>
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c<br>
@@ -435,15 +435,14 @@ gen7_create_shader_time_surface(struct brw_context *brw, uint32_t *out_offset)<br>
8 * 4, 32, out_offset);<br>
<br>
surf[0] = BRW_SURFACE_BUFFER << BRW_SURFACE_TYPE_SHIFT |<br>
- BRW_SURFACEFORMAT_R32G32B32A32_FLOAT << BRW_SURFACE_FORMAT_SHIFT |<br>
+ BRW_SURFACEFORMAT_RAW << BRW_SURFACE_FORMAT_SHIFT |<br>
BRW_SURFACE_RC_READ_WRITE;<br>
<br>
surf[1] = brw->shader_time.bo->offset; /* reloc */<br>
<br>
surf[2] = SET_FIELD(w & 0x7f, GEN7_SURFACE_WIDTH) |<br>
SET_FIELD((w >> 7) & 0x1fff, GEN7_SURFACE_HEIGHT);<br>
- surf[3] = SET_FIELD((w >> 20) & 0x7f, BRW_SURFACE_DEPTH) |<br>
- (16 - 1); /* stride between samples */<br>
+ surf[3] = SET_FIELD((w >> 20) & 0x7f, BRW_SURFACE_DEPTH);<br>
<br>
/* Emit relocation to surface contents. Section 5.1.1 of the gen4<br>
* bspec ("Data Cache") says that the data cache does not exist as<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>