anv: decouple util function from anv_cmd_buffer

The issue we're addressing here is that we have 2 batches and the both
grow at different rate. We want to keep doubling the main batch size
as the application writes more and more commands to limit the number
of GEM BOs. But we don't want to have the generation batch size to be
linked to the main batch.

v2: remove gfx7 code

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15642>
This commit is contained in:
Lionel Landwerlin
2022-02-26 14:00:07 +02:00
committed by Marge Bot
parent bd83e5ddaf
commit 61b730f1f4
3 changed files with 126 additions and 25 deletions

View File

@@ -2681,6 +2681,7 @@ struct anv_cmd_buffer {
struct anv_device * device;
struct anv_queue_family * queue_family;
/** Batch where the main commands live */
struct anv_batch batch;
/* Pointer to the location in the batch where MI_BATCH_BUFFER_END was
@@ -2753,6 +2754,28 @@ struct anv_cmd_buffer {
*/
uint32_t total_batch_size;
/** Batch generating part of the anv_cmd_buffer::batch */
struct anv_batch generation_batch;
/**
* Location in anv_cmd_buffer::batch at which we left some space to insert
* a MI_BATCH_BUFFER_START into the generation_batch if needed.
*/
struct anv_address generation_jump_addr;
/**
* Location in anv_cmd_buffer::batch at which the generation batch should
* jump back to.
*/
struct anv_address generation_return_addr;
/** List of anv_batch_bo used for generation
*
* We have to keep this separated of the anv_cmd_buffer::batch_bos that is
* used for a chaining optimization.
*/
struct list_head generation_batch_bos;
/**
* A vector of anv_bo pointers for chunks of memory used by the command
* buffer that are too large to be allocated through dynamic_state_stream.