2012-07-19 15:20:45 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright 2012 Advanced Micro Devices, Inc.
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
|
|
|
|
* license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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:
|
|
|
|
|
* Christian König <christian.koenig@amd.com>
|
|
|
|
|
*/
|
|
|
|
|
|
2014-01-04 18:44:33 +01:00
|
|
|
#include "si_pipe.h"
|
2014-08-16 17:58:25 +01:00
|
|
|
#include "radeon/r600_cs.h"
|
2012-07-19 15:20:45 +02:00
|
|
|
#include "sid.h"
|
2016-10-15 15:00:33 +02:00
|
|
|
#include "gfx9d.h"
|
2012-07-19 15:20:45 +02:00
|
|
|
|
2014-01-22 18:50:36 +01:00
|
|
|
#include "util/u_index_modify.h"
|
|
|
|
|
#include "util/u_upload_mgr.h"
|
2015-02-22 18:06:34 +01:00
|
|
|
#include "util/u_prim.h"
|
2014-01-22 18:50:36 +01:00
|
|
|
|
2016-12-24 13:08:00 +01:00
|
|
|
#include "ac_debug.h"
|
|
|
|
|
|
2014-12-07 16:02:07 +01:00
|
|
|
static unsigned si_conv_pipe_prim(unsigned mode)
|
2012-07-19 15:20:45 +02:00
|
|
|
{
|
|
|
|
|
static const unsigned prim_conv[] = {
|
|
|
|
|
[PIPE_PRIM_POINTS] = V_008958_DI_PT_POINTLIST,
|
|
|
|
|
[PIPE_PRIM_LINES] = V_008958_DI_PT_LINELIST,
|
|
|
|
|
[PIPE_PRIM_LINE_LOOP] = V_008958_DI_PT_LINELOOP,
|
|
|
|
|
[PIPE_PRIM_LINE_STRIP] = V_008958_DI_PT_LINESTRIP,
|
|
|
|
|
[PIPE_PRIM_TRIANGLES] = V_008958_DI_PT_TRILIST,
|
|
|
|
|
[PIPE_PRIM_TRIANGLE_STRIP] = V_008958_DI_PT_TRISTRIP,
|
|
|
|
|
[PIPE_PRIM_TRIANGLE_FAN] = V_008958_DI_PT_TRIFAN,
|
|
|
|
|
[PIPE_PRIM_QUADS] = V_008958_DI_PT_QUADLIST,
|
|
|
|
|
[PIPE_PRIM_QUAD_STRIP] = V_008958_DI_PT_QUADSTRIP,
|
|
|
|
|
[PIPE_PRIM_POLYGON] = V_008958_DI_PT_POLYGON,
|
2014-01-09 16:35:46 +09:00
|
|
|
[PIPE_PRIM_LINES_ADJACENCY] = V_008958_DI_PT_LINELIST_ADJ,
|
|
|
|
|
[PIPE_PRIM_LINE_STRIP_ADJACENCY] = V_008958_DI_PT_LINESTRIP_ADJ,
|
|
|
|
|
[PIPE_PRIM_TRIANGLES_ADJACENCY] = V_008958_DI_PT_TRILIST_ADJ,
|
2014-08-18 00:55:40 +02:00
|
|
|
[PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = V_008958_DI_PT_TRISTRIP_ADJ,
|
2014-09-18 23:39:44 +02:00
|
|
|
[PIPE_PRIM_PATCHES] = V_008958_DI_PT_PATCH,
|
2014-08-18 00:55:40 +02:00
|
|
|
[R600_PRIM_RECTANGLE_LIST] = V_008958_DI_PT_RECTLIST
|
2012-07-19 15:20:45 +02:00
|
|
|
};
|
2016-05-17 09:25:44 -04:00
|
|
|
assert(mode < ARRAY_SIZE(prim_conv));
|
2014-12-07 16:02:07 +01:00
|
|
|
return prim_conv[mode];
|
2012-07-19 15:20:45 +02:00
|
|
|
}
|
|
|
|
|
|
2014-01-07 03:18:25 +01:00
|
|
|
static unsigned si_conv_prim_to_gs_out(unsigned mode)
|
2013-08-18 03:05:34 +02:00
|
|
|
{
|
|
|
|
|
static const int prim_conv[] = {
|
|
|
|
|
[PIPE_PRIM_POINTS] = V_028A6C_OUTPRIM_TYPE_POINTLIST,
|
|
|
|
|
[PIPE_PRIM_LINES] = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
|
|
|
|
|
[PIPE_PRIM_LINE_LOOP] = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
|
|
|
|
|
[PIPE_PRIM_LINE_STRIP] = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
|
|
|
|
|
[PIPE_PRIM_TRIANGLES] = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
|
|
|
|
|
[PIPE_PRIM_TRIANGLE_STRIP] = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
|
|
|
|
|
[PIPE_PRIM_TRIANGLE_FAN] = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
|
|
|
|
|
[PIPE_PRIM_QUADS] = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
|
|
|
|
|
[PIPE_PRIM_QUAD_STRIP] = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
|
|
|
|
|
[PIPE_PRIM_POLYGON] = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
|
|
|
|
|
[PIPE_PRIM_LINES_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
|
|
|
|
|
[PIPE_PRIM_LINE_STRIP_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
|
|
|
|
|
[PIPE_PRIM_TRIANGLES_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
|
2014-08-18 00:55:40 +02:00
|
|
|
[PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
|
2014-09-18 23:39:44 +02:00
|
|
|
[PIPE_PRIM_PATCHES] = V_028A6C_OUTPRIM_TYPE_POINTLIST,
|
2014-08-18 00:55:40 +02:00
|
|
|
[R600_PRIM_RECTANGLE_LIST] = V_028A6C_OUTPRIM_TYPE_TRISTRIP
|
2013-08-18 03:05:34 +02:00
|
|
|
};
|
2016-05-17 09:25:44 -04:00
|
|
|
assert(mode < ARRAY_SIZE(prim_conv));
|
2013-08-18 03:05:34 +02:00
|
|
|
|
|
|
|
|
return prim_conv[mode];
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-22 18:01:18 +01:00
|
|
|
/**
|
|
|
|
|
* This calculates the LDS size for tessellation shaders (VS, TCS, TES).
|
|
|
|
|
* LS.LDS_SIZE is shared by all 3 shader stages.
|
|
|
|
|
*
|
|
|
|
|
* The information about LDS and other non-compile-time parameters is then
|
|
|
|
|
* written to userdata SGPRs.
|
|
|
|
|
*/
|
|
|
|
|
static void si_emit_derived_tess_state(struct si_context *sctx,
|
|
|
|
|
const struct pipe_draw_info *info,
|
|
|
|
|
unsigned *num_patches)
|
|
|
|
|
{
|
2015-11-07 14:00:30 +01:00
|
|
|
struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
|
2017-02-15 11:57:47 +01:00
|
|
|
struct si_shader *ls_current;
|
|
|
|
|
struct si_shader_selector *ls;
|
2015-02-22 18:01:18 +01:00
|
|
|
/* The TES pointer will only be used for sctx->last_tcs.
|
|
|
|
|
* It would be wrong to think that TCS = TES. */
|
|
|
|
|
struct si_shader_selector *tcs =
|
2015-10-07 01:48:18 +02:00
|
|
|
sctx->tcs_shader.cso ? sctx->tcs_shader.cso : sctx->tes_shader.cso;
|
2015-02-22 18:01:18 +01:00
|
|
|
unsigned tes_sh_base = sctx->shader_userdata.sh_base[PIPE_SHADER_TESS_EVAL];
|
|
|
|
|
unsigned num_tcs_input_cp = info->vertices_per_patch;
|
|
|
|
|
unsigned num_tcs_output_cp, num_tcs_inputs, num_tcs_outputs;
|
|
|
|
|
unsigned num_tcs_patch_outputs;
|
|
|
|
|
unsigned input_vertex_size, output_vertex_size, pervertex_output_patch_size;
|
|
|
|
|
unsigned input_patch_size, output_patch_size, output_patch0_offset;
|
2016-11-11 22:37:39 +01:00
|
|
|
unsigned perpatch_output_offset, lds_size;
|
2015-02-22 18:01:18 +01:00
|
|
|
unsigned tcs_in_layout, tcs_out_layout, tcs_out_offsets;
|
2016-09-30 22:37:14 +02:00
|
|
|
unsigned offchip_layout, hardware_lds_size, ls_hs_config;
|
2015-02-22 18:01:18 +01:00
|
|
|
|
2017-02-15 11:57:47 +01:00
|
|
|
/* Since GFX9 has merged LS-HS in the TCS state, set LS = TCS. */
|
|
|
|
|
if (sctx->b.chip_class >= GFX9) {
|
|
|
|
|
if (sctx->tcs_shader.cso)
|
|
|
|
|
ls_current = sctx->tcs_shader.current;
|
|
|
|
|
else
|
|
|
|
|
ls_current = sctx->fixed_func_tcs_shader.current;
|
|
|
|
|
|
|
|
|
|
ls = ls_current->key.part.tcs.ls;
|
|
|
|
|
} else {
|
|
|
|
|
ls_current = sctx->vs_shader.current;
|
|
|
|
|
ls = sctx->vs_shader.cso;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sctx->last_ls == ls_current &&
|
2016-11-11 22:36:17 +01:00
|
|
|
sctx->last_tcs == tcs &&
|
|
|
|
|
sctx->last_tes_sh_base == tes_sh_base &&
|
|
|
|
|
sctx->last_num_tcs_input_cp == num_tcs_input_cp) {
|
|
|
|
|
*num_patches = sctx->last_num_patches;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-15 11:57:47 +01:00
|
|
|
sctx->last_ls = ls_current;
|
2016-11-11 22:36:17 +01:00
|
|
|
sctx->last_tcs = tcs;
|
|
|
|
|
sctx->last_tes_sh_base = tes_sh_base;
|
|
|
|
|
sctx->last_num_tcs_input_cp = num_tcs_input_cp;
|
|
|
|
|
|
2015-02-22 18:01:18 +01:00
|
|
|
/* This calculates how shader inputs and outputs among VS, TCS, and TES
|
|
|
|
|
* are laid out in LDS. */
|
2017-02-15 11:57:47 +01:00
|
|
|
num_tcs_inputs = util_last_bit64(ls->outputs_written);
|
2015-02-22 18:01:18 +01:00
|
|
|
|
2015-10-07 01:48:18 +02:00
|
|
|
if (sctx->tcs_shader.cso) {
|
2015-02-22 18:01:18 +01:00
|
|
|
num_tcs_outputs = util_last_bit64(tcs->outputs_written);
|
|
|
|
|
num_tcs_output_cp = tcs->info.properties[TGSI_PROPERTY_TCS_VERTICES_OUT];
|
|
|
|
|
num_tcs_patch_outputs = util_last_bit64(tcs->patch_outputs_written);
|
|
|
|
|
} else {
|
|
|
|
|
/* No TCS. Route varyings from LS to TES. */
|
|
|
|
|
num_tcs_outputs = num_tcs_inputs;
|
|
|
|
|
num_tcs_output_cp = num_tcs_input_cp;
|
|
|
|
|
num_tcs_patch_outputs = 2; /* TESSINNER + TESSOUTER */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
input_vertex_size = num_tcs_inputs * 16;
|
|
|
|
|
output_vertex_size = num_tcs_outputs * 16;
|
|
|
|
|
|
|
|
|
|
input_patch_size = num_tcs_input_cp * input_vertex_size;
|
|
|
|
|
|
|
|
|
|
pervertex_output_patch_size = num_tcs_output_cp * output_vertex_size;
|
|
|
|
|
output_patch_size = pervertex_output_patch_size + num_tcs_patch_outputs * 16;
|
|
|
|
|
|
2016-05-02 15:00:21 +02:00
|
|
|
/* Ensure that we only need one wave per SIMD so we don't need to check
|
|
|
|
|
* resource usage. Also ensures that the number of tcs in and out
|
|
|
|
|
* vertices per threadgroup are at most 256.
|
|
|
|
|
*/
|
|
|
|
|
*num_patches = 64 / MAX2(num_tcs_input_cp, num_tcs_output_cp) * 4;
|
|
|
|
|
|
|
|
|
|
/* Make sure that the data fits in LDS. This assumes the shaders only
|
|
|
|
|
* use LDS for the inputs and outputs.
|
|
|
|
|
*/
|
|
|
|
|
hardware_lds_size = sctx->b.chip_class >= CIK ? 65536 : 32768;
|
|
|
|
|
*num_patches = MIN2(*num_patches, hardware_lds_size / (input_patch_size +
|
|
|
|
|
output_patch_size));
|
|
|
|
|
|
|
|
|
|
/* Make sure the output data fits in the offchip buffer */
|
2016-06-28 14:11:12 +02:00
|
|
|
*num_patches = MIN2(*num_patches,
|
|
|
|
|
(sctx->screen->tess_offchip_block_dw_size * 4) /
|
|
|
|
|
output_patch_size);
|
2016-05-02 15:00:21 +02:00
|
|
|
|
|
|
|
|
/* Not necessary for correctness, but improves performance. The
|
|
|
|
|
* specific value is taken from the proprietary driver.
|
|
|
|
|
*/
|
|
|
|
|
*num_patches = MIN2(*num_patches, 40);
|
2016-11-29 20:41:23 +01:00
|
|
|
|
|
|
|
|
/* SI bug workaround - limit LS-HS threadgroups to only one wave. */
|
|
|
|
|
if (sctx->b.chip_class == SI) {
|
|
|
|
|
unsigned one_wave = 64 / MAX2(num_tcs_input_cp, num_tcs_output_cp);
|
|
|
|
|
*num_patches = MIN2(*num_patches, one_wave);
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-11 22:36:17 +01:00
|
|
|
sctx->last_num_patches = *num_patches;
|
2016-05-02 15:00:21 +02:00
|
|
|
|
|
|
|
|
output_patch0_offset = input_patch_size * *num_patches;
|
2015-02-22 18:01:18 +01:00
|
|
|
perpatch_output_offset = output_patch0_offset + pervertex_output_patch_size;
|
|
|
|
|
|
|
|
|
|
/* Compute userdata SGPRs. */
|
|
|
|
|
assert(((input_vertex_size / 4) & ~0xff) == 0);
|
|
|
|
|
assert(((output_vertex_size / 4) & ~0xff) == 0);
|
|
|
|
|
assert(((input_patch_size / 4) & ~0x1fff) == 0);
|
|
|
|
|
assert(((output_patch_size / 4) & ~0x1fff) == 0);
|
|
|
|
|
assert(((output_patch0_offset / 16) & ~0xffff) == 0);
|
|
|
|
|
assert(((perpatch_output_offset / 16) & ~0xffff) == 0);
|
|
|
|
|
assert(num_tcs_input_cp <= 32);
|
|
|
|
|
assert(num_tcs_output_cp <= 32);
|
|
|
|
|
|
2017-04-12 10:16:07 +02:00
|
|
|
tcs_in_layout = S_VS_STATE_LS_OUT_PATCH_SIZE(input_patch_size / 4) |
|
|
|
|
|
S_VS_STATE_LS_OUT_VERTEX_SIZE(input_vertex_size / 4);
|
2015-02-22 18:01:18 +01:00
|
|
|
tcs_out_layout = (output_patch_size / 4) |
|
|
|
|
|
((output_vertex_size / 4) << 13);
|
|
|
|
|
tcs_out_offsets = (output_patch0_offset / 16) |
|
|
|
|
|
((perpatch_output_offset / 16) << 16);
|
2016-05-10 00:48:55 +02:00
|
|
|
offchip_layout = (pervertex_output_patch_size * *num_patches << 16) |
|
|
|
|
|
(num_tcs_output_cp << 9) | *num_patches;
|
2015-02-22 18:01:18 +01:00
|
|
|
|
2016-11-11 22:37:39 +01:00
|
|
|
/* Compute the LDS size. */
|
|
|
|
|
lds_size = output_patch0_offset + output_patch_size * *num_patches;
|
|
|
|
|
|
|
|
|
|
if (sctx->b.chip_class >= CIK) {
|
|
|
|
|
assert(lds_size <= 65536);
|
|
|
|
|
lds_size = align(lds_size, 512) / 512;
|
|
|
|
|
} else {
|
|
|
|
|
assert(lds_size <= 32768);
|
|
|
|
|
lds_size = align(lds_size, 256) / 256;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set SI_SGPR_VS_STATE_BITS. */
|
2017-04-12 10:46:22 +02:00
|
|
|
sctx->current_vs_state &= C_VS_STATE_LS_OUT_PATCH_SIZE &
|
|
|
|
|
C_VS_STATE_LS_OUT_VERTEX_SIZE;
|
|
|
|
|
sctx->current_vs_state |= tcs_in_layout;
|
2015-02-22 18:01:18 +01:00
|
|
|
|
2016-11-11 22:37:39 +01:00
|
|
|
if (sctx->b.chip_class >= GFX9) {
|
2017-02-15 11:57:47 +01:00
|
|
|
unsigned hs_rsrc2 = ls_current->config.rsrc2 |
|
|
|
|
|
S_00B42C_LDS_SIZE(lds_size);
|
|
|
|
|
|
|
|
|
|
radeon_set_sh_reg(cs, R_00B42C_SPI_SHADER_PGM_RSRC2_HS, hs_rsrc2);
|
2017-02-15 22:47:57 +01:00
|
|
|
|
|
|
|
|
/* Set userdata SGPRs for merged LS-HS. */
|
|
|
|
|
radeon_set_sh_reg_seq(cs,
|
|
|
|
|
R_00B430_SPI_SHADER_USER_DATA_LS_0 +
|
|
|
|
|
GFX9_SGPR_TCS_OFFCHIP_LAYOUT * 4, 3);
|
|
|
|
|
radeon_emit(cs, offchip_layout);
|
|
|
|
|
radeon_emit(cs, tcs_out_offsets);
|
|
|
|
|
radeon_emit(cs, tcs_out_layout | (num_tcs_input_cp << 26));
|
2016-11-11 22:37:39 +01:00
|
|
|
} else {
|
2017-02-15 11:57:47 +01:00
|
|
|
unsigned ls_rsrc2 = ls_current->config.rsrc2;
|
2016-11-11 22:37:39 +01:00
|
|
|
|
|
|
|
|
si_multiwave_lds_size_workaround(sctx->screen, &lds_size);
|
|
|
|
|
ls_rsrc2 |= S_00B52C_LDS_SIZE(lds_size);
|
|
|
|
|
|
|
|
|
|
/* Due to a hw bug, RSRC2_LS must be written twice with another
|
|
|
|
|
* LS register written in between. */
|
|
|
|
|
if (sctx->b.chip_class == CIK && sctx->b.family != CHIP_HAWAII)
|
|
|
|
|
radeon_set_sh_reg(cs, R_00B52C_SPI_SHADER_PGM_RSRC2_LS, ls_rsrc2);
|
|
|
|
|
radeon_set_sh_reg_seq(cs, R_00B528_SPI_SHADER_PGM_RSRC1_LS, 2);
|
2017-02-15 11:57:47 +01:00
|
|
|
radeon_emit(cs, ls_current->config.rsrc1);
|
2016-11-11 22:37:39 +01:00
|
|
|
radeon_emit(cs, ls_rsrc2);
|
|
|
|
|
|
|
|
|
|
/* Set userdata SGPRs for TCS. */
|
|
|
|
|
radeon_set_sh_reg_seq(cs,
|
2017-02-15 22:47:57 +01:00
|
|
|
R_00B430_SPI_SHADER_USER_DATA_HS_0 + GFX6_SGPR_TCS_OFFCHIP_LAYOUT * 4, 4);
|
2016-11-11 22:37:39 +01:00
|
|
|
radeon_emit(cs, offchip_layout);
|
|
|
|
|
radeon_emit(cs, tcs_out_offsets);
|
|
|
|
|
radeon_emit(cs, tcs_out_layout | (num_tcs_input_cp << 26));
|
|
|
|
|
radeon_emit(cs, tcs_in_layout);
|
|
|
|
|
}
|
2015-02-22 18:01:18 +01:00
|
|
|
|
2016-11-11 22:37:39 +01:00
|
|
|
/* Set userdata SGPRs for TES. */
|
2017-02-15 22:47:57 +01:00
|
|
|
radeon_set_sh_reg_seq(cs, tes_sh_base + SI_SGPR_TES_OFFCHIP_LAYOUT * 4, 1);
|
2016-05-10 00:48:55 +02:00
|
|
|
radeon_emit(cs, offchip_layout);
|
2016-09-30 22:37:14 +02:00
|
|
|
|
|
|
|
|
ls_hs_config = S_028B58_NUM_PATCHES(*num_patches) |
|
|
|
|
|
S_028B58_HS_NUM_INPUT_CP(num_tcs_input_cp) |
|
|
|
|
|
S_028B58_HS_NUM_OUTPUT_CP(num_tcs_output_cp);
|
|
|
|
|
|
|
|
|
|
if (sctx->b.chip_class >= CIK)
|
|
|
|
|
radeon_set_context_reg_idx(cs, R_028B58_VGT_LS_HS_CONFIG, 2,
|
|
|
|
|
ls_hs_config);
|
|
|
|
|
else
|
|
|
|
|
radeon_set_context_reg(cs, R_028B58_VGT_LS_HS_CONFIG,
|
|
|
|
|
ls_hs_config);
|
2015-02-22 18:01:18 +01:00
|
|
|
}
|
|
|
|
|
|
2015-12-09 22:14:32 +01:00
|
|
|
static unsigned si_num_prims_for_vertices(const struct pipe_draw_info *info)
|
|
|
|
|
{
|
|
|
|
|
switch (info->mode) {
|
|
|
|
|
case PIPE_PRIM_PATCHES:
|
|
|
|
|
return info->count / info->vertices_per_patch;
|
|
|
|
|
case R600_PRIM_RECTANGLE_LIST:
|
|
|
|
|
return info->count / 3;
|
|
|
|
|
default:
|
|
|
|
|
return u_prims_for_vertices(info->mode, info->count);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-25 02:47:15 +01:00
|
|
|
static unsigned
|
|
|
|
|
si_get_init_multi_vgt_param(struct si_screen *sscreen,
|
|
|
|
|
union si_vgt_param_key *key)
|
2014-08-15 16:32:03 +02:00
|
|
|
{
|
2017-01-25 02:47:15 +01:00
|
|
|
STATIC_ASSERT(sizeof(union si_vgt_param_key) == 4);
|
2015-10-18 22:07:01 +02:00
|
|
|
unsigned max_primgroup_in_wave = 2;
|
2014-08-15 16:32:03 +02:00
|
|
|
|
|
|
|
|
/* SWITCH_ON_EOP(0) is always preferable. */
|
|
|
|
|
bool wd_switch_on_eop = false;
|
|
|
|
|
bool ia_switch_on_eop = false;
|
2015-02-22 18:06:34 +01:00
|
|
|
bool ia_switch_on_eoi = false;
|
2014-08-15 22:45:10 +02:00
|
|
|
bool partial_vs_wave = false;
|
2015-02-22 18:06:34 +01:00
|
|
|
bool partial_es_wave = false;
|
2014-08-15 16:32:03 +02:00
|
|
|
|
2017-01-25 02:47:15 +01:00
|
|
|
if (key->u.uses_tess) {
|
2015-10-18 22:17:04 +02:00
|
|
|
/* SWITCH_ON_EOI must be set if PrimID is used. */
|
2017-01-25 02:47:15 +01:00
|
|
|
if (key->u.tcs_tes_uses_prim_id)
|
2015-02-22 18:06:34 +01:00
|
|
|
ia_switch_on_eoi = true;
|
|
|
|
|
|
|
|
|
|
/* Bug with tessellation and GS on Bonaire and older 2 SE chips. */
|
2017-01-25 02:47:15 +01:00
|
|
|
if ((sscreen->b.family == CHIP_TAHITI ||
|
|
|
|
|
sscreen->b.family == CHIP_PITCAIRN ||
|
|
|
|
|
sscreen->b.family == CHIP_BONAIRE) &&
|
|
|
|
|
key->u.uses_gs)
|
2015-02-22 18:06:34 +01:00
|
|
|
partial_vs_wave = true;
|
2016-04-12 20:28:46 +02:00
|
|
|
|
|
|
|
|
/* Needed for 028B6C_DISTRIBUTION_MODE != 0 */
|
2017-01-25 02:47:15 +01:00
|
|
|
if (sscreen->has_distributed_tess) {
|
|
|
|
|
if (key->u.uses_gs) {
|
2017-04-23 20:29:04 +02:00
|
|
|
if (sscreen->b.chip_class <= VI)
|
|
|
|
|
partial_es_wave = true;
|
2016-11-29 21:19:52 +01:00
|
|
|
|
|
|
|
|
/* GPU hang workaround. */
|
2017-01-25 02:47:15 +01:00
|
|
|
if (sscreen->b.family == CHIP_TONGA ||
|
|
|
|
|
sscreen->b.family == CHIP_FIJI ||
|
|
|
|
|
sscreen->b.family == CHIP_POLARIS10 ||
|
|
|
|
|
sscreen->b.family == CHIP_POLARIS11)
|
2016-11-29 21:19:52 +01:00
|
|
|
partial_vs_wave = true;
|
|
|
|
|
} else {
|
2016-04-12 20:28:46 +02:00
|
|
|
partial_vs_wave = true;
|
2016-11-29 21:19:52 +01:00
|
|
|
}
|
2016-04-12 20:28:46 +02:00
|
|
|
}
|
2015-02-22 18:06:34 +01:00
|
|
|
}
|
|
|
|
|
|
2014-08-15 16:32:03 +02:00
|
|
|
/* This is a hardware requirement. */
|
2017-01-25 02:47:15 +01:00
|
|
|
if (key->u.line_stipple_enabled ||
|
|
|
|
|
(sscreen->b.debug_flags & DBG_SWITCH_ON_EOP)) {
|
2014-08-15 16:32:03 +02:00
|
|
|
ia_switch_on_eop = true;
|
|
|
|
|
wd_switch_on_eop = true;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-25 02:47:15 +01:00
|
|
|
if (sscreen->b.chip_class >= CIK) {
|
2014-08-15 16:32:03 +02:00
|
|
|
/* WD_SWITCH_ON_EOP has no effect on GPUs with less than
|
|
|
|
|
* 4 shader engines. Set 1 to pass the assertion below.
|
2016-04-08 12:57:43 +02:00
|
|
|
* The other cases are hardware requirements.
|
|
|
|
|
*
|
|
|
|
|
* Polaris supports primitive restart with WD_SWITCH_ON_EOP=0
|
|
|
|
|
* for points, line strips, and tri strips.
|
|
|
|
|
*/
|
2017-01-25 02:47:15 +01:00
|
|
|
if (sscreen->b.info.max_se < 4 ||
|
|
|
|
|
key->u.prim == PIPE_PRIM_POLYGON ||
|
|
|
|
|
key->u.prim == PIPE_PRIM_LINE_LOOP ||
|
|
|
|
|
key->u.prim == PIPE_PRIM_TRIANGLE_FAN ||
|
|
|
|
|
key->u.prim == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY ||
|
|
|
|
|
(key->u.primitive_restart &&
|
|
|
|
|
(sscreen->b.family < CHIP_POLARIS10 ||
|
|
|
|
|
(key->u.prim != PIPE_PRIM_POINTS &&
|
|
|
|
|
key->u.prim != PIPE_PRIM_LINE_STRIP &&
|
|
|
|
|
key->u.prim != PIPE_PRIM_TRIANGLE_STRIP))) ||
|
|
|
|
|
key->u.count_from_stream_output)
|
2014-08-15 16:32:03 +02:00
|
|
|
wd_switch_on_eop = true;
|
|
|
|
|
|
|
|
|
|
/* Hawaii hangs if instancing is enabled and WD_SWITCH_ON_EOP is 0.
|
|
|
|
|
* We don't know that for indirect drawing, so treat it as
|
|
|
|
|
* always problematic. */
|
2017-01-25 02:47:15 +01:00
|
|
|
if (sscreen->b.family == CHIP_HAWAII &&
|
|
|
|
|
key->u.uses_instancing)
|
2014-08-15 16:32:03 +02:00
|
|
|
wd_switch_on_eop = true;
|
|
|
|
|
|
2016-06-03 16:20:17 +02:00
|
|
|
/* Performance recommendation for 4 SE Gfx7-8 parts if
|
2016-09-08 01:42:06 +02:00
|
|
|
* instances are smaller than a primgroup.
|
|
|
|
|
* Assume indirect draws always use small instances.
|
|
|
|
|
* This is needed for good VS wave utilization.
|
2016-06-03 16:20:17 +02:00
|
|
|
*/
|
2017-01-25 02:47:15 +01:00
|
|
|
if (sscreen->b.chip_class <= VI &&
|
|
|
|
|
sscreen->b.info.max_se == 4 &&
|
|
|
|
|
key->u.multi_instances_smaller_than_primgroup)
|
2016-06-03 16:20:17 +02:00
|
|
|
wd_switch_on_eop = true;
|
|
|
|
|
|
2015-10-18 21:43:30 +02:00
|
|
|
/* Required on CIK and later. */
|
2017-01-25 02:47:15 +01:00
|
|
|
if (sscreen->b.info.max_se > 2 && !wd_switch_on_eop)
|
2015-10-18 21:43:30 +02:00
|
|
|
ia_switch_on_eoi = true;
|
|
|
|
|
|
2015-10-18 22:07:01 +02:00
|
|
|
/* Required by Hawaii and, for some special cases, by VI. */
|
|
|
|
|
if (ia_switch_on_eoi &&
|
2017-01-25 02:47:15 +01:00
|
|
|
(sscreen->b.family == CHIP_HAWAII ||
|
|
|
|
|
(sscreen->b.chip_class == VI &&
|
|
|
|
|
(key->u.uses_gs || max_primgroup_in_wave != 2))))
|
2015-10-18 22:07:01 +02:00
|
|
|
partial_vs_wave = true;
|
|
|
|
|
|
2015-10-18 21:51:41 +02:00
|
|
|
/* Instancing bug on Bonaire. */
|
2017-01-25 02:47:15 +01:00
|
|
|
if (sscreen->b.family == CHIP_BONAIRE && ia_switch_on_eoi &&
|
|
|
|
|
key->u.uses_instancing)
|
2015-10-18 21:51:41 +02:00
|
|
|
partial_vs_wave = true;
|
|
|
|
|
|
2014-08-15 16:32:03 +02:00
|
|
|
/* If the WD switch is false, the IA switch must be false too. */
|
|
|
|
|
assert(wd_switch_on_eop || !ia_switch_on_eop);
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-18 22:17:04 +02:00
|
|
|
/* If SWITCH_ON_EOI is set, PARTIAL_ES_WAVE must be set too. */
|
2017-04-23 20:29:04 +02:00
|
|
|
if (sscreen->b.chip_class <= VI && ia_switch_on_eoi)
|
2015-10-18 22:17:04 +02:00
|
|
|
partial_es_wave = true;
|
|
|
|
|
|
2014-08-15 16:32:03 +02:00
|
|
|
return S_028AA8_SWITCH_ON_EOP(ia_switch_on_eop) |
|
2015-02-22 18:06:34 +01:00
|
|
|
S_028AA8_SWITCH_ON_EOI(ia_switch_on_eoi) |
|
2014-08-15 22:45:10 +02:00
|
|
|
S_028AA8_PARTIAL_VS_WAVE_ON(partial_vs_wave) |
|
2015-02-22 18:06:34 +01:00
|
|
|
S_028AA8_PARTIAL_ES_WAVE_ON(partial_es_wave) |
|
2017-01-25 02:47:15 +01:00
|
|
|
S_028AA8_WD_SWITCH_ON_EOP(sscreen->b.chip_class >= CIK ? wd_switch_on_eop : 0) |
|
2017-04-23 20:14:42 +02:00
|
|
|
/* The following field was moved to VGT_SHADER_STAGES_EN in GFX9. */
|
|
|
|
|
S_028AA8_MAX_PRIMGRP_IN_WAVE(sscreen->b.chip_class == VI ?
|
2016-10-15 15:00:33 +02:00
|
|
|
max_primgroup_in_wave : 0) |
|
|
|
|
|
S_030960_EN_INST_OPT_BASIC(sscreen->b.chip_class >= GFX9) |
|
|
|
|
|
S_030960_EN_INST_OPT_ADV(sscreen->b.chip_class >= GFX9);
|
2014-08-15 16:32:03 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-25 02:47:15 +01:00
|
|
|
void si_init_ia_multi_vgt_param_table(struct si_context *sctx)
|
|
|
|
|
{
|
|
|
|
|
for (int prim = 0; prim <= R600_PRIM_RECTANGLE_LIST; prim++)
|
|
|
|
|
for (int uses_instancing = 0; uses_instancing < 2; uses_instancing++)
|
|
|
|
|
for (int multi_instances = 0; multi_instances < 2; multi_instances++)
|
|
|
|
|
for (int primitive_restart = 0; primitive_restart < 2; primitive_restart++)
|
|
|
|
|
for (int count_from_so = 0; count_from_so < 2; count_from_so++)
|
|
|
|
|
for (int line_stipple = 0; line_stipple < 2; line_stipple++)
|
|
|
|
|
for (int uses_tess = 0; uses_tess < 2; uses_tess++)
|
|
|
|
|
for (int tess_uses_primid = 0; tess_uses_primid < 2; tess_uses_primid++)
|
|
|
|
|
for (int uses_gs = 0; uses_gs < 2; uses_gs++) {
|
|
|
|
|
union si_vgt_param_key key;
|
|
|
|
|
|
|
|
|
|
key.index = 0;
|
|
|
|
|
key.u.prim = prim;
|
|
|
|
|
key.u.uses_instancing = uses_instancing;
|
|
|
|
|
key.u.multi_instances_smaller_than_primgroup = multi_instances;
|
|
|
|
|
key.u.primitive_restart = primitive_restart;
|
|
|
|
|
key.u.count_from_stream_output = count_from_so;
|
|
|
|
|
key.u.line_stipple_enabled = line_stipple;
|
|
|
|
|
key.u.uses_tess = uses_tess;
|
|
|
|
|
key.u.tcs_tes_uses_prim_id = tess_uses_primid;
|
|
|
|
|
key.u.uses_gs = uses_gs;
|
|
|
|
|
|
|
|
|
|
sctx->ia_multi_vgt_param[key.index] =
|
|
|
|
|
si_get_init_multi_vgt_param(sctx->screen, &key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static unsigned si_get_ia_multi_vgt_param(struct si_context *sctx,
|
|
|
|
|
const struct pipe_draw_info *info,
|
|
|
|
|
unsigned num_patches)
|
|
|
|
|
{
|
|
|
|
|
union si_vgt_param_key key = sctx->ia_multi_vgt_param_key;
|
|
|
|
|
unsigned primgroup_size;
|
|
|
|
|
unsigned ia_multi_vgt_param;
|
|
|
|
|
|
|
|
|
|
if (sctx->tes_shader.cso) {
|
|
|
|
|
primgroup_size = num_patches; /* must be a multiple of NUM_PATCHES */
|
|
|
|
|
} else if (sctx->gs_shader.cso) {
|
|
|
|
|
primgroup_size = 64; /* recommended with a GS */
|
|
|
|
|
} else {
|
|
|
|
|
primgroup_size = 128; /* recommended without a GS and tess */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
key.u.prim = info->mode;
|
|
|
|
|
key.u.uses_instancing = info->indirect || info->instance_count > 1;
|
|
|
|
|
key.u.multi_instances_smaller_than_primgroup =
|
|
|
|
|
info->indirect ||
|
|
|
|
|
(info->instance_count > 1 &&
|
2017-01-29 22:28:04 +01:00
|
|
|
(info->count_from_stream_output ||
|
|
|
|
|
si_num_prims_for_vertices(info) < primgroup_size));
|
2017-01-25 02:47:15 +01:00
|
|
|
key.u.primitive_restart = info->primitive_restart;
|
|
|
|
|
key.u.count_from_stream_output = info->count_from_stream_output != NULL;
|
|
|
|
|
|
|
|
|
|
ia_multi_vgt_param = sctx->ia_multi_vgt_param[key.index] |
|
|
|
|
|
S_028AA8_PRIMGROUP_SIZE(primgroup_size - 1);
|
|
|
|
|
|
|
|
|
|
if (sctx->gs_shader.cso) {
|
|
|
|
|
/* GS requirement. */
|
2017-04-19 03:21:16 +02:00
|
|
|
if (sctx->b.chip_class <= VI &&
|
|
|
|
|
SI_GS_PER_ES / primgroup_size >= sctx->screen->gs_table_depth - 3)
|
2017-01-25 02:47:15 +01:00
|
|
|
ia_multi_vgt_param |= S_028AA8_PARTIAL_ES_WAVE_ON(1);
|
|
|
|
|
|
|
|
|
|
/* GS hw bug with single-primitive instances and SWITCH_ON_EOI.
|
|
|
|
|
* The hw doc says all multi-SE chips are affected, but Vulkan
|
|
|
|
|
* only applies it to Hawaii. Do what Vulkan does.
|
|
|
|
|
*/
|
|
|
|
|
if (sctx->b.family == CHIP_HAWAII &&
|
|
|
|
|
G_028AA8_SWITCH_ON_EOI(ia_multi_vgt_param) &&
|
|
|
|
|
(info->indirect ||
|
|
|
|
|
(info->instance_count > 1 &&
|
2017-01-29 22:28:04 +01:00
|
|
|
(info->count_from_stream_output ||
|
|
|
|
|
si_num_prims_for_vertices(info) <= 1))))
|
2017-01-25 02:47:15 +01:00
|
|
|
sctx->b.flags |= SI_CONTEXT_VGT_FLUSH;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ia_multi_vgt_param;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-31 20:09:46 +01:00
|
|
|
/* rast_prim is the primitive type after GS. */
|
2015-02-22 17:42:20 +01:00
|
|
|
static void si_emit_rasterizer_prim_state(struct si_context *sctx)
|
2014-12-07 16:40:09 +01:00
|
|
|
{
|
2015-11-07 14:00:30 +01:00
|
|
|
struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
|
2017-04-02 20:33:04 +03:00
|
|
|
enum pipe_prim_type rast_prim = sctx->current_rast_prim;
|
2015-03-15 19:21:31 +01:00
|
|
|
struct si_state_rasterizer *rs = sctx->emitted.named.rasterizer;
|
2014-12-07 16:40:09 +01:00
|
|
|
|
2015-03-15 19:24:13 +01:00
|
|
|
/* Skip this if not rendering lines. */
|
|
|
|
|
if (rast_prim != PIPE_PRIM_LINES &&
|
|
|
|
|
rast_prim != PIPE_PRIM_LINE_LOOP &&
|
|
|
|
|
rast_prim != PIPE_PRIM_LINE_STRIP &&
|
|
|
|
|
rast_prim != PIPE_PRIM_LINES_ADJACENCY &&
|
|
|
|
|
rast_prim != PIPE_PRIM_LINE_STRIP_ADJACENCY)
|
|
|
|
|
return;
|
|
|
|
|
|
2015-03-15 19:21:31 +01:00
|
|
|
if (rast_prim == sctx->last_rast_prim &&
|
|
|
|
|
rs->pa_sc_line_stipple == sctx->last_sc_line_stipple)
|
2014-12-08 13:35:36 +01:00
|
|
|
return;
|
|
|
|
|
|
2016-06-28 13:04:07 +02:00
|
|
|
/* For lines, reset the stipple pattern at each primitive. Otherwise,
|
|
|
|
|
* reset the stipple pattern at each packet (line strips, line loops).
|
|
|
|
|
*/
|
2015-08-30 01:54:00 +02:00
|
|
|
radeon_set_context_reg(cs, R_028A0C_PA_SC_LINE_STIPPLE,
|
2015-03-15 19:21:31 +01:00
|
|
|
rs->pa_sc_line_stipple |
|
2016-06-28 13:04:07 +02:00
|
|
|
S_028A0C_AUTO_RESET_CNTL(rast_prim == PIPE_PRIM_LINES ? 1 : 2));
|
2014-12-07 16:40:09 +01:00
|
|
|
|
2015-01-31 20:09:46 +01:00
|
|
|
sctx->last_rast_prim = rast_prim;
|
2015-03-15 19:21:31 +01:00
|
|
|
sctx->last_sc_line_stipple = rs->pa_sc_line_stipple;
|
2014-12-07 16:40:09 +01:00
|
|
|
}
|
|
|
|
|
|
2017-04-12 11:01:19 +02:00
|
|
|
static void si_emit_vs_state(struct si_context *sctx,
|
|
|
|
|
const struct pipe_draw_info *info)
|
2017-04-12 10:00:18 +02:00
|
|
|
{
|
2017-04-12 11:01:19 +02:00
|
|
|
sctx->current_vs_state &= C_VS_STATE_INDEXED;
|
|
|
|
|
sctx->current_vs_state |= S_VS_STATE_INDEXED(!!info->indexed);
|
|
|
|
|
|
2017-04-12 10:00:18 +02:00
|
|
|
if (sctx->current_vs_state != sctx->last_vs_state) {
|
|
|
|
|
struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
|
|
|
|
|
|
|
|
|
|
radeon_set_sh_reg(cs,
|
2017-04-12 10:46:22 +02:00
|
|
|
sctx->shader_userdata.sh_base[PIPE_SHADER_VERTEX] +
|
|
|
|
|
SI_SGPR_VS_STATE_BITS * 4,
|
2017-04-12 10:00:18 +02:00
|
|
|
sctx->current_vs_state);
|
|
|
|
|
|
|
|
|
|
sctx->last_vs_state = sctx->current_vs_state;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-07 16:40:09 +01:00
|
|
|
static void si_emit_draw_registers(struct si_context *sctx,
|
2017-04-12 09:40:28 +02:00
|
|
|
const struct pipe_draw_info *info,
|
|
|
|
|
unsigned num_patches)
|
2014-12-07 16:40:09 +01:00
|
|
|
{
|
2015-11-07 14:00:30 +01:00
|
|
|
struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
|
2014-12-07 16:40:09 +01:00
|
|
|
unsigned prim = si_conv_pipe_prim(info->mode);
|
2015-02-22 17:42:20 +01:00
|
|
|
unsigned gs_out_prim = si_conv_prim_to_gs_out(sctx->current_rast_prim);
|
2017-04-12 09:40:28 +02:00
|
|
|
unsigned ia_multi_vgt_param;
|
2015-02-22 18:01:18 +01:00
|
|
|
|
2015-02-22 18:06:34 +01:00
|
|
|
ia_multi_vgt_param = si_get_ia_multi_vgt_param(sctx, info, num_patches);
|
|
|
|
|
|
2014-12-07 16:40:09 +01:00
|
|
|
/* Draw state. */
|
2016-09-30 22:47:20 +02:00
|
|
|
if (ia_multi_vgt_param != sctx->last_multi_vgt_param) {
|
2016-10-15 15:00:33 +02:00
|
|
|
if (sctx->b.chip_class >= GFX9)
|
|
|
|
|
radeon_set_uconfig_reg_idx(cs, R_030960_IA_MULTI_VGT_PARAM, 4, ia_multi_vgt_param);
|
|
|
|
|
else if (sctx->b.chip_class >= CIK)
|
2016-06-24 01:11:09 +02:00
|
|
|
radeon_set_context_reg_idx(cs, R_028AA8_IA_MULTI_VGT_PARAM, 1, ia_multi_vgt_param);
|
2016-09-30 22:47:20 +02:00
|
|
|
else
|
|
|
|
|
radeon_set_context_reg(cs, R_028AA8_IA_MULTI_VGT_PARAM, ia_multi_vgt_param);
|
|
|
|
|
|
|
|
|
|
sctx->last_multi_vgt_param = ia_multi_vgt_param;
|
|
|
|
|
}
|
|
|
|
|
if (prim != sctx->last_prim) {
|
|
|
|
|
if (sctx->b.chip_class >= CIK)
|
2016-06-24 01:11:09 +02:00
|
|
|
radeon_set_uconfig_reg_idx(cs, R_030908_VGT_PRIMITIVE_TYPE, 1, prim);
|
2016-09-30 22:47:20 +02:00
|
|
|
else
|
2015-08-30 01:54:00 +02:00
|
|
|
radeon_set_config_reg(cs, R_008958_VGT_PRIMITIVE_TYPE, prim);
|
2016-06-24 01:11:09 +02:00
|
|
|
|
2014-12-07 20:23:56 +01:00
|
|
|
sctx->last_prim = prim;
|
2014-12-07 16:40:09 +01:00
|
|
|
}
|
|
|
|
|
|
2014-12-07 20:15:49 +01:00
|
|
|
if (gs_out_prim != sctx->last_gs_out_prim) {
|
2015-08-30 01:54:00 +02:00
|
|
|
radeon_set_context_reg(cs, R_028A6C_VGT_GS_OUT_PRIM_TYPE, gs_out_prim);
|
2014-12-07 20:15:49 +01:00
|
|
|
sctx->last_gs_out_prim = gs_out_prim;
|
|
|
|
|
}
|
2014-12-07 20:14:41 +01:00
|
|
|
|
|
|
|
|
/* Primitive restart. */
|
|
|
|
|
if (info->primitive_restart != sctx->last_primitive_restart_en) {
|
2016-10-15 15:00:33 +02:00
|
|
|
if (sctx->b.chip_class >= GFX9)
|
|
|
|
|
radeon_set_uconfig_reg(cs, R_03092C_VGT_MULTI_PRIM_IB_RESET_EN,
|
|
|
|
|
info->primitive_restart);
|
|
|
|
|
else
|
|
|
|
|
radeon_set_context_reg(cs, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN,
|
|
|
|
|
info->primitive_restart);
|
|
|
|
|
|
2014-12-07 20:14:41 +01:00
|
|
|
sctx->last_primitive_restart_en = info->primitive_restart;
|
|
|
|
|
|
2016-10-04 14:30:11 +01:00
|
|
|
}
|
|
|
|
|
if (info->primitive_restart &&
|
|
|
|
|
(info->restart_index != sctx->last_restart_index ||
|
|
|
|
|
sctx->last_restart_index == SI_RESTART_INDEX_UNKNOWN)) {
|
|
|
|
|
radeon_set_context_reg(cs, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX,
|
|
|
|
|
info->restart_index);
|
|
|
|
|
sctx->last_restart_index = info->restart_index;
|
2014-12-07 20:14:41 +01:00
|
|
|
}
|
2014-12-07 16:40:09 +01:00
|
|
|
}
|
|
|
|
|
|
2014-12-07 15:52:15 +01:00
|
|
|
static void si_emit_draw_packets(struct si_context *sctx,
|
|
|
|
|
const struct pipe_draw_info *info,
|
|
|
|
|
const struct pipe_index_buffer *ib)
|
2012-08-03 10:26:01 +02:00
|
|
|
{
|
2015-11-07 14:00:30 +01:00
|
|
|
struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
|
2014-09-15 23:34:28 +02:00
|
|
|
unsigned sh_base_reg = sctx->shader_userdata.sh_base[PIPE_SHADER_VERTEX];
|
2015-11-07 16:30:01 +01:00
|
|
|
bool render_cond_bit = sctx->b.render_cond && !sctx->b.render_cond_force_off;
|
2016-07-29 17:56:21 +01:00
|
|
|
uint32_t index_max_size = 0;
|
|
|
|
|
uint64_t index_va = 0;
|
2012-08-03 10:26:01 +02:00
|
|
|
|
2013-08-26 18:17:09 +02:00
|
|
|
if (info->count_from_stream_output) {
|
|
|
|
|
struct r600_so_target *t =
|
|
|
|
|
(struct r600_so_target*)info->count_from_stream_output;
|
2014-08-06 22:29:27 +02:00
|
|
|
uint64_t va = t->buf_filled_size->gpu_address +
|
|
|
|
|
t->buf_filled_size_offset;
|
2013-08-26 18:17:09 +02:00
|
|
|
|
2015-08-30 01:54:00 +02:00
|
|
|
radeon_set_context_reg(cs, R_028B30_VGT_STRMOUT_DRAW_OPAQUE_VERTEX_STRIDE,
|
2014-12-07 15:52:15 +01:00
|
|
|
t->stride_in_dw);
|
|
|
|
|
|
|
|
|
|
radeon_emit(cs, PKT3(PKT3_COPY_DATA, 4, 0));
|
|
|
|
|
radeon_emit(cs, COPY_DATA_SRC_SEL(COPY_DATA_MEM) |
|
|
|
|
|
COPY_DATA_DST_SEL(COPY_DATA_REG) |
|
|
|
|
|
COPY_DATA_WR_CONFIRM);
|
|
|
|
|
radeon_emit(cs, va); /* src address lo */
|
|
|
|
|
radeon_emit(cs, va >> 32); /* src address hi */
|
|
|
|
|
radeon_emit(cs, R_028B2C_VGT_STRMOUT_DRAW_OPAQUE_BUFFER_FILLED_SIZE >> 2);
|
|
|
|
|
radeon_emit(cs, 0); /* unused */
|
|
|
|
|
|
2015-11-07 14:00:30 +01:00
|
|
|
radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx,
|
2014-12-07 15:52:15 +01:00
|
|
|
t->buf_filled_size, RADEON_USAGE_READ,
|
2015-09-26 23:18:55 +02:00
|
|
|
RADEON_PRIO_SO_FILLED_SIZE);
|
2013-08-26 18:17:09 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-03 10:26:01 +02:00
|
|
|
/* draw packet */
|
2014-12-07 15:52:15 +01:00
|
|
|
if (info->indexed) {
|
2016-09-06 00:35:12 +02:00
|
|
|
if (ib->index_size != sctx->last_index_size) {
|
2016-10-15 15:00:33 +02:00
|
|
|
unsigned index_type;
|
2016-09-06 00:35:12 +02:00
|
|
|
|
|
|
|
|
/* index type */
|
|
|
|
|
switch (ib->index_size) {
|
|
|
|
|
case 1:
|
2016-10-15 15:00:33 +02:00
|
|
|
index_type = V_028A7C_VGT_INDEX_8;
|
2016-09-06 00:35:12 +02:00
|
|
|
break;
|
|
|
|
|
case 2:
|
2016-10-15 15:00:33 +02:00
|
|
|
index_type = V_028A7C_VGT_INDEX_16 |
|
|
|
|
|
(SI_BIG_ENDIAN && sctx->b.chip_class <= CIK ?
|
|
|
|
|
V_028A7C_VGT_DMA_SWAP_16_BIT : 0);
|
2016-09-06 00:35:12 +02:00
|
|
|
break;
|
|
|
|
|
case 4:
|
2016-10-15 15:00:33 +02:00
|
|
|
index_type = V_028A7C_VGT_INDEX_32 |
|
|
|
|
|
(SI_BIG_ENDIAN && sctx->b.chip_class <= CIK ?
|
|
|
|
|
V_028A7C_VGT_DMA_SWAP_32_BIT : 0);
|
2016-09-06 00:35:12 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
assert(!"unreachable");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-15 15:00:33 +02:00
|
|
|
if (sctx->b.chip_class >= GFX9) {
|
|
|
|
|
radeon_set_uconfig_reg_idx(cs, R_03090C_VGT_INDEX_TYPE,
|
|
|
|
|
2, index_type);
|
|
|
|
|
} else {
|
|
|
|
|
radeon_emit(cs, PKT3(PKT3_INDEX_TYPE, 0, 0));
|
|
|
|
|
radeon_emit(cs, index_type);
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-06 00:35:12 +02:00
|
|
|
sctx->last_index_size = ib->index_size;
|
2014-12-07 15:52:15 +01:00
|
|
|
}
|
2016-07-29 17:56:21 +01:00
|
|
|
|
|
|
|
|
index_max_size = (ib->buffer->width0 - ib->offset) /
|
|
|
|
|
ib->index_size;
|
|
|
|
|
index_va = r600_resource(ib->buffer)->gpu_address + ib->offset;
|
|
|
|
|
|
|
|
|
|
radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx,
|
|
|
|
|
(struct r600_resource *)ib->buffer,
|
|
|
|
|
RADEON_USAGE_READ, RADEON_PRIO_INDEX_BUFFER);
|
2016-09-06 00:35:12 +02:00
|
|
|
} else {
|
|
|
|
|
/* On CI and later, non-indexed draws overwrite VGT_INDEX_TYPE,
|
|
|
|
|
* so the state must be re-emitted before the next indexed draw.
|
|
|
|
|
*/
|
|
|
|
|
if (sctx->b.chip_class >= CIK)
|
|
|
|
|
sctx->last_index_size = -1;
|
2012-08-03 10:26:01 +02:00
|
|
|
}
|
|
|
|
|
|
2017-04-02 15:27:02 +02:00
|
|
|
if (info->indirect) {
|
2016-07-29 17:51:23 +01:00
|
|
|
uint64_t indirect_va = r600_resource(info->indirect)->gpu_address;
|
|
|
|
|
|
|
|
|
|
assert(indirect_va % 8 == 0);
|
|
|
|
|
|
2014-12-07 20:04:40 +01:00
|
|
|
si_invalidate_draw_sh_constants(sctx);
|
|
|
|
|
|
2016-07-29 17:51:23 +01:00
|
|
|
radeon_emit(cs, PKT3(PKT3_SET_BASE, 2, 0));
|
|
|
|
|
radeon_emit(cs, 1);
|
|
|
|
|
radeon_emit(cs, indirect_va);
|
|
|
|
|
radeon_emit(cs, indirect_va >> 32);
|
|
|
|
|
|
2015-11-07 14:00:30 +01:00
|
|
|
radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx,
|
2014-12-07 15:52:15 +01:00
|
|
|
(struct r600_resource *)info->indirect,
|
2015-09-26 23:18:55 +02:00
|
|
|
RADEON_USAGE_READ, RADEON_PRIO_DRAW_INDIRECT);
|
2014-04-23 16:15:36 +02:00
|
|
|
|
2016-07-29 18:05:30 +01:00
|
|
|
unsigned di_src_sel = info->indexed ? V_0287F0_DI_SRC_SEL_DMA
|
|
|
|
|
: V_0287F0_DI_SRC_SEL_AUTO_INDEX;
|
|
|
|
|
|
|
|
|
|
assert(info->indirect_offset % 4 == 0);
|
2014-12-07 15:52:15 +01:00
|
|
|
|
2016-07-29 18:05:30 +01:00
|
|
|
if (info->indexed) {
|
2014-12-07 15:52:15 +01:00
|
|
|
radeon_emit(cs, PKT3(PKT3_INDEX_BASE, 1, 0));
|
|
|
|
|
radeon_emit(cs, index_va);
|
|
|
|
|
radeon_emit(cs, index_va >> 32);
|
|
|
|
|
|
|
|
|
|
radeon_emit(cs, PKT3(PKT3_INDEX_BUFFER_SIZE, 0, 0));
|
|
|
|
|
radeon_emit(cs, index_max_size);
|
2016-07-29 18:05:30 +01:00
|
|
|
}
|
2014-12-07 15:52:15 +01:00
|
|
|
|
2016-07-29 17:59:11 +01:00
|
|
|
if (!sctx->screen->has_draw_indirect_multi) {
|
2016-07-29 18:05:30 +01:00
|
|
|
radeon_emit(cs, PKT3(info->indexed ? PKT3_DRAW_INDEX_INDIRECT
|
|
|
|
|
: PKT3_DRAW_INDIRECT,
|
|
|
|
|
3, render_cond_bit));
|
|
|
|
|
radeon_emit(cs, info->indirect_offset);
|
|
|
|
|
radeon_emit(cs, (sh_base_reg + SI_SGPR_BASE_VERTEX * 4 - SI_SH_REG_OFFSET) >> 2);
|
|
|
|
|
radeon_emit(cs, (sh_base_reg + SI_SGPR_START_INSTANCE * 4 - SI_SH_REG_OFFSET) >> 2);
|
|
|
|
|
radeon_emit(cs, di_src_sel);
|
2014-04-24 03:03:43 +02:00
|
|
|
} else {
|
2016-08-08 16:00:29 +02:00
|
|
|
uint64_t count_va = 0;
|
|
|
|
|
|
|
|
|
|
if (info->indirect_params) {
|
|
|
|
|
struct r600_resource *params_buf =
|
|
|
|
|
(struct r600_resource *)info->indirect_params;
|
|
|
|
|
|
|
|
|
|
radeon_add_to_buffer_list(
|
|
|
|
|
&sctx->b, &sctx->b.gfx, params_buf,
|
|
|
|
|
RADEON_USAGE_READ, RADEON_PRIO_DRAW_INDIRECT);
|
|
|
|
|
|
|
|
|
|
count_va = params_buf->gpu_address + info->indirect_params_offset;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-29 18:05:30 +01:00
|
|
|
radeon_emit(cs, PKT3(info->indexed ? PKT3_DRAW_INDEX_INDIRECT_MULTI :
|
|
|
|
|
PKT3_DRAW_INDIRECT_MULTI,
|
|
|
|
|
8, render_cond_bit));
|
|
|
|
|
radeon_emit(cs, info->indirect_offset);
|
|
|
|
|
radeon_emit(cs, (sh_base_reg + SI_SGPR_BASE_VERTEX * 4 - SI_SH_REG_OFFSET) >> 2);
|
|
|
|
|
radeon_emit(cs, (sh_base_reg + SI_SGPR_START_INSTANCE * 4 - SI_SH_REG_OFFSET) >> 2);
|
2016-08-08 15:54:50 +02:00
|
|
|
radeon_emit(cs, ((sh_base_reg + SI_SGPR_DRAWID * 4 - SI_SH_REG_OFFSET) >> 2) |
|
2016-08-08 16:00:29 +02:00
|
|
|
S_2C3_DRAW_INDEX_ENABLE(1) |
|
|
|
|
|
S_2C3_COUNT_INDIRECT_ENABLE(!!info->indirect_params));
|
|
|
|
|
radeon_emit(cs, info->indirect_count);
|
|
|
|
|
radeon_emit(cs, count_va);
|
|
|
|
|
radeon_emit(cs, count_va >> 32);
|
|
|
|
|
radeon_emit(cs, info->indirect_stride);
|
2016-07-29 18:05:30 +01:00
|
|
|
radeon_emit(cs, di_src_sel);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2017-04-02 15:27:02 +02:00
|
|
|
int base_vertex;
|
|
|
|
|
|
|
|
|
|
radeon_emit(cs, PKT3(PKT3_NUM_INSTANCES, 0, 0));
|
|
|
|
|
radeon_emit(cs, info->instance_count);
|
|
|
|
|
|
|
|
|
|
/* Base vertex and start instance. */
|
|
|
|
|
base_vertex = info->indexed ? info->index_bias : info->start;
|
|
|
|
|
|
|
|
|
|
if (base_vertex != sctx->last_base_vertex ||
|
|
|
|
|
sctx->last_base_vertex == SI_BASE_VERTEX_UNKNOWN ||
|
|
|
|
|
info->start_instance != sctx->last_start_instance ||
|
|
|
|
|
info->drawid != sctx->last_drawid ||
|
|
|
|
|
sh_base_reg != sctx->last_sh_base_reg) {
|
|
|
|
|
radeon_set_sh_reg_seq(cs, sh_base_reg + SI_SGPR_BASE_VERTEX * 4, 3);
|
|
|
|
|
radeon_emit(cs, base_vertex);
|
|
|
|
|
radeon_emit(cs, info->start_instance);
|
|
|
|
|
radeon_emit(cs, info->drawid);
|
|
|
|
|
|
|
|
|
|
sctx->last_base_vertex = base_vertex;
|
|
|
|
|
sctx->last_start_instance = info->start_instance;
|
|
|
|
|
sctx->last_drawid = info->drawid;
|
|
|
|
|
sctx->last_sh_base_reg = sh_base_reg;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-29 18:05:30 +01:00
|
|
|
if (info->indexed) {
|
2014-12-07 15:52:15 +01:00
|
|
|
index_va += info->start * ib->index_size;
|
|
|
|
|
|
2015-11-07 14:45:58 +01:00
|
|
|
radeon_emit(cs, PKT3(PKT3_DRAW_INDEX_2, 4, render_cond_bit));
|
2014-12-07 15:52:15 +01:00
|
|
|
radeon_emit(cs, index_max_size);
|
|
|
|
|
radeon_emit(cs, index_va);
|
2016-10-15 15:00:33 +02:00
|
|
|
radeon_emit(cs, index_va >> 32);
|
2014-12-07 15:52:15 +01:00
|
|
|
radeon_emit(cs, info->count);
|
|
|
|
|
radeon_emit(cs, V_0287F0_DI_SRC_SEL_DMA);
|
2014-04-24 03:03:43 +02:00
|
|
|
} else {
|
2015-11-07 14:45:58 +01:00
|
|
|
radeon_emit(cs, PKT3(PKT3_DRAW_INDEX_AUTO, 1, render_cond_bit));
|
2014-12-07 15:52:15 +01:00
|
|
|
radeon_emit(cs, info->count);
|
|
|
|
|
radeon_emit(cs, V_0287F0_DI_SRC_SEL_AUTO_INDEX |
|
2016-07-29 18:05:30 +01:00
|
|
|
S_0287F0_USE_OPAQUE(!!info->count_from_stream_output));
|
2014-04-24 03:03:43 +02:00
|
|
|
}
|
2012-08-03 10:26:01 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 18:49:22 +02:00
|
|
|
static void si_emit_surface_sync(struct r600_common_context *rctx,
|
|
|
|
|
unsigned cp_coher_cntl)
|
|
|
|
|
{
|
|
|
|
|
struct radeon_winsys_cs *cs = rctx->gfx.cs;
|
|
|
|
|
|
2016-10-15 16:09:26 +02:00
|
|
|
if (rctx->chip_class >= GFX9) {
|
|
|
|
|
/* Flush caches and wait for the caches to assert idle. */
|
|
|
|
|
radeon_emit(cs, PKT3(PKT3_ACQUIRE_MEM, 5, 0));
|
|
|
|
|
radeon_emit(cs, cp_coher_cntl); /* CP_COHER_CNTL */
|
|
|
|
|
radeon_emit(cs, 0xffffffff); /* CP_COHER_SIZE */
|
|
|
|
|
radeon_emit(cs, 0xffffff); /* CP_COHER_SIZE_HI */
|
|
|
|
|
radeon_emit(cs, 0); /* CP_COHER_BASE */
|
|
|
|
|
radeon_emit(cs, 0); /* CP_COHER_BASE_HI */
|
|
|
|
|
radeon_emit(cs, 0x0000000A); /* POLL_INTERVAL */
|
|
|
|
|
} else {
|
|
|
|
|
/* ACQUIRE_MEM is only required on a compute ring. */
|
|
|
|
|
radeon_emit(cs, PKT3(PKT3_SURFACE_SYNC, 3, 0));
|
|
|
|
|
radeon_emit(cs, cp_coher_cntl); /* CP_COHER_CNTL */
|
|
|
|
|
radeon_emit(cs, 0xffffffff); /* CP_COHER_SIZE */
|
|
|
|
|
radeon_emit(cs, 0); /* CP_COHER_BASE */
|
|
|
|
|
radeon_emit(cs, 0x0000000A); /* POLL_INTERVAL */
|
|
|
|
|
}
|
2016-10-10 18:49:22 +02:00
|
|
|
}
|
|
|
|
|
|
2016-09-08 00:59:55 +02:00
|
|
|
void si_emit_cache_flush(struct si_context *sctx)
|
radeonsi: simplify and improve flushing
This mimics r600g. The R600_CONTEXT_xxx flags are added to rctx->b.flags
and si_emit_cache_flush emits the packets. That's it. The shared radeon code
tells us when the streamout cache should be flushed, so we have to check
the flags anyway.
There is a new atom "cache_flush", because caches must be flushed *after*
resource descriptors are changed in memory.
Functional changes:
* Write caches are flushed at the end of CS and read caches are flushed
at its beginning.
* Sampler view states are removed from si_state, they only held the flush
flags.
* Everytime a shader is changed, the I cache is flushed. Is this needed?
Due to a hw bug, this also flushes the K cache.
* The WRITE_DATA packet is changed to use TC, which fixes a rendering issue
in openarena. I'm not sure how TC interacts with CP DMA, but for now it
seems to work better than any other solution I tried. (BTW CIK allows us
to use TC for CP DMA.)
* Flush the K cache instead of the texture cache when updating resource
descriptors (due to a hw bug, this also flushes the I cache).
I think the K cache flush is correct here, but I'm not sure if the texture
cache should be flushed too (probably not considering we use TC
for WRITE_DATA, but we don't use TC for CP DMA).
* The number of resource contexts is decreased to 16. With all of these cache
changes, 4 doesn't work, but 8 works, which suggests I'm actually doing
the right thing here and the pipeline isn't drained during flushes.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-26 17:19:39 +02:00
|
|
|
{
|
2016-08-25 14:08:24 +02:00
|
|
|
struct r600_common_context *rctx = &sctx->b;
|
|
|
|
|
struct radeon_winsys_cs *cs = rctx->gfx.cs;
|
radeonsi: simplify and improve flushing
This mimics r600g. The R600_CONTEXT_xxx flags are added to rctx->b.flags
and si_emit_cache_flush emits the packets. That's it. The shared radeon code
tells us when the streamout cache should be flushed, so we have to check
the flags anyway.
There is a new atom "cache_flush", because caches must be flushed *after*
resource descriptors are changed in memory.
Functional changes:
* Write caches are flushed at the end of CS and read caches are flushed
at its beginning.
* Sampler view states are removed from si_state, they only held the flush
flags.
* Everytime a shader is changed, the I cache is flushed. Is this needed?
Due to a hw bug, this also flushes the K cache.
* The WRITE_DATA packet is changed to use TC, which fixes a rendering issue
in openarena. I'm not sure how TC interacts with CP DMA, but for now it
seems to work better than any other solution I tried. (BTW CIK allows us
to use TC for CP DMA.)
* Flush the K cache instead of the texture cache when updating resource
descriptors (due to a hw bug, this also flushes the I cache).
I think the K cache flush is correct here, but I'm not sure if the texture
cache should be flushed too (probably not considering we use TC
for WRITE_DATA, but we don't use TC for CP DMA).
* The number of resource contexts is decreased to 16. With all of these cache
changes, 4 doesn't work, but 8 works, which suggests I'm actually doing
the right thing here and the pipeline isn't drained during flushes.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-26 17:19:39 +02:00
|
|
|
uint32_t cp_coher_cntl = 0;
|
2016-10-15 16:21:20 +02:00
|
|
|
uint32_t flush_cb_db = rctx->flags & (SI_CONTEXT_FLUSH_AND_INV_CB |
|
|
|
|
|
SI_CONTEXT_FLUSH_AND_INV_DB);
|
radeonsi: simplify and improve flushing
This mimics r600g. The R600_CONTEXT_xxx flags are added to rctx->b.flags
and si_emit_cache_flush emits the packets. That's it. The shared radeon code
tells us when the streamout cache should be flushed, so we have to check
the flags anyway.
There is a new atom "cache_flush", because caches must be flushed *after*
resource descriptors are changed in memory.
Functional changes:
* Write caches are flushed at the end of CS and read caches are flushed
at its beginning.
* Sampler view states are removed from si_state, they only held the flush
flags.
* Everytime a shader is changed, the I cache is flushed. Is this needed?
Due to a hw bug, this also flushes the K cache.
* The WRITE_DATA packet is changed to use TC, which fixes a rendering issue
in openarena. I'm not sure how TC interacts with CP DMA, but for now it
seems to work better than any other solution I tried. (BTW CIK allows us
to use TC for CP DMA.)
* Flush the K cache instead of the texture cache when updating resource
descriptors (due to a hw bug, this also flushes the I cache).
I think the K cache flush is correct here, but I'm not sure if the texture
cache should be flushed too (probably not considering we use TC
for WRITE_DATA, but we don't use TC for CP DMA).
* The number of resource contexts is decreased to 16. With all of these cache
changes, 4 doesn't work, but 8 works, which suggests I'm actually doing
the right thing here and the pipeline isn't drained during flushes.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-26 17:19:39 +02:00
|
|
|
|
2017-02-08 03:05:11 +01:00
|
|
|
if (rctx->flags & (SI_CONTEXT_FLUSH_AND_INV_CB |
|
|
|
|
|
SI_CONTEXT_FLUSH_AND_INV_DB))
|
2016-12-25 19:48:55 +01:00
|
|
|
sctx->b.num_fb_cache_flushes++;
|
|
|
|
|
|
2014-12-28 23:11:38 +01:00
|
|
|
/* SI has a bug that it always flushes ICACHE and KCACHE if either
|
2015-02-19 13:03:54 +01:00
|
|
|
* bit is set. An alternative way is to write SQC_CACHES, but that
|
|
|
|
|
* doesn't seem to work reliably. Since the bug doesn't affect
|
|
|
|
|
* correctness (it only does more work than necessary) and
|
|
|
|
|
* the performance impact is likely negligible, there is no plan
|
2016-04-17 15:34:24 +02:00
|
|
|
* to add a workaround for it.
|
2015-02-19 13:03:54 +01:00
|
|
|
*/
|
|
|
|
|
|
2016-08-25 14:08:24 +02:00
|
|
|
if (rctx->flags & SI_CONTEXT_INV_ICACHE)
|
2015-02-19 13:03:54 +01:00
|
|
|
cp_coher_cntl |= S_0085F0_SH_ICACHE_ACTION_ENA(1);
|
2016-08-25 14:08:24 +02:00
|
|
|
if (rctx->flags & SI_CONTEXT_INV_SMEM_L1)
|
2015-02-19 13:03:54 +01:00
|
|
|
cp_coher_cntl |= S_0085F0_SH_KCACHE_ACTION_ENA(1);
|
2014-12-29 14:02:46 +01:00
|
|
|
|
2016-10-15 16:21:20 +02:00
|
|
|
if (rctx->chip_class <= VI) {
|
|
|
|
|
if (rctx->flags & SI_CONTEXT_FLUSH_AND_INV_CB) {
|
|
|
|
|
cp_coher_cntl |= S_0085F0_CB_ACTION_ENA(1) |
|
|
|
|
|
S_0085F0_CB0_DEST_BASE_ENA(1) |
|
|
|
|
|
S_0085F0_CB1_DEST_BASE_ENA(1) |
|
|
|
|
|
S_0085F0_CB2_DEST_BASE_ENA(1) |
|
|
|
|
|
S_0085F0_CB3_DEST_BASE_ENA(1) |
|
|
|
|
|
S_0085F0_CB4_DEST_BASE_ENA(1) |
|
|
|
|
|
S_0085F0_CB5_DEST_BASE_ENA(1) |
|
|
|
|
|
S_0085F0_CB6_DEST_BASE_ENA(1) |
|
|
|
|
|
S_0085F0_CB7_DEST_BASE_ENA(1);
|
|
|
|
|
|
|
|
|
|
/* Necessary for DCC */
|
|
|
|
|
if (rctx->chip_class == VI)
|
|
|
|
|
r600_gfx_write_event_eop(rctx, V_028A90_FLUSH_AND_INV_CB_DATA_TS,
|
|
|
|
|
0, 0, NULL, 0, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
if (rctx->flags & SI_CONTEXT_FLUSH_AND_INV_DB)
|
|
|
|
|
cp_coher_cntl |= S_0085F0_DB_ACTION_ENA(1) |
|
|
|
|
|
S_0085F0_DB_DEST_BASE_ENA(1);
|
|
|
|
|
}
|
2017-02-08 03:01:32 +01:00
|
|
|
|
2016-10-15 16:21:20 +02:00
|
|
|
if (rctx->flags & SI_CONTEXT_FLUSH_AND_INV_CB) {
|
2017-02-08 03:01:32 +01:00
|
|
|
/* Flush CMASK/FMASK/DCC. SURFACE_SYNC will wait for idle. */
|
|
|
|
|
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
|
|
|
|
radeon_emit(cs, EVENT_TYPE(V_028A90_FLUSH_AND_INV_CB_META) | EVENT_INDEX(0));
|
radeonsi: simplify and improve flushing
This mimics r600g. The R600_CONTEXT_xxx flags are added to rctx->b.flags
and si_emit_cache_flush emits the packets. That's it. The shared radeon code
tells us when the streamout cache should be flushed, so we have to check
the flags anyway.
There is a new atom "cache_flush", because caches must be flushed *after*
resource descriptors are changed in memory.
Functional changes:
* Write caches are flushed at the end of CS and read caches are flushed
at its beginning.
* Sampler view states are removed from si_state, they only held the flush
flags.
* Everytime a shader is changed, the I cache is flushed. Is this needed?
Due to a hw bug, this also flushes the K cache.
* The WRITE_DATA packet is changed to use TC, which fixes a rendering issue
in openarena. I'm not sure how TC interacts with CP DMA, but for now it
seems to work better than any other solution I tried. (BTW CIK allows us
to use TC for CP DMA.)
* Flush the K cache instead of the texture cache when updating resource
descriptors (due to a hw bug, this also flushes the I cache).
I think the K cache flush is correct here, but I'm not sure if the texture
cache should be flushed too (probably not considering we use TC
for WRITE_DATA, but we don't use TC for CP DMA).
* The number of resource contexts is decreased to 16. With all of these cache
changes, 4 doesn't work, but 8 works, which suggests I'm actually doing
the right thing here and the pipeline isn't drained during flushes.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-26 17:19:39 +02:00
|
|
|
}
|
2016-08-25 14:08:24 +02:00
|
|
|
if (rctx->flags & SI_CONTEXT_FLUSH_AND_INV_DB) {
|
2017-02-08 03:01:32 +01:00
|
|
|
/* Flush HTILE. SURFACE_SYNC will wait for idle. */
|
2016-04-02 11:37:06 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
2013-12-17 00:46:45 +01:00
|
|
|
radeon_emit(cs, EVENT_TYPE(V_028A90_FLUSH_AND_INV_DB_META) | EVENT_INDEX(0));
|
|
|
|
|
}
|
radeonsi: simplify and improve flushing
This mimics r600g. The R600_CONTEXT_xxx flags are added to rctx->b.flags
and si_emit_cache_flush emits the packets. That's it. The shared radeon code
tells us when the streamout cache should be flushed, so we have to check
the flags anyway.
There is a new atom "cache_flush", because caches must be flushed *after*
resource descriptors are changed in memory.
Functional changes:
* Write caches are flushed at the end of CS and read caches are flushed
at its beginning.
* Sampler view states are removed from si_state, they only held the flush
flags.
* Everytime a shader is changed, the I cache is flushed. Is this needed?
Due to a hw bug, this also flushes the K cache.
* The WRITE_DATA packet is changed to use TC, which fixes a rendering issue
in openarena. I'm not sure how TC interacts with CP DMA, but for now it
seems to work better than any other solution I tried. (BTW CIK allows us
to use TC for CP DMA.)
* Flush the K cache instead of the texture cache when updating resource
descriptors (due to a hw bug, this also flushes the I cache).
I think the K cache flush is correct here, but I'm not sure if the texture
cache should be flushed too (probably not considering we use TC
for WRITE_DATA, but we don't use TC for CP DMA).
* The number of resource contexts is decreased to 16. With all of these cache
changes, 4 doesn't work, but 8 works, which suggests I'm actually doing
the right thing here and the pipeline isn't drained during flushes.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-26 17:19:39 +02:00
|
|
|
|
2016-04-17 16:18:54 +02:00
|
|
|
/* Wait for shader engines to go idle.
|
|
|
|
|
* VS and PS waits are unnecessary if SURFACE_SYNC is going to wait
|
|
|
|
|
* for everything including CB/DB cache flushes.
|
2014-12-30 18:41:25 +01:00
|
|
|
*/
|
2016-10-15 16:21:20 +02:00
|
|
|
if (!flush_cb_db) {
|
2016-08-25 14:08:24 +02:00
|
|
|
if (rctx->flags & SI_CONTEXT_PS_PARTIAL_FLUSH) {
|
2016-04-02 11:37:06 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
2016-04-17 16:18:54 +02:00
|
|
|
radeon_emit(cs, EVENT_TYPE(V_028A90_PS_PARTIAL_FLUSH) | EVENT_INDEX(4));
|
2016-08-23 15:17:35 +02:00
|
|
|
/* Only count explicit shader flushes, not implicit ones
|
|
|
|
|
* done by SURFACE_SYNC.
|
|
|
|
|
*/
|
2016-08-25 14:08:24 +02:00
|
|
|
rctx->num_vs_flushes++;
|
|
|
|
|
rctx->num_ps_flushes++;
|
|
|
|
|
} else if (rctx->flags & SI_CONTEXT_VS_PARTIAL_FLUSH) {
|
2016-04-02 11:37:06 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
2016-04-17 16:18:54 +02:00
|
|
|
radeon_emit(cs, EVENT_TYPE(V_028A90_VS_PARTIAL_FLUSH) | EVENT_INDEX(4));
|
2016-08-25 14:08:24 +02:00
|
|
|
rctx->num_vs_flushes++;
|
2016-04-17 16:18:54 +02:00
|
|
|
}
|
2013-09-02 12:57:46 +02:00
|
|
|
}
|
2016-08-23 15:17:35 +02:00
|
|
|
|
2016-08-25 14:08:24 +02:00
|
|
|
if (rctx->flags & SI_CONTEXT_CS_PARTIAL_FLUSH &&
|
|
|
|
|
sctx->compute_is_busy) {
|
2016-04-02 11:37:06 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
2014-09-20 11:54:46 +02:00
|
|
|
radeon_emit(cs, EVENT_TYPE(V_028A90_CS_PARTIAL_FLUSH | EVENT_INDEX(4)));
|
2016-08-25 14:08:24 +02:00
|
|
|
rctx->num_cs_flushes++;
|
|
|
|
|
sctx->compute_is_busy = false;
|
2014-09-20 11:54:46 +02:00
|
|
|
}
|
2016-04-17 16:18:54 +02:00
|
|
|
|
|
|
|
|
/* VGT state synchronization. */
|
2016-08-25 14:08:24 +02:00
|
|
|
if (rctx->flags & SI_CONTEXT_VGT_FLUSH) {
|
2016-04-02 11:37:06 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
2013-11-21 16:45:28 +09:00
|
|
|
radeon_emit(cs, EVENT_TYPE(V_028A90_VGT_FLUSH) | EVENT_INDEX(0));
|
|
|
|
|
}
|
2016-08-25 14:08:24 +02:00
|
|
|
if (rctx->flags & SI_CONTEXT_VGT_STREAMOUT_SYNC) {
|
2016-04-02 11:37:06 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
2014-07-26 03:16:22 +02:00
|
|
|
radeon_emit(cs, EVENT_TYPE(V_028A90_VGT_STREAMOUT_SYNC) | EVENT_INDEX(0));
|
|
|
|
|
}
|
2013-11-21 16:45:28 +09:00
|
|
|
|
2016-10-15 16:21:20 +02:00
|
|
|
/* GFX9: Wait for idle if we're flushing CB or DB. ACQUIRE_MEM doesn't
|
|
|
|
|
* wait for idle on GFX9. We have to use a TS event.
|
|
|
|
|
*/
|
|
|
|
|
if (sctx->b.chip_class >= GFX9 && flush_cb_db) {
|
|
|
|
|
struct r600_resource *rbuf = NULL;
|
|
|
|
|
uint64_t va;
|
|
|
|
|
unsigned offset = 0, tc_flags, cb_db_event;
|
|
|
|
|
|
|
|
|
|
/* Set the CB/DB flush event. */
|
|
|
|
|
switch (flush_cb_db) {
|
|
|
|
|
case SI_CONTEXT_FLUSH_AND_INV_CB:
|
|
|
|
|
cb_db_event = V_028A90_FLUSH_AND_INV_CB_DATA_TS;
|
|
|
|
|
break;
|
|
|
|
|
case SI_CONTEXT_FLUSH_AND_INV_DB:
|
|
|
|
|
cb_db_event = V_028A90_FLUSH_AND_INV_DB_DATA_TS;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
/* both CB & DB */
|
|
|
|
|
cb_db_event = V_028A90_CACHE_FLUSH_AND_INV_TS_EVENT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* TC | TC_WB = invalidate L2 data
|
|
|
|
|
* TC_MD | TC_WB = invalidate L2 metadata
|
|
|
|
|
* TC | TC_WB | TC_MD = invalidate L2 data & metadata
|
|
|
|
|
*
|
|
|
|
|
* The metadata cache must always be invalidated for coherency
|
|
|
|
|
* between CB/DB and shaders. (metadata = HTILE, CMASK, DCC)
|
|
|
|
|
*
|
|
|
|
|
* TC must be invalidated on GFX9 only if the CB/DB surface is
|
|
|
|
|
* not pipe-aligned. If the surface is RB-aligned, it might not
|
|
|
|
|
* strictly be pipe-aligned since RB alignment takes precendence.
|
|
|
|
|
*/
|
|
|
|
|
tc_flags = EVENT_TC_WB_ACTION_ENA |
|
|
|
|
|
EVENT_TC_MD_ACTION_ENA;
|
|
|
|
|
|
|
|
|
|
/* Ideally flush TC together with CB/DB. */
|
|
|
|
|
if (rctx->flags & SI_CONTEXT_INV_GLOBAL_L2) {
|
|
|
|
|
tc_flags |= EVENT_TC_ACTION_ENA |
|
|
|
|
|
EVENT_TCL1_ACTION_ENA;
|
|
|
|
|
|
|
|
|
|
/* Clear the flags. */
|
|
|
|
|
rctx->flags &= ~(SI_CONTEXT_INV_GLOBAL_L2 |
|
|
|
|
|
SI_CONTEXT_WRITEBACK_GLOBAL_L2 |
|
|
|
|
|
SI_CONTEXT_INV_VMEM_L1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Allocate memory for the fence. */
|
|
|
|
|
u_suballocator_alloc(rctx->allocator_zeroed_memory, 4, 4,
|
|
|
|
|
&offset, (struct pipe_resource**)&rbuf);
|
|
|
|
|
va = rbuf->gpu_address + offset;
|
|
|
|
|
|
|
|
|
|
r600_gfx_write_event_eop(rctx, cb_db_event, tc_flags, 1,
|
|
|
|
|
rbuf, va, 0, 1);
|
|
|
|
|
r600_gfx_wait_fence(rctx, va, 1, 0xffffffff);
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-17 17:28:25 +02:00
|
|
|
/* Make sure ME is idle (it executes most packets) before continuing.
|
|
|
|
|
* This prevents read-after-write hazards between PFP and ME.
|
|
|
|
|
*/
|
2016-10-10 18:49:22 +02:00
|
|
|
if (cp_coher_cntl ||
|
|
|
|
|
(rctx->flags & (SI_CONTEXT_CS_PARTIAL_FLUSH |
|
|
|
|
|
SI_CONTEXT_INV_VMEM_L1 |
|
|
|
|
|
SI_CONTEXT_INV_GLOBAL_L2 |
|
|
|
|
|
SI_CONTEXT_WRITEBACK_GLOBAL_L2))) {
|
2016-04-17 17:28:25 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_PFP_SYNC_ME, 0, 0));
|
|
|
|
|
radeon_emit(cs, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-15 16:21:20 +02:00
|
|
|
/* SI-CI-VI only:
|
|
|
|
|
* When one of the CP_COHER_CNTL.DEST_BASE flags is set, SURFACE_SYNC
|
|
|
|
|
* waits for idle, so it should be last. SURFACE_SYNC is done in PFP.
|
2016-10-10 18:49:22 +02:00
|
|
|
*
|
|
|
|
|
* cp_coher_cntl should contain all necessary flags except TC flags
|
|
|
|
|
* at this point.
|
|
|
|
|
*
|
|
|
|
|
* SI-CIK don't support L2 write-back.
|
2014-12-30 18:41:25 +01:00
|
|
|
*/
|
2016-10-10 18:49:22 +02:00
|
|
|
if (rctx->flags & SI_CONTEXT_INV_GLOBAL_L2 ||
|
|
|
|
|
(rctx->chip_class <= CIK &&
|
|
|
|
|
(rctx->flags & SI_CONTEXT_WRITEBACK_GLOBAL_L2))) {
|
2017-01-20 01:13:39 +01:00
|
|
|
/* Invalidate L1 & L2. (L1 is always invalidated on SI)
|
2016-10-10 18:49:22 +02:00
|
|
|
* WB must be set on VI+ when TC_ACTION is set.
|
|
|
|
|
*/
|
|
|
|
|
si_emit_surface_sync(rctx, cp_coher_cntl |
|
|
|
|
|
S_0085F0_TC_ACTION_ENA(1) |
|
2017-01-20 01:13:39 +01:00
|
|
|
S_0085F0_TCL1_ACTION_ENA(1) |
|
2016-10-10 18:49:22 +02:00
|
|
|
S_0301F0_TC_WB_ACTION_ENA(rctx->chip_class >= VI));
|
|
|
|
|
cp_coher_cntl = 0;
|
2016-12-25 19:48:55 +01:00
|
|
|
sctx->b.num_L2_invalidates++;
|
2016-10-10 18:49:22 +02:00
|
|
|
} else {
|
|
|
|
|
/* L1 invalidation and L2 writeback must be done separately,
|
|
|
|
|
* because both operations can't be done together.
|
|
|
|
|
*/
|
|
|
|
|
if (rctx->flags & SI_CONTEXT_WRITEBACK_GLOBAL_L2) {
|
|
|
|
|
/* WB = write-back
|
|
|
|
|
* NC = apply to non-coherent MTYPEs
|
|
|
|
|
* (i.e. MTYPE <= 1, which is what we use everywhere)
|
|
|
|
|
*
|
|
|
|
|
* WB doesn't work without NC.
|
|
|
|
|
*/
|
|
|
|
|
si_emit_surface_sync(rctx, cp_coher_cntl |
|
|
|
|
|
S_0301F0_TC_WB_ACTION_ENA(1) |
|
|
|
|
|
S_0301F0_TC_NC_ACTION_ENA(1));
|
|
|
|
|
cp_coher_cntl = 0;
|
2016-12-25 19:48:55 +01:00
|
|
|
sctx->b.num_L2_writebacks++;
|
2016-10-10 18:49:22 +02:00
|
|
|
}
|
|
|
|
|
if (rctx->flags & SI_CONTEXT_INV_VMEM_L1) {
|
|
|
|
|
/* Invalidate per-CU VMEM L1. */
|
|
|
|
|
si_emit_surface_sync(rctx, cp_coher_cntl |
|
|
|
|
|
S_0085F0_TCL1_ACTION_ENA(1));
|
|
|
|
|
cp_coher_cntl = 0;
|
|
|
|
|
}
|
2014-12-30 18:41:25 +01:00
|
|
|
}
|
|
|
|
|
|
2016-10-10 18:49:22 +02:00
|
|
|
/* If TC flushes haven't cleared this... */
|
|
|
|
|
if (cp_coher_cntl)
|
|
|
|
|
si_emit_surface_sync(rctx, cp_coher_cntl);
|
|
|
|
|
|
2016-08-25 14:08:24 +02:00
|
|
|
if (rctx->flags & R600_CONTEXT_START_PIPELINE_STATS) {
|
2016-04-07 02:59:09 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
|
|
|
|
radeon_emit(cs, EVENT_TYPE(V_028A90_PIPELINESTAT_START) |
|
|
|
|
|
EVENT_INDEX(0));
|
2016-08-25 14:08:24 +02:00
|
|
|
} else if (rctx->flags & R600_CONTEXT_STOP_PIPELINE_STATS) {
|
2016-04-07 02:59:09 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
|
|
|
|
radeon_emit(cs, EVENT_TYPE(V_028A90_PIPELINESTAT_STOP) |
|
|
|
|
|
EVENT_INDEX(0));
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-25 14:08:24 +02:00
|
|
|
rctx->flags = 0;
|
radeonsi: simplify and improve flushing
This mimics r600g. The R600_CONTEXT_xxx flags are added to rctx->b.flags
and si_emit_cache_flush emits the packets. That's it. The shared radeon code
tells us when the streamout cache should be flushed, so we have to check
the flags anyway.
There is a new atom "cache_flush", because caches must be flushed *after*
resource descriptors are changed in memory.
Functional changes:
* Write caches are flushed at the end of CS and read caches are flushed
at its beginning.
* Sampler view states are removed from si_state, they only held the flush
flags.
* Everytime a shader is changed, the I cache is flushed. Is this needed?
Due to a hw bug, this also flushes the K cache.
* The WRITE_DATA packet is changed to use TC, which fixes a rendering issue
in openarena. I'm not sure how TC interacts with CP DMA, but for now it
seems to work better than any other solution I tried. (BTW CIK allows us
to use TC for CP DMA.)
* Flush the K cache instead of the texture cache when updating resource
descriptors (due to a hw bug, this also flushes the I cache).
I think the K cache flush is correct here, but I'm not sure if the texture
cache should be flushed too (probably not considering we use TC
for WRITE_DATA, but we don't use TC for CP DMA).
* The number of resource contexts is decreased to 16. With all of these cache
changes, 4 doesn't work, but 8 works, which suggests I'm actually doing
the right thing here and the pipeline isn't drained during flushes.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-26 17:19:39 +02:00
|
|
|
}
|
|
|
|
|
|
2014-04-24 03:03:43 +02:00
|
|
|
static void si_get_draw_start_count(struct si_context *sctx,
|
|
|
|
|
const struct pipe_draw_info *info,
|
|
|
|
|
unsigned *start, unsigned *count)
|
|
|
|
|
{
|
|
|
|
|
if (info->indirect) {
|
2017-02-20 10:46:13 +01:00
|
|
|
unsigned indirect_count;
|
|
|
|
|
struct pipe_transfer *transfer;
|
|
|
|
|
unsigned begin, end;
|
|
|
|
|
unsigned map_size;
|
|
|
|
|
unsigned *data;
|
|
|
|
|
|
|
|
|
|
if (info->indirect_params) {
|
|
|
|
|
data = pipe_buffer_map_range(&sctx->b.b,
|
|
|
|
|
info->indirect_params,
|
|
|
|
|
info->indirect_params_offset,
|
|
|
|
|
sizeof(unsigned),
|
|
|
|
|
PIPE_TRANSFER_READ, &transfer);
|
|
|
|
|
|
|
|
|
|
indirect_count = *data;
|
|
|
|
|
|
|
|
|
|
pipe_buffer_unmap(&sctx->b.b, transfer);
|
|
|
|
|
} else {
|
|
|
|
|
indirect_count = info->indirect_count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!indirect_count) {
|
|
|
|
|
*start = *count = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
map_size = (indirect_count - 1) * info->indirect_stride + 3 * sizeof(unsigned);
|
|
|
|
|
data = pipe_buffer_map_range(&sctx->b.b, info->indirect,
|
|
|
|
|
info->indirect_offset, map_size,
|
|
|
|
|
PIPE_TRANSFER_READ, &transfer);
|
|
|
|
|
|
|
|
|
|
begin = UINT_MAX;
|
|
|
|
|
end = 0;
|
|
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < indirect_count; ++i) {
|
|
|
|
|
unsigned count = data[0];
|
|
|
|
|
unsigned start = data[2];
|
|
|
|
|
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
begin = MIN2(begin, start);
|
|
|
|
|
end = MAX2(end, start + count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data += info->indirect_stride / sizeof(unsigned);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pipe_buffer_unmap(&sctx->b.b, transfer);
|
|
|
|
|
|
|
|
|
|
if (begin < end) {
|
|
|
|
|
*start = begin;
|
|
|
|
|
*count = end - begin;
|
|
|
|
|
} else {
|
|
|
|
|
*start = *count = 0;
|
|
|
|
|
}
|
2014-04-24 03:03:43 +02:00
|
|
|
} else {
|
|
|
|
|
*start = info->start;
|
|
|
|
|
*count = info->count;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-19 13:52:32 +02:00
|
|
|
void si_ce_pre_draw_synchronization(struct si_context *sctx)
|
2016-03-10 21:01:39 +01:00
|
|
|
{
|
|
|
|
|
if (sctx->ce_need_synchronization) {
|
|
|
|
|
radeon_emit(sctx->ce_ib, PKT3(PKT3_INCREMENT_CE_COUNTER, 0, 0));
|
|
|
|
|
radeon_emit(sctx->ce_ib, 1);
|
|
|
|
|
|
|
|
|
|
radeon_emit(sctx->b.gfx.cs, PKT3(PKT3_WAIT_ON_CE_COUNTER, 0, 0));
|
|
|
|
|
radeon_emit(sctx->b.gfx.cs, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-19 13:52:32 +02:00
|
|
|
void si_ce_post_draw_synchronization(struct si_context *sctx)
|
2016-03-10 21:01:39 +01:00
|
|
|
{
|
|
|
|
|
if (sctx->ce_need_synchronization) {
|
|
|
|
|
radeon_emit(sctx->b.gfx.cs, PKT3(PKT3_INCREMENT_DE_COUNTER, 0, 0));
|
|
|
|
|
radeon_emit(sctx->b.gfx.cs, 0);
|
|
|
|
|
|
|
|
|
|
sctx->ce_need_synchronization = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-03 10:26:01 +02:00
|
|
|
void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
|
2012-07-19 15:20:45 +02:00
|
|
|
{
|
2014-01-11 16:00:50 +01:00
|
|
|
struct si_context *sctx = (struct si_context *)ctx;
|
2015-10-22 22:18:49 +02:00
|
|
|
struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
|
2017-03-28 22:19:29 +02:00
|
|
|
const struct pipe_index_buffer *ib = &sctx->index_buffer;
|
|
|
|
|
struct pipe_index_buffer ib_tmp; /* for index buffer uploads only */
|
2017-04-02 20:33:04 +03:00
|
|
|
unsigned mask, dirty_tex_counter;
|
|
|
|
|
enum pipe_prim_type rast_prim;
|
2017-04-12 09:40:28 +02:00
|
|
|
unsigned num_patches = 0;
|
2012-07-19 15:20:45 +02:00
|
|
|
|
2016-09-06 00:09:17 +02:00
|
|
|
if (likely(!info->indirect)) {
|
|
|
|
|
/* SI-CI treat instance_count==0 as instance_count==1. There is
|
|
|
|
|
* no workaround for indirect draws, but we can at least skip
|
|
|
|
|
* direct draws.
|
|
|
|
|
*/
|
|
|
|
|
if (unlikely(!info->instance_count))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Handle count == 0. */
|
|
|
|
|
if (unlikely(!info->count &&
|
|
|
|
|
(info->indexed || !info->count_from_stream_output)))
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-07-19 15:20:45 +02:00
|
|
|
|
2016-09-06 00:10:38 +02:00
|
|
|
if (unlikely(!sctx->vs_shader.cso)) {
|
2015-10-22 22:18:49 +02:00
|
|
|
assert(0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-09-06 00:10:38 +02:00
|
|
|
if (unlikely(!sctx->ps_shader.cso && (!rs || !rs->rasterizer_discard))) {
|
2015-02-22 18:10:38 +01:00
|
|
|
assert(0);
|
2012-07-19 15:20:45 +02:00
|
|
|
return;
|
2015-02-22 18:10:38 +01:00
|
|
|
}
|
2016-09-06 00:10:38 +02:00
|
|
|
if (unlikely(!!sctx->tes_shader.cso != (info->mode == PIPE_PRIM_PATCHES))) {
|
2015-02-22 18:10:38 +01:00
|
|
|
assert(0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-07-19 15:20:45 +02:00
|
|
|
|
2017-01-24 23:37:56 +01:00
|
|
|
/* Recompute and re-emit the texture resource states if needed. */
|
|
|
|
|
dirty_tex_counter = p_atomic_read(&sctx->b.screen->dirty_tex_counter);
|
|
|
|
|
if (unlikely(dirty_tex_counter != sctx->b.last_dirty_tex_counter)) {
|
|
|
|
|
sctx->b.last_dirty_tex_counter = dirty_tex_counter;
|
2016-02-24 22:04:47 +01:00
|
|
|
sctx->framebuffer.dirty_cbufs |=
|
|
|
|
|
((1 << sctx->framebuffer.state.nr_cbufs) - 1);
|
|
|
|
|
sctx->framebuffer.dirty_zsbuf = true;
|
2017-01-24 03:25:40 +01:00
|
|
|
sctx->framebuffer.do_update_surf_dirtiness = true;
|
2016-02-24 22:04:47 +01:00
|
|
|
si_mark_atom_dirty(sctx, &sctx->framebuffer.atom);
|
2016-05-17 21:45:50 +02:00
|
|
|
si_update_all_texture_descriptors(sctx);
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-19 18:41:20 +01:00
|
|
|
si_decompress_graphics_textures(sctx);
|
2015-02-22 19:14:42 +01:00
|
|
|
|
|
|
|
|
/* Set the rasterization primitive type.
|
|
|
|
|
*
|
|
|
|
|
* This must be done after si_decompress_textures, which can call
|
|
|
|
|
* draw_vbo recursively, and before si_update_shaders, which uses
|
|
|
|
|
* current_rast_prim for this draw_vbo call. */
|
2015-10-07 01:48:18 +02:00
|
|
|
if (sctx->gs_shader.cso)
|
2016-08-02 11:51:21 +02:00
|
|
|
rast_prim = sctx->gs_shader.cso->gs_output_prim;
|
2015-10-07 01:48:18 +02:00
|
|
|
else if (sctx->tes_shader.cso)
|
2016-08-02 11:51:21 +02:00
|
|
|
rast_prim = sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_PRIM_MODE];
|
2015-01-31 20:09:46 +01:00
|
|
|
else
|
2016-08-02 11:51:21 +02:00
|
|
|
rast_prim = info->mode;
|
2015-01-31 20:09:46 +01:00
|
|
|
|
2016-08-02 11:51:21 +02:00
|
|
|
if (rast_prim != sctx->current_rast_prim) {
|
|
|
|
|
sctx->current_rast_prim = rast_prim;
|
|
|
|
|
sctx->do_update_shaders = true;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-31 12:50:09 +01:00
|
|
|
if (sctx->gs_shader.cso) {
|
|
|
|
|
/* Determine whether the GS triangle strip adjacency fix should
|
|
|
|
|
* be applied. Rotate every other triangle if
|
|
|
|
|
* - triangle strips with adjacency are fed to the GS and
|
|
|
|
|
* - primitive restart is disabled (the rotation doesn't help
|
|
|
|
|
* when the restart occurs after an odd number of triangles).
|
|
|
|
|
*/
|
|
|
|
|
bool gs_tri_strip_adj_fix =
|
|
|
|
|
!sctx->tes_shader.cso &&
|
|
|
|
|
info->mode == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY &&
|
|
|
|
|
!info->primitive_restart;
|
|
|
|
|
|
|
|
|
|
if (gs_tri_strip_adj_fix != sctx->gs_tri_strip_adj_fix) {
|
|
|
|
|
sctx->gs_tri_strip_adj_fix = gs_tri_strip_adj_fix;
|
|
|
|
|
sctx->do_update_shaders = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-02 11:51:21 +02:00
|
|
|
if (sctx->do_update_shaders && !si_update_shaders(sctx))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!si_upload_graphics_shader_descriptors(sctx))
|
2015-07-25 00:53:16 +02:00
|
|
|
return;
|
2012-07-19 15:20:45 +02:00
|
|
|
|
2017-03-28 22:19:29 +02:00
|
|
|
ib_tmp.buffer = NULL;
|
2012-07-19 15:20:45 +02:00
|
|
|
|
2017-03-28 22:19:29 +02:00
|
|
|
if (info->indexed) {
|
2012-07-19 15:20:45 +02:00
|
|
|
/* Translate or upload, if needed. */
|
2015-04-16 20:44:54 +02:00
|
|
|
/* 8-bit indices are supported on VI. */
|
2017-03-28 22:19:29 +02:00
|
|
|
if (sctx->b.chip_class <= CIK && ib->index_size == 1) {
|
|
|
|
|
unsigned start, count, start_offset, size;
|
2014-01-22 03:05:21 +01:00
|
|
|
void *ptr;
|
|
|
|
|
|
2014-04-24 03:03:43 +02:00
|
|
|
si_get_draw_start_count(sctx, info, &start, &count);
|
2017-02-15 17:24:38 +01:00
|
|
|
start_offset = start * 2;
|
2017-02-15 18:32:34 +01:00
|
|
|
size = count * 2;
|
2014-04-24 16:13:54 +02:00
|
|
|
|
2017-01-27 01:42:41 +01:00
|
|
|
u_upload_alloc(ctx->stream_uploader, start_offset,
|
2017-02-15 18:32:34 +01:00
|
|
|
size,
|
|
|
|
|
si_optimal_tcc_alignment(sctx, size),
|
2017-03-28 22:19:29 +02:00
|
|
|
&ib_tmp.offset, &ib_tmp.buffer, &ptr);
|
|
|
|
|
if (!ib_tmp.buffer)
|
2015-09-10 17:42:31 +02:00
|
|
|
return;
|
2014-01-22 03:05:21 +01:00
|
|
|
|
2017-03-28 22:19:29 +02:00
|
|
|
util_shorten_ubyte_elts_to_userptr(&sctx->b.b, ib, 0, 0,
|
|
|
|
|
ib->offset + start,
|
2014-04-24 16:13:54 +02:00
|
|
|
count, ptr);
|
2014-01-22 03:05:21 +01:00
|
|
|
|
2014-04-24 16:13:54 +02:00
|
|
|
/* info->start will be added by the drawing code */
|
2017-03-28 22:19:29 +02:00
|
|
|
ib_tmp.offset -= start_offset;
|
|
|
|
|
ib_tmp.index_size = 2;
|
|
|
|
|
ib = &ib_tmp;
|
|
|
|
|
} else if (ib->user_buffer && !ib->buffer) {
|
2017-04-02 16:22:54 +02:00
|
|
|
unsigned start_offset;
|
2014-04-24 16:13:54 +02:00
|
|
|
|
2017-04-02 16:22:54 +02:00
|
|
|
assert(!info->indirect);
|
|
|
|
|
start_offset = info->start * ib->index_size;
|
2014-04-24 16:13:54 +02:00
|
|
|
|
2017-01-27 01:42:41 +01:00
|
|
|
u_upload_data(ctx->stream_uploader, start_offset,
|
2017-04-02 16:22:54 +02:00
|
|
|
info->count * ib->index_size,
|
2017-02-15 18:32:34 +01:00
|
|
|
sctx->screen->b.info.tcc_cache_line_size,
|
2017-03-28 22:19:29 +02:00
|
|
|
(char*)ib->user_buffer + start_offset,
|
|
|
|
|
&ib_tmp.offset, &ib_tmp.buffer);
|
|
|
|
|
if (!ib_tmp.buffer)
|
2015-09-10 17:42:31 +02:00
|
|
|
return;
|
2017-03-28 22:19:29 +02:00
|
|
|
|
2014-04-24 16:13:54 +02:00
|
|
|
/* info->start will be added by the drawing code */
|
2017-03-28 22:19:29 +02:00
|
|
|
ib_tmp.offset -= start_offset;
|
|
|
|
|
ib_tmp.index_size = ib->index_size;
|
|
|
|
|
ib = &ib_tmp;
|
2017-02-15 18:36:21 +01:00
|
|
|
} else if (sctx->b.chip_class <= CIK &&
|
2017-03-28 22:19:29 +02:00
|
|
|
r600_resource(ib->buffer)->TC_L2_dirty) {
|
2017-02-15 18:36:21 +01:00
|
|
|
/* VI reads index buffers through TC L2, so it doesn't
|
|
|
|
|
* need this. */
|
|
|
|
|
sctx->b.flags |= SI_CONTEXT_WRITEBACK_GLOBAL_L2;
|
2017-03-28 22:19:29 +02:00
|
|
|
r600_resource(ib->buffer)->TC_L2_dirty = false;
|
2012-07-19 15:20:45 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-26 03:02:23 +01:00
|
|
|
if (info->indirect) {
|
|
|
|
|
/* Add the buffer size for memory checking in need_cs_space. */
|
|
|
|
|
r600_context_add_resource_size(ctx, info->indirect);
|
2016-08-08 17:06:22 +02:00
|
|
|
|
2017-01-26 03:02:23 +01:00
|
|
|
if (r600_resource(info->indirect)->TC_L2_dirty) {
|
|
|
|
|
sctx->b.flags |= SI_CONTEXT_WRITEBACK_GLOBAL_L2;
|
|
|
|
|
r600_resource(info->indirect)->TC_L2_dirty = false;
|
|
|
|
|
}
|
2016-08-08 16:00:29 +02:00
|
|
|
|
2017-01-26 03:02:23 +01:00
|
|
|
if (info->indirect_params &&
|
|
|
|
|
r600_resource(info->indirect_params)->TC_L2_dirty) {
|
|
|
|
|
sctx->b.flags |= SI_CONTEXT_WRITEBACK_GLOBAL_L2;
|
|
|
|
|
r600_resource(info->indirect_params)->TC_L2_dirty = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-07-29 16:33:50 +02:00
|
|
|
|
2015-08-30 03:56:13 +02:00
|
|
|
si_need_cs_space(sctx);
|
2012-07-19 15:20:45 +02:00
|
|
|
|
2016-07-29 17:28:43 +02:00
|
|
|
/* Since we've called r600_context_add_resource_size for vertex buffers,
|
|
|
|
|
* this must be called after si_need_cs_space, because we must let
|
|
|
|
|
* need_cs_space flush before we add buffers to the buffer list.
|
|
|
|
|
*/
|
|
|
|
|
if (!si_upload_vertex_buffer_descriptors(sctx))
|
|
|
|
|
return;
|
|
|
|
|
|
2017-01-09 16:32:12 +01:00
|
|
|
/* GFX9 scissor bug workaround. There is also a more efficient but
|
|
|
|
|
* more involved alternative workaround. */
|
|
|
|
|
if (sctx->b.chip_class == GFX9 &&
|
|
|
|
|
si_is_atom_dirty(sctx, &sctx->b.scissors.atom))
|
|
|
|
|
sctx->b.flags |= SI_CONTEXT_PS_PARTIAL_FLUSH;
|
|
|
|
|
|
2017-01-24 23:28:32 +01:00
|
|
|
/* Flush caches before the first state atom, which does L2 prefetches. */
|
2016-09-08 00:59:55 +02:00
|
|
|
if (sctx->b.flags)
|
|
|
|
|
si_emit_cache_flush(sctx);
|
|
|
|
|
|
2017-01-25 00:09:24 +01:00
|
|
|
/* Emit state atoms. */
|
2015-08-29 00:49:40 +02:00
|
|
|
mask = sctx->dirty_atoms;
|
|
|
|
|
while (mask) {
|
|
|
|
|
struct r600_atom *atom = sctx->atoms.array[u_bit_scan(&mask)];
|
|
|
|
|
|
|
|
|
|
atom->emit(&sctx->b, atom);
|
2013-08-06 06:42:22 +02:00
|
|
|
}
|
2015-08-29 00:49:40 +02:00
|
|
|
sctx->dirty_atoms = 0;
|
2013-08-06 06:42:22 +02:00
|
|
|
|
2017-01-25 00:09:24 +01:00
|
|
|
/* Emit states. */
|
|
|
|
|
mask = sctx->dirty_states;
|
|
|
|
|
while (mask) {
|
|
|
|
|
unsigned i = u_bit_scan(&mask);
|
|
|
|
|
struct si_pm4_state *state = sctx->queued.array[i];
|
|
|
|
|
|
|
|
|
|
if (!state || sctx->emitted.array[i] == state)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
si_pm4_emit(sctx, state);
|
|
|
|
|
sctx->emitted.array[i] = state;
|
|
|
|
|
}
|
|
|
|
|
sctx->dirty_states = 0;
|
|
|
|
|
|
2015-02-22 17:42:20 +01:00
|
|
|
si_emit_rasterizer_prim_state(sctx);
|
2017-04-12 09:40:28 +02:00
|
|
|
if (sctx->tes_shader.cso)
|
|
|
|
|
si_emit_derived_tess_state(sctx, info, &num_patches);
|
2017-04-12 11:01:19 +02:00
|
|
|
si_emit_vs_state(sctx, info);
|
2017-04-12 09:40:28 +02:00
|
|
|
si_emit_draw_registers(sctx, info, num_patches);
|
2016-03-10 21:01:39 +01:00
|
|
|
|
|
|
|
|
si_ce_pre_draw_synchronization(sctx);
|
2017-03-28 22:19:29 +02:00
|
|
|
si_emit_draw_packets(sctx, info, ib);
|
2016-03-10 21:01:39 +01:00
|
|
|
si_ce_post_draw_synchronization(sctx);
|
|
|
|
|
|
2015-08-19 11:53:25 +02:00
|
|
|
if (sctx->trace_buf)
|
2014-01-11 16:00:50 +01:00
|
|
|
si_trace_emit(sctx);
|
2013-03-25 11:46:38 -04:00
|
|
|
|
2014-07-26 03:16:22 +02:00
|
|
|
/* Workaround for a VGT hang when streamout is enabled.
|
|
|
|
|
* It must be done after drawing. */
|
2015-12-04 21:24:21 +01:00
|
|
|
if ((sctx->b.family == CHIP_HAWAII ||
|
|
|
|
|
sctx->b.family == CHIP_TONGA ||
|
|
|
|
|
sctx->b.family == CHIP_FIJI) &&
|
2016-04-07 03:24:06 +02:00
|
|
|
r600_get_strmout_en(&sctx->b)) {
|
2014-12-29 14:02:46 +01:00
|
|
|
sctx->b.flags |= SI_CONTEXT_VGT_STREAMOUT_SYNC;
|
2014-07-26 03:16:22 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-24 03:25:40 +01:00
|
|
|
if (sctx->framebuffer.do_update_surf_dirtiness) {
|
|
|
|
|
/* Set the depth buffer as dirty. */
|
|
|
|
|
if (sctx->framebuffer.state.zsbuf) {
|
|
|
|
|
struct pipe_surface *surf = sctx->framebuffer.state.zsbuf;
|
|
|
|
|
struct r600_texture *rtex = (struct r600_texture *)surf->texture;
|
2013-01-17 19:36:41 +01:00
|
|
|
|
2017-01-24 03:25:40 +01:00
|
|
|
if (!rtex->tc_compatible_htile)
|
2016-06-21 18:18:46 +02:00
|
|
|
rtex->dirty_level_mask |= 1 << surf->u.tex.level;
|
2017-01-24 03:25:40 +01:00
|
|
|
|
|
|
|
|
if (rtex->surface.flags & RADEON_SURF_SBUFFER)
|
|
|
|
|
rtex->stencil_dirty_level_mask |= 1 << surf->u.tex.level;
|
|
|
|
|
}
|
|
|
|
|
if (sctx->framebuffer.compressed_cb_mask) {
|
|
|
|
|
struct pipe_surface *surf;
|
|
|
|
|
struct r600_texture *rtex;
|
|
|
|
|
unsigned mask = sctx->framebuffer.compressed_cb_mask;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
unsigned i = u_bit_scan(&mask);
|
|
|
|
|
surf = sctx->framebuffer.state.cbufs[i];
|
|
|
|
|
rtex = (struct r600_texture*)surf->texture;
|
|
|
|
|
|
|
|
|
|
if (rtex->fmask.size)
|
|
|
|
|
rtex->dirty_level_mask |= 1 << surf->u.tex.level;
|
|
|
|
|
if (rtex->dcc_gather_statistics)
|
|
|
|
|
rtex->separate_dcc_dirty = true;
|
|
|
|
|
} while (mask);
|
|
|
|
|
}
|
|
|
|
|
sctx->framebuffer.do_update_surf_dirtiness = false;
|
2013-08-06 08:48:07 +02:00
|
|
|
}
|
2012-07-19 15:20:45 +02:00
|
|
|
|
2017-03-28 22:19:29 +02:00
|
|
|
pipe_resource_reference(&ib_tmp.buffer, NULL);
|
2014-01-22 01:29:18 +01:00
|
|
|
sctx->b.num_draw_calls++;
|
2016-06-09 23:16:43 +02:00
|
|
|
if (G_0286E8_WAVESIZE(sctx->spi_tmpring_size))
|
|
|
|
|
sctx->b.num_spill_draw_calls++;
|
2012-07-19 15:20:45 +02:00
|
|
|
}
|
2014-09-05 11:59:10 +02:00
|
|
|
|
|
|
|
|
void si_trace_emit(struct si_context *sctx)
|
|
|
|
|
{
|
2015-11-07 14:00:30 +01:00
|
|
|
struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
|
2014-09-05 11:59:10 +02:00
|
|
|
|
2015-08-19 11:53:25 +02:00
|
|
|
sctx->trace_id++;
|
2015-11-07 14:00:30 +01:00
|
|
|
radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx, sctx->trace_buf,
|
2015-09-26 23:18:55 +02:00
|
|
|
RADEON_USAGE_READWRITE, RADEON_PRIO_TRACE);
|
2015-08-19 11:53:25 +02:00
|
|
|
radeon_emit(cs, PKT3(PKT3_WRITE_DATA, 3, 0));
|
2015-08-19 18:45:11 +02:00
|
|
|
radeon_emit(cs, S_370_DST_SEL(V_370_MEMORY_SYNC) |
|
|
|
|
|
S_370_WR_CONFIRM(1) |
|
|
|
|
|
S_370_ENGINE_SEL(V_370_ME));
|
2015-08-19 11:53:25 +02:00
|
|
|
radeon_emit(cs, sctx->trace_buf->gpu_address);
|
|
|
|
|
radeon_emit(cs, sctx->trace_buf->gpu_address >> 32);
|
|
|
|
|
radeon_emit(cs, sctx->trace_id);
|
|
|
|
|
radeon_emit(cs, PKT3(PKT3_NOP, 0, 0));
|
2016-12-24 13:08:00 +01:00
|
|
|
radeon_emit(cs, AC_ENCODE_TRACE_POINT(sctx->trace_id));
|
2014-09-05 11:59:10 +02:00
|
|
|
}
|