[Mesa-dev] [PATCH 5/5] swr: add streamout buffer offset into pBuffer pointer

Rowley, Timothy O timothy.o.rowley at intel.com
Wed Nov 30 23:28:06 UTC 2016


Reviewed-by: Tim Rowley <timothy.o.rowley at intel.com<mailto:timothy.o.rowley at intel.com>>

On Nov 29, 2016, at 8:23 PM, Ilia Mirkin <imirkin at alum.mit.edu<mailto:imirkin at alum.mit.edu>> wrote:

The buffer_size does not take the offset into account. Just add the
offset into the pointer which lines up the structures much better.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu<mailto:imirkin at alum.mit.edu>>
---

This doesn't really fix anything right now, but logically the streamOffset
is incremented on each draw, and is optionally written back out as a watermark
indicator (for pausing/resuming streams). So it should be relative to the
logical start of the buffer.

src/gallium/drivers/swr/swr_state.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index fc835dc..4475252 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -1488,10 +1488,11 @@ swr_update_derived(struct pipe_context *pipe,
            continue;
         buffer.enable = true;
         buffer.pBuffer =
-            (uint32_t *)swr_resource_data(ctx->so_targets[i]->buffer);
+            (uint32_t *)(swr_resource_data(ctx->so_targets[i]->buffer) +
+                         ctx->so_targets[i]->buffer_offset);
         buffer.bufferSize = ctx->so_targets[i]->buffer_size >> 2;
         buffer.pitch = stream_output->stride[i];
-         buffer.streamOffset = ctx->so_targets[i]->buffer_offset >> 2;
+         buffer.streamOffset = 0;

         SwrSetSoBuffers(ctx->swrContext, &buffer, i);
      }
--
2.7.3


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161130/f9fe895e/attachment.html>


More information about the mesa-dev mailing list