diff options
author | Jason Ekstrand <[email protected]> | 2016-11-01 14:03:43 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-11-02 09:32:15 -0700 |
commit | 058304f0819c96fd18eb17911022a410540aa295 (patch) | |
tree | 5e56edb74ffd17c4b5c12aa1e1640701e474e820 /src/intel | |
parent | a5f8ff6ca18c38a7c4b5b37a4d5b14ca01e71b1e (diff) |
intel/blorp: Use wm_prog_data instead of hand-rolling our own
Signed-off-by: Jason Ekstrand <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98012
Reviewed-by: Topi Pohjolainen <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Cc: "13.0" <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/blorp/blorp.c | 28 | ||||
-rw-r--r-- | src/intel/blorp/blorp_blit.c | 2 | ||||
-rw-r--r-- | src/intel/blorp/blorp_clear.c | 2 | ||||
-rw-r--r-- | src/intel/blorp/blorp_genX_exec.h | 31 | ||||
-rw-r--r-- | src/intel/blorp/blorp_priv.h | 31 |
5 files changed, 28 insertions, 66 deletions
diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c index 3ef3e70eb55..402282f0ff0 100644 --- a/src/intel/blorp/blorp.c +++ b/src/intel/blorp/blorp.c @@ -169,7 +169,7 @@ blorp_compile_fs(struct blorp_context *blorp, void *mem_ctx, struct nir_shader *nir, const struct brw_wm_prog_key *wm_key, bool use_repclear, - struct brw_blorp_prog_data *prog_data, + struct brw_wm_prog_data *wm_prog_data, unsigned *program_size) { const struct brw_compiler *compiler = blorp->compiler; @@ -177,15 +177,14 @@ blorp_compile_fs(struct blorp_context *blorp, void *mem_ctx, nir->options = compiler->glsl_compiler_options[MESA_SHADER_FRAGMENT].NirOptions; - struct brw_wm_prog_data wm_prog_data; - memset(&wm_prog_data, 0, sizeof(wm_prog_data)); + memset(wm_prog_data, 0, sizeof(*wm_prog_data)); - wm_prog_data.base.nr_params = 0; - wm_prog_data.base.param = NULL; + wm_prog_data->base.nr_params = 0; + wm_prog_data->base.param = NULL; /* BLORP always just uses the first two binding table entries */ - wm_prog_data.binding_table.render_target_start = BLORP_RENDERBUFFER_BT_INDEX; - wm_prog_data.base.binding_table.texture_start = BLORP_TEXTURE_BT_INDEX; + wm_prog_data->binding_table.render_target_start = BLORP_RENDERBUFFER_BT_INDEX; + wm_prog_data->base.binding_table.texture_start = BLORP_TEXTURE_BT_INDEX; nir = brw_preprocess_nir(compiler, nir); nir_remove_dead_variables(nir, nir_var_shader_in); @@ -206,22 +205,9 @@ blorp_compile_fs(struct blorp_context *blorp, void *mem_ctx, const unsigned *program = brw_compile_fs(compiler, blorp->driver_ctx, mem_ctx, wm_key, - &wm_prog_data, nir, NULL, -1, -1, false, use_repclear, + wm_prog_data, nir, NULL, -1, -1, false, use_repclear, NULL, program_size, NULL); - /* Copy the relavent bits of wm_prog_data over into the blorp prog data */ - prog_data->dispatch_8 = wm_prog_data.dispatch_8; - prog_data->dispatch_16 = wm_prog_data.dispatch_16; - prog_data->first_curbe_grf_0 = wm_prog_data.base.dispatch_grf_start_reg; - prog_data->first_curbe_grf_2 = wm_prog_data.dispatch_grf_start_reg_2; - prog_data->ksp_offset_2 = wm_prog_data.prog_offset_2; - prog_data->persample_msaa_dispatch = wm_prog_data.persample_dispatch; - prog_data->flat_inputs = wm_prog_data.flat_inputs; - prog_data->num_varying_inputs = wm_prog_data.num_varying_inputs; - prog_data->inputs_read = nir->info->inputs_read; - - assert(wm_prog_data.base.nr_params == 0); - return program; } diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c index 8f32d2d8ec1..d1e7212d520 100644 --- a/src/intel/blorp/blorp_blit.c +++ b/src/intel/blorp/blorp_blit.c @@ -1237,7 +1237,7 @@ brw_blorp_get_blit_kernel(struct blorp_context *blorp, const unsigned *program; unsigned program_size; - struct brw_blorp_prog_data prog_data; + struct brw_wm_prog_data prog_data; nir_shader *nir = brw_blorp_build_nir_shader(blorp, mem_ctx, prog_key); struct brw_wm_prog_key wm_key; diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c index c022e65dfd3..b18b3d008ef 100644 --- a/src/intel/blorp/blorp_clear.c +++ b/src/intel/blorp/blorp_clear.c @@ -73,7 +73,7 @@ blorp_params_get_clear_kernel(struct blorp_context *blorp, struct brw_wm_prog_key wm_key; brw_blorp_init_wm_prog_key(&wm_key); - struct brw_blorp_prog_data prog_data; + struct brw_wm_prog_data prog_data; unsigned program_size; const unsigned *program = blorp_compile_fs(blorp, mem_ctx, b.shader, &wm_key, use_replicated_data, diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h index ec0d0223ad3..2051859770f 100644 --- a/src/intel/blorp/blorp_genX_exec.h +++ b/src/intel/blorp/blorp_genX_exec.h @@ -207,7 +207,8 @@ blorp_emit_input_varying_data(struct blorp_batch *batch, for (unsigned i = 0; i < max_num_varyings; i++) { const gl_varying_slot attr = VARYING_SLOT_VAR0 + i; - if (!(params->wm_prog_data->inputs_read & (1ull << attr))) + const int input_index = params->wm_prog_data->urb_setup[attr]; + if (input_index < 0) continue; memcpy(inputs, inputs_src + i * 4, vec4_size_in_bytes); @@ -401,7 +402,7 @@ static void blorp_emit_sf_config(struct blorp_batch *batch, const struct blorp_params *params) { - const struct brw_blorp_prog_data *prog_data = params->wm_prog_data; + const struct brw_wm_prog_data *prog_data = params->wm_prog_data; /* 3DSTATE_SF * @@ -502,7 +503,7 @@ static void blorp_emit_ps_config(struct blorp_batch *batch, const struct blorp_params *params) { - const struct brw_blorp_prog_data *prog_data = params->wm_prog_data; + const struct brw_wm_prog_data *prog_data = params->wm_prog_data; /* Even when thread dispatch is disabled, max threads (dw5.25:31) must be * nonzero to prevent the GPU from hanging. While the documentation doesn't @@ -527,16 +528,16 @@ blorp_emit_ps_config(struct blorp_batch *batch, if (prog_data) { ps.DispatchGRFStartRegisterForConstantSetupData0 = - prog_data->first_curbe_grf_0; + prog_data->base.dispatch_grf_start_reg; ps.DispatchGRFStartRegisterForConstantSetupData2 = - prog_data->first_curbe_grf_2; + prog_data->dispatch_grf_start_reg_2; ps._8PixelDispatchEnable = prog_data->dispatch_8; ps._16PixelDispatchEnable = prog_data->dispatch_16; ps.KernelStartPointer0 = params->wm_prog_kernel; ps.KernelStartPointer2 = - params->wm_prog_kernel + prog_data->ksp_offset_2; + params->wm_prog_kernel + prog_data->prog_offset_2; } /* 3DSTATE_PS expects the number of threads per PSD, which is always 64; @@ -577,7 +578,7 @@ blorp_emit_ps_config(struct blorp_batch *batch, if (prog_data) { psx.PixelShaderValid = true; psx.AttributeEnable = prog_data->num_varying_inputs > 0; - psx.PixelShaderIsPerSample = prog_data->persample_msaa_dispatch; + psx.PixelShaderIsPerSample = prog_data->persample_dispatch; } if (params->src.enabled) @@ -612,7 +613,7 @@ blorp_emit_ps_config(struct blorp_batch *batch, if (params->dst.surf.samples > 1) { wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN; wm.MultisampleDispatchMode = - (prog_data && prog_data->persample_msaa_dispatch) ? + (prog_data && prog_data->persample_dispatch) ? MSDISPMODE_PERSAMPLE : MSDISPMODE_PERPIXEL; } else { wm.MultisampleRasterizationMode = MSRASTMODE_OFF_PIXEL; @@ -630,13 +631,13 @@ blorp_emit_ps_config(struct blorp_batch *batch, if (prog_data) { ps.DispatchGRFStartRegisterforConstantSetupData0 = - prog_data->first_curbe_grf_0; + prog_data->base.dispatch_grf_start_reg; ps.DispatchGRFStartRegisterforConstantSetupData2 = - prog_data->first_curbe_grf_2; + prog_data->dispatch_grf_start_reg_2; ps.KernelStartPointer0 = params->wm_prog_kernel; ps.KernelStartPointer2 = - params->wm_prog_kernel + prog_data->ksp_offset_2; + params->wm_prog_kernel + prog_data->prog_offset_2; ps._8PixelDispatchEnable = prog_data->dispatch_8; ps._16PixelDispatchEnable = prog_data->dispatch_16; @@ -692,13 +693,13 @@ blorp_emit_ps_config(struct blorp_batch *batch, wm.ThreadDispatchEnable = true; wm.DispatchGRFStartRegisterforConstantSetupData0 = - prog_data->first_curbe_grf_0; + prog_data->base.dispatch_grf_start_reg; wm.DispatchGRFStartRegisterforConstantSetupData2 = - prog_data->first_curbe_grf_2; + prog_data->dispatch_grf_start_reg_2; wm.KernelStartPointer0 = params->wm_prog_kernel; wm.KernelStartPointer2 = - params->wm_prog_kernel + prog_data->ksp_offset_2; + params->wm_prog_kernel + prog_data->prog_offset_2; wm._8PixelDispatchEnable = prog_data->dispatch_8; wm._16PixelDispatchEnable = prog_data->dispatch_16; @@ -714,7 +715,7 @@ blorp_emit_ps_config(struct blorp_batch *batch, if (params->dst.surf.samples > 1) { wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN; wm.MultisampleDispatchMode = - (prog_data && prog_data->persample_msaa_dispatch) ? + (prog_data && prog_data->persample_dispatch) ? MSDISPMODE_PERSAMPLE : MSDISPMODE_PERPIXEL; } else { wm.MultisampleRasterizationMode = MSRASTMODE_OFF_PIXEL; diff --git a/src/intel/blorp/blorp_priv.h b/src/intel/blorp/blorp_priv.h index 9d14336b595..710479f7b02 100644 --- a/src/intel/blorp/blorp_priv.h +++ b/src/intel/blorp/blorp_priv.h @@ -138,33 +138,8 @@ struct brw_blorp_wm_inputs uint32_t pad[1]; }; -struct brw_blorp_prog_data -{ - bool dispatch_8; - bool dispatch_16; - - uint8_t first_curbe_grf_0; - uint8_t first_curbe_grf_2; - - uint32_t ksp_offset_2; - - /** - * True if the WM program should be run in MSDISPMODE_PERSAMPLE with more - * than one sample per pixel. - */ - bool persample_msaa_dispatch; - - /** - * Mask of which FS inputs are marked flat by the shader source. This is - * needed for setting up 3DSTATE_SF/SBE. - */ - uint32_t flat_inputs; - unsigned num_varying_inputs; - uint64_t inputs_read; -}; - static inline unsigned -brw_blorp_get_urb_length(const struct brw_blorp_prog_data *prog_data) +brw_blorp_get_urb_length(const struct brw_wm_prog_data *prog_data) { if (prog_data == NULL) return 1; @@ -197,7 +172,7 @@ struct blorp_params unsigned num_draw_buffers; unsigned num_layers; uint32_t wm_prog_kernel; - struct brw_blorp_prog_data *wm_prog_data; + struct brw_wm_prog_data *wm_prog_data; }; void blorp_params_init(struct blorp_params *params); @@ -314,7 +289,7 @@ blorp_compile_fs(struct blorp_context *blorp, void *mem_ctx, struct nir_shader *nir, const struct brw_wm_prog_key *wm_key, bool use_repclear, - struct brw_blorp_prog_data *prog_data, + struct brw_wm_prog_data *wm_prog_data, unsigned *program_size); /** \} */ |