asahi: don't allocate for ppp updates

let the driver.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29179>
This commit is contained in:
Alyssa Rosenzweig
2024-04-19 22:08:26 -04:00
committed by Marge Bot
parent 3eacd8a8b2
commit d763ab2de0
2 changed files with 31 additions and 25 deletions
+7 -9
View File
@@ -6,7 +6,7 @@
#pragma once
#include "asahi/genxml/agx_pack.h"
#include "pool.h"
#include "agx_bo.h"
/* Opaque structure representing a PPP update */
struct agx_ppp_update {
@@ -96,22 +96,20 @@ agx_ppp_validate(struct agx_ppp_update *ppp, size_t size)
agx_pack(_tmp, T, name)
ALWAYS_INLINE static struct agx_ppp_update
agx_new_ppp_update(struct agx_pool *pool, struct AGX_PPP_HEADER present)
agx_new_ppp_update(struct agx_ptr out, size_t size,
struct AGX_PPP_HEADER *present)
{
size_t size = agx_ppp_update_size(&present);
struct agx_ptr T = agx_pool_alloc_aligned(pool, size, 64);
struct agx_ppp_update ppp = {
.gpu_base = T.gpu,
.head = T.cpu,
.head = out.cpu,
.gpu_base = out.gpu,
.total_size = size,
#ifndef NDEBUG
.cpu_base = T.cpu,
.cpu_base = out.cpu,
#endif
};
agx_ppp_push(&ppp, PPP_HEADER, cfg) {
cfg = present;
cfg = *present;
}
return ppp;
+24 -16
View File
@@ -1047,13 +1047,16 @@ agx_upload_viewport_scissor(struct agx_pool *pool, struct agx_batch *batch,
}
/* Upload state */
struct agx_ppp_update ppp =
agx_new_ppp_update(pool, (struct AGX_PPP_HEADER){
.depth_bias_scissor = true,
.region_clip = true,
.viewport = true,
.viewport_count = count,
});
struct AGX_PPP_HEADER present = {
.depth_bias_scissor = true,
.region_clip = true,
.viewport = true,
.viewport_count = count,
};
size_t size = agx_ppp_update_size(&present);
struct agx_ptr T = agx_pool_alloc_aligned(&batch->pool, size, 64);
struct agx_ppp_update ppp = agx_new_ppp_update(T, size, &present);
agx_ppp_push(&ppp, DEPTH_BIAS_SCISSOR, cfg) {
cfg.scissor = index;
@@ -3258,14 +3261,17 @@ agx_batch_init_state(struct agx_batch *batch)
cfg.usc_cache_inval = true;
}
struct agx_ppp_update ppp =
agx_new_ppp_update(&batch->pool, (struct AGX_PPP_HEADER){
.w_clamp = true,
.occlusion_query_2 = true,
.output_unknown = true,
.varying_word_2 = true,
.viewport_count = 1, /* irrelevant */
});
struct AGX_PPP_HEADER present = {
.w_clamp = true,
.occlusion_query_2 = true,
.output_unknown = true,
.varying_word_2 = true,
.viewport_count = 1, /* irrelevant */
};
size_t size = agx_ppp_update_size(&present);
struct agx_ptr T = agx_pool_alloc_aligned(&batch->pool, size, 64);
struct agx_ppp_update ppp = agx_new_ppp_update(T, size, &present);
/* clang-format off */
agx_ppp_push(&ppp, W_CLAMP, cfg) cfg.w_clamp = 1e-10;
@@ -3493,7 +3499,9 @@ agx_encode_state(struct agx_batch *batch, uint8_t *out)
.viewport_count = 1, /* irrelevant */
};
struct agx_ppp_update ppp = agx_new_ppp_update(pool, dirty);
size_t size = agx_ppp_update_size(&dirty);
struct agx_ptr T = agx_pool_alloc_aligned(&batch->pool, size, 64);
struct agx_ppp_update ppp = agx_new_ppp_update(T, size, &dirty);
if (dirty.fragment_control) {
agx_ppp_push(&ppp, FRAGMENT_CONTROL, cfg) {