summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-11-24 22:11:11 -0800
committerEric Anholt <[email protected]>2017-12-01 15:37:28 -0800
commit842b05d6ad8da895bc300ad9652bc09e2b0b1959 (patch)
treeaf65bf7e0a86a1d37929b984dc552fa08f3773ea /src/gallium/drivers/vc4
parent84ab48c15c9373dfa4709f4f9e887c329286e5a1 (diff)
broadcom/vc4: Simplify the relocation handling for index buffers.
Originally there was CL code for handling various relocations back when I had relocs for the TSDA/TA buffers. Now that the kernel handles those entirely on its own, I can inline that code into the one place using it.
Diffstat (limited to 'src/gallium/drivers/vc4')
-rw-r--r--src/gallium/drivers/vc4/vc4_cl.h15
-rw-r--r--src/gallium/drivers/vc4/vc4_draw.c19
2 files changed, 17 insertions, 17 deletions
diff --git a/src/gallium/drivers/vc4/vc4_cl.h b/src/gallium/drivers/vc4/vc4_cl.h
index 8df9dbfe65a..39d1d347bba 100644
--- a/src/gallium/drivers/vc4/vc4_cl.h
+++ b/src/gallium/drivers/vc4/vc4_cl.h
@@ -159,21 +159,6 @@ cl_aligned_f(struct vc4_cl_out **cl, float f)
cl_aligned_u32(cl, fui(f));
}
-static inline void
-cl_start_reloc(struct vc4_cl *cl, struct vc4_cl_out **out, uint32_t n)
-{
- assert(n == 1 || n == 2);
- assert(cl->reloc_count == 0);
-#ifndef NDEBUG
- cl->reloc_count = n;
-#endif
-
- cl_u8(out, VC4_PACKET_GEM_HANDLES);
- cl->reloc_next = *out;
- cl_u32(out, 0); /* Space where hindex will be written. */
- cl_u32(out, 0); /* Space where hindex will be written. */
-}
-
static inline struct vc4_cl_out *
cl_start_shader_reloc(struct vc4_cl *cl, uint32_t n)
{
diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index 6fd25b45b98..fd80f67b6a1 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -377,7 +377,21 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
struct vc4_resource *rsc = vc4_resource(prsc);
struct vc4_cl_out *bcl = cl_start(&job->bcl);
- cl_start_reloc(&job->bcl, &bcl, 1);
+
+ /* The original design for the VC4 kernel UABI had multiple
+ * packets that used relocations in the BCL (some of which
+ * needed two BOs), but later modifications eliminated all but
+ * this one usage. We have an arbitrary 32-bit offset value,
+ * and need to also supply an arbitrary 32-bit index buffer
+ * GEM handle, so we have this fake packet we emit in our BCL
+ * to be validated, which the kernel uses at validation time
+ * to perform the relocation in the IB packet (without
+ * emitting to the actual HW).
+ */
+ cl_u8(&bcl, VC4_PACKET_GEM_HANDLES);
+ cl_u32(&bcl, vc4_gem_hindex(job, rsc->bo));
+ cl_u32(&bcl, 0);
+
cl_u8(&bcl, VC4_PACKET_GL_INDEXED_PRIMITIVE);
cl_u8(&bcl,
info->mode |
@@ -385,8 +399,9 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
VC4_INDEX_BUFFER_U16:
VC4_INDEX_BUFFER_U8));
cl_u32(&bcl, info->count);
- cl_reloc(job, &job->bcl, &bcl, rsc->bo, offset);
+ cl_u32(&bcl, offset);
cl_u32(&bcl, vc4->max_index);
+
cl_end(&job->bcl, bcl);
job->draw_calls_queued++;