[Mesa-dev] [PATCH v2 5/6] i965: Upload binding tables in hw-generated binding table format.
Matt Turner
mattst88 at gmail.com
Sun Jul 5 16:46:13 PDT 2015
On Fri, Jul 3, 2015 at 12:00 AM, Abdiel Janulgue
<abdiel.janulgue at linux.intel.com> wrote:
> diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c
> index 7396c94..34a88b9 100644
> --- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
> +++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
> @@ -70,30 +90,51 @@ brw_upload_binding_table(struct brw_context *brw,
>
> stage_state->bind_bo_offset = 0;
> } else {
> - /* Upload a new binding table. */
> - if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
> - brw->vtbl.emit_buffer_surface_state(
> - brw, &stage_state->surf_offset[
> - prog_data->binding_table.shader_time_start],
> - brw->shader_time.bo, 0, BRW_SURFACEFORMAT_RAW,
> - brw->shader_time.bo->size, 1, true);
> + /* When RS is enabled use hw-binding table uploads, otherwise fallback to
> + * software-uploads.
> + */
> + if (brw->use_resource_streamer) {
> + gen7_update_binding_table_from_array(brw, stage_state->stage,
> + stage_state->surf_offset,
> + prog_data->binding_table
> + .size_bytes / 4);
> + } else {
> + /* Upload a new binding table. */
> + if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
> + brw->vtbl.emit_buffer_surface_state(
> + brw, &stage_state->surf_offset[
> + prog_data->binding_table.shader_time_start],
> + brw->shader_time.bo, 0, BRW_SURFACEFORMAT_RAW,
> + brw->shader_time.bo->size, 1, true);
> + }
> +
> + uint32_t *bind = brw_state_batch(brw, AUB_TRACE_BINDING_TABLE,
> + prog_data->binding_table.size_bytes,
> + 32,
> + &stage_state->bind_bo_offset);
> +
> + /* BRW_NEW_SURFACES and BRW_NEW_*_CONSTBUF */
> + memcpy(bind, stage_state->surf_offset,
> + prog_data->binding_table.size_bytes);
> }
> -
> - uint32_t *bind = brw_state_batch(brw, AUB_TRACE_BINDING_TABLE,
> - prog_data->binding_table.size_bytes, 32,
> - &stage_state->bind_bo_offset);
> -
> - /* BRW_NEW_SURFACES and BRW_NEW_*_CONSTBUF */
> - memcpy(bind, stage_state->surf_offset,
> - prog_data->binding_table.size_bytes);
> }
>
> brw->ctx.NewDriverState |= brw_new_binding_table;
>
> if (brw->gen >= 7) {
> +
Extra newline.
> + if (brw->use_resource_streamer)
> + stage_state->bind_bo_offset =
> + reserve_hw_bt_space(brw, prog_data->binding_table.size_bytes);
We usually put braces around nested if statements, but *always* put
braces around if statements if they stretch across multiple lines (see
commit 22af95af).
> +
> BEGIN_BATCH(2);
> OUT_BATCH(packet_name << 16 | (2 - 2));
> - OUT_BATCH(stage_state->bind_bo_offset);
> + /* Align SurfaceStateOffset[16:6] format to [15:5] PS Binding Table field
> + * when hw-generated binding table is enabled.
> + */
> + OUT_BATCH(brw->use_resource_streamer ?
> + (stage_state->bind_bo_offset >> 1) :
> + stage_state->bind_bo_offset);
> ADVANCE_BATCH();
> }
> }
More information about the mesa-dev
mailing list