panfrost: Import streamout data structures
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 6 Aug 2019 23:43:28 +0000 (16:43 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 9 Aug 2019 18:53:21 +0000 (11:53 -0700)
Pretty much copypasted from v3d to jumpstart us.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h

index 2fc5ac3619799091e14f0ed792be251498bf94fd..26df0caa70664ad065bb00f18a61050aef5d090e 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * © Copyright 2018 Alyssa Rosenzweig
+ * Copyright © 2014-2017 Broadcom
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -2670,7 +2671,22 @@ panfrost_set_stream_output_targets(struct pipe_context *pctx,
                                    struct pipe_stream_output_target **targets,
                                    const unsigned *offsets)
 {
-        /* STUB */
+        struct panfrost_context *ctx = pan_context(pctx);
+        struct panfrost_streamout *so = &ctx->streamout;
+
+        assert(num_targets <= ARRAY_SIZE(so->targets));
+
+        for (unsigned i = 0; i < num_targets; i++) {
+                if (offsets[i] != -1)
+                        so->offsets[i] = offsets[i];
+
+                pipe_so_target_reference(&so->targets[i], targets[i]);
+        }
+
+        for (unsigned i = 0; i < so->num_targets; i++)
+                pipe_so_target_reference(&so->targets[i], NULL);
+
+        so->num_targets = num_targets;
 }
 
 static void
index 9a34e243b74b7a2a44123fedf328118c488a5ca7..4e32a691200af7000931450ee27a4234a683b7ea 100644 (file)
@@ -88,6 +88,12 @@ struct panfrost_fence {
         int fd;
 };
 
+struct panfrost_streamout {
+        struct pipe_stream_output_target *targets[PIPE_MAX_SO_BUFFERS];
+        uint32_t offsets[PIPE_MAX_SO_BUFFERS];
+        unsigned num_targets;
+};
+
 struct panfrost_context {
         /* Gallium context */
         struct pipe_context base;
@@ -106,6 +112,7 @@ struct panfrost_context {
         unsigned draw_modes;
 
         struct pipe_framebuffer_state pipe_framebuffer;
+        struct panfrost_streamout streamout;
 
         struct panfrost_memory cmdstream_persistent;
         struct panfrost_memory scratchpad;