aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_state.c
diff options
context:
space:
mode:
authorSagar Ghuge <[email protected]>2019-03-06 13:27:28 -0800
committerSagar Ghuge <[email protected]>2019-03-08 10:01:39 -0800
commitd0a8fba69a300824ac83c8dad7985fe31885aef3 (patch)
tree7c1127dda70a8996fd09e41afcc69e67542d6810 /src/gallium/drivers/iris/iris_state.c
parent6e3d3f5b2c90ed79de85f69d4e0cc9b1b0760158 (diff)
iris: Refactor code to share 3DSTATE_URB_* packet
v2: 1) Set IRIS_DIRTY_URB bit (Caio) 2) Get rid of unnecessary function (Caio) Signed-off-by: Sagar Ghuge <[email protected]> Suggested-by: Caio Marcelo de Oliveira Filho <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_state.c')
-rw-r--r--src/gallium/drivers/iris/iris_state.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index f8d23dd784b..c6dc065dc3b 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -3670,47 +3670,6 @@ iris_store_derived_program_state(struct iris_context *ice,
/* ------------------------------------------------------------------- */
-/**
- * Configure the URB.
- *
- * XXX: write a real comment.
- */
-static void
-iris_upload_urb_config(struct iris_context *ice, struct iris_batch *batch)
-{
- const struct gen_device_info *devinfo = &batch->screen->devinfo;
- const unsigned push_size_kB = 32;
- unsigned entries[4];
- unsigned start[4];
- unsigned size[4];
-
- for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_GEOMETRY; i++) {
- if (!ice->shaders.prog[i]) {
- size[i] = 1;
- } else {
- struct brw_vue_prog_data *vue_prog_data =
- (void *) ice->shaders.prog[i]->prog_data;
- size[i] = vue_prog_data->urb_entry_size;
- }
- assert(size[i] != 0);
- }
-
- gen_get_urb_config(devinfo, 1024 * push_size_kB,
- 1024 * ice->shaders.urb_size,
- ice->shaders.prog[MESA_SHADER_TESS_EVAL] != NULL,
- ice->shaders.prog[MESA_SHADER_GEOMETRY] != NULL,
- size, entries, start);
-
- for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_GEOMETRY; i++) {
- iris_emit_cmd(batch, GENX(3DSTATE_URB_VS), urb) {
- urb._3DCommandSubOpcode += i;
- urb.VSURBStartingAddress = start[i];
- urb.VSURBEntryAllocationSize = size[i] - 1;
- urb.VSNumberofURBEntries = entries[i];
- }
- }
-}
-
static const uint32_t push_constant_opcodes[] = {
[MESA_SHADER_VERTEX] = 21,
[MESA_SHADER_TESS_CTRL] = 25, /* HS */
@@ -4309,7 +4268,22 @@ iris_upload_dirty_render_state(struct iris_context *ice,
}
if (dirty & IRIS_DIRTY_URB) {
- iris_upload_urb_config(ice, batch);
+ unsigned size[4];
+
+ for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_GEOMETRY; i++) {
+ if (!ice->shaders.prog[i]) {
+ size[i] = 1;
+ } else {
+ struct brw_vue_prog_data *vue_prog_data =
+ (void *) ice->shaders.prog[i]->prog_data;
+ size[i] = vue_prog_data->urb_entry_size;
+ }
+ assert(size[i] != 0);
+ }
+
+ genX(emit_urb_setup)(ice, batch, size,
+ ice->shaders.prog[MESA_SHADER_TESS_EVAL] != NULL,
+ ice->shaders.prog[MESA_SHADER_GEOMETRY] != NULL);
}
if (dirty & IRIS_DIRTY_BLEND_STATE) {
@@ -5882,6 +5856,32 @@ iris_emit_raw_pipe_control(struct iris_batch *batch, uint32_t flags,
}
void
+genX(emit_urb_setup)(struct iris_context *ice,
+ struct iris_batch *batch,
+ const unsigned size[4],
+ bool tess_present, bool gs_present)
+{
+ const struct gen_device_info *devinfo = &batch->screen->devinfo;
+ const unsigned push_size_kB = 32;
+ unsigned entries[4];
+ unsigned start[4];
+
+ gen_get_urb_config(devinfo, 1024 * push_size_kB,
+ 1024 * ice->shaders.urb_size,
+ tess_present, gs_present,
+ size, entries, start);
+
+ for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_GEOMETRY; i++) {
+ iris_emit_cmd(batch, GENX(3DSTATE_URB_VS), urb) {
+ urb._3DCommandSubOpcode += i;
+ urb.VSURBStartingAddress = start[i];
+ urb.VSURBEntryAllocationSize = size[i] - 1;
+ urb.VSNumberofURBEntries = entries[i];
+ }
+ }
+}
+
+void
genX(init_state)(struct iris_context *ice)
{
struct pipe_context *ctx = &ice->ctx;