diff options
author | Eric Anholt <[email protected]> | 2018-08-02 12:23:02 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-08-06 13:03:23 -0700 |
commit | 1561e4984eb03d6946d19b820b83a96bbbd83b98 (patch) | |
tree | 4064ce6b09dca66609e960ccecd698795ffd3df2 /src/broadcom/compiler/vir.c | |
parent | 5d49076990f6c34fe9134d879e69af5871818b3b (diff) |
v3d: Emit the VCM_CACHE_SIZE packet.
This is needed to ensure that we don't get blocked waiting for VPM space
with bin/render overlapping.
Cc: "18.2" <[email protected]>
Diffstat (limited to 'src/broadcom/compiler/vir.c')
-rw-r--r-- | src/broadcom/compiler/vir.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index fc0b34d4453..1c8223165c6 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -756,10 +756,28 @@ uint64_t *v3d_compile_vs(const struct v3d_compiler *compiler, if (prog_data->uses_iid) prog_data->vpm_input_size++; - /* Input/output segment size are in 8x32-bit multiples. */ + /* Input/output segment size are in sectors (8 rows of 32 bits per + * channel). + */ prog_data->vpm_input_size = align(prog_data->vpm_input_size, 8) / 8; prog_data->vpm_output_size = align(c->num_vpm_writes, 8) / 8; + /* Compute VCM cache size. We set up our program to take up less than + * half of the VPM, so that any set of bin and render programs won't + * run out of space. We need space for at least one input segment, + * and then allocate the rest to output segments (one for the current + * program, the rest to VCM). The valid range of the VCM cache size + * field is 1-4 16-vertex batches, but GFXH-1744 limits us to 2-4 + * batches. + */ + assert(c->devinfo->vpm_size); + int sector_size = 16 * sizeof(uint32_t) * 8; + int vpm_size_in_sectors = c->devinfo->vpm_size / sector_size; + int half_vpm = vpm_size_in_sectors / 2; + int vpm_output_batches = half_vpm - prog_data->vpm_input_size; + assert(vpm_output_batches >= 2); + prog_data->vcm_cache_size = CLAMP(vpm_output_batches - 1, 2, 4); + return v3d_return_qpu_insts(c, final_assembly_size); } |