summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_batch.h
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-05-20 15:36:10 -0400
committerRob Clark <[email protected]>2016-07-30 09:23:42 -0400
commit9bbd239a4039522d7c1023ecb21764679447bb2d (patch)
treede6633fb1936d05c929e34a88987c69884ed45f9 /src/gallium/drivers/freedreno/freedreno_batch.h
parent12aec78993edface7f530eede9e018b5fa1897b7 (diff)
freedreno: introduce fd_batch
Introduce the batch object, to track a batch/submit's worth of ringbuffers and other bookkeeping. In this first step, just move the ringbuffers into batch, since that is mostly uninteresting churn. For now there is just a single batch at a time. Note that one outcome of this change is that rb's are allocated/freed on each use. But the expectation is that the bo pool in libdrm_freedreno will save us the GEM bo alloc/free which was the initial reason to implement a rb pool in gallium. The purpose of the batch is to eventually facilitate out-of-order rendering, with batches associated to framebuffer state, and tracking the dependencies on other batches. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_batch.h')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_batch.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h
new file mode 100644
index 00000000000..2134624f833
--- /dev/null
+++ b/src/gallium/drivers/freedreno/freedreno_batch.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2016 Rob Clark <[email protected]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ * Rob Clark <[email protected]>
+ */
+
+#ifndef FREEDRENO_BATCH_H_
+#define FREEDRENO_BATCH_H_
+
+#include "util/u_inlines.h"
+
+#include "freedreno_util.h"
+
+struct fd_context;
+
+/* A batch tracks everything about a cmdstream batch/submit, including the
+ * ringbuffers used for binning, draw, and gmem cmds, list of associated
+ * fd_resource-s, etc.
+ */
+struct fd_batch {
+ struct pipe_reference reference;
+ unsigned seqno;
+ struct fd_context *ctx;
+
+ /** draw pass cmdstream: */
+ struct fd_ringbuffer *draw;
+ /** binning pass cmdstream: */
+ struct fd_ringbuffer *binning;
+ /** tiling/gmem (IB0) cmdstream: */
+ struct fd_ringbuffer *gmem;
+};
+
+struct fd_batch * fd_batch_create(struct fd_context *ctx);
+
+void fd_batch_flush(struct fd_batch *batch);
+void fd_batch_check_size(struct fd_batch *batch);
+
+/* not called directly: */
+void __fd_batch_describe(char* buf, const struct fd_batch *batch);
+void __fd_batch_destroy(struct fd_batch *batch);
+
+static inline void
+fd_batch_reference(struct fd_batch **ptr, struct fd_batch *batch)
+{
+ struct fd_batch *old_batch = *ptr;
+ if (pipe_reference_described(&(*ptr)->reference, &batch->reference,
+ (debug_reference_descriptor)__fd_batch_describe))
+ __fd_batch_destroy(old_batch);
+ *ptr = batch;
+}
+
+#endif /* FREEDRENO_BATCH_H_ */