mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-21 12:00:41 +02:00
zink: split out resource tracking into more incremental functions
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11684>
This commit is contained in:
parent
72354df9c4
commit
b302ab5167
2 changed files with 29 additions and 15 deletions
|
|
@ -569,22 +569,8 @@ zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
|
|||
}
|
||||
|
||||
void
|
||||
zink_batch_reference_resource_rw(struct zink_batch *batch, struct zink_resource *res, bool write)
|
||||
zink_batch_resource_usage_set(struct zink_batch *batch, struct zink_resource *res, bool write)
|
||||
{
|
||||
/* if the resource already has usage of any sort set for this batch, we can skip hashing */
|
||||
if (!zink_batch_usage_matches(res->obj->reads, batch->state) &&
|
||||
!zink_batch_usage_matches(res->obj->writes, batch->state)) {
|
||||
bool found = false;
|
||||
_mesa_set_search_and_add(batch->state->resources, res->obj, &found);
|
||||
if (!found) {
|
||||
pipe_reference(NULL, &res->obj->reference);
|
||||
if (!batch->last_batch_usage || res->obj->reads != batch->last_batch_usage)
|
||||
/* only add resource usage if it's "new" usage, though this only checks the most recent usage
|
||||
* and not all pending usages
|
||||
*/
|
||||
batch->state->resource_size += res->obj->size;
|
||||
}
|
||||
}
|
||||
if (write) {
|
||||
zink_batch_usage_set(&res->obj->writes, batch->state);
|
||||
if (res->scanout_obj)
|
||||
|
|
@ -599,6 +585,17 @@ zink_batch_reference_resource_rw(struct zink_batch *batch, struct zink_resource
|
|||
batch->has_work = true;
|
||||
}
|
||||
|
||||
void
|
||||
zink_batch_reference_resource_rw(struct zink_batch *batch, struct zink_resource *res, bool write)
|
||||
{
|
||||
/* if the resource already has usage of any sort set for this batch, we can skip hashing */
|
||||
if (!zink_batch_usage_matches(res->obj->reads, batch->state) &&
|
||||
!zink_batch_usage_matches(res->obj->writes, batch->state)) {
|
||||
zink_batch_reference_resource(batch, res);
|
||||
}
|
||||
zink_batch_resource_usage_set(batch, res, write);
|
||||
}
|
||||
|
||||
bool
|
||||
batch_ptr_add_usage(struct zink_batch *batch, struct set *s, void *ptr, struct zink_batch_usage **u)
|
||||
{
|
||||
|
|
@ -611,6 +608,18 @@ batch_ptr_add_usage(struct zink_batch *batch, struct set *s, void *ptr, struct z
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
zink_batch_reference_resource(struct zink_batch *batch, struct zink_resource *res)
|
||||
{
|
||||
bool found = false;
|
||||
_mesa_set_search_and_add(batch->state->resources, res->obj, &found);
|
||||
if (!found) {
|
||||
pipe_reference(NULL, &res->obj->reference);
|
||||
batch->state->resource_size += res->obj->size;
|
||||
}
|
||||
batch->has_work = true;
|
||||
}
|
||||
|
||||
void
|
||||
zink_batch_reference_bufferview(struct zink_batch *batch, struct zink_buffer_view *buffer_view)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,10 +146,15 @@ zink_start_batch(struct zink_context *ctx, struct zink_batch *batch);
|
|||
void
|
||||
zink_end_batch(struct zink_context *ctx, struct zink_batch *batch);
|
||||
|
||||
void
|
||||
zink_batch_resource_usage_set(struct zink_batch *batch, struct zink_resource *res, bool write);
|
||||
|
||||
void
|
||||
zink_batch_reference_resource_rw(struct zink_batch *batch,
|
||||
struct zink_resource *res,
|
||||
bool write);
|
||||
void
|
||||
zink_batch_reference_resource(struct zink_batch *batch, struct zink_resource *res);
|
||||
|
||||
void
|
||||
zink_batch_reference_sampler_view(struct zink_batch *batch,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue