xref: /aosp_15_r20/external/mesa3d/src/asahi/lib/agx_bg_eot.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2022 Alyssa Rosenzweig
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #pragma once
7 
8 #include "asahi/compiler/agx_compile.h"
9 #include "agx_tilebuffer.h"
10 #include "pool.h"
11 
12 struct agx_bg_eot_cache {
13    struct agx_device *dev;
14    struct agx_pool pool;
15 
16    /* Map from agx_bg_eot_key to agx_bg_eot_shader */
17    struct hash_table *ht;
18 };
19 
20 enum agx_bg_eot_op {
21    AGX_BG_EOT_NONE,
22    AGX_BG_CLEAR,
23    AGX_BG_LOAD,
24    AGX_EOT_STORE,
25 };
26 
27 struct agx_bg_eot_key {
28    struct agx_tilebuffer_layout tib;
29    enum agx_bg_eot_op op[8];
30    unsigned reserved_preamble;
31 };
32 
33 struct agx_bg_eot_shader {
34    struct agx_bg_eot_key key;
35    struct agx_shader_info info;
36    struct agx_bo *bo;
37    uint64_t ptr;
38 };
39 
40 struct agx_bg_eot_shader *agx_get_bg_eot_shader(struct agx_bg_eot_cache *cache,
41                                                 struct agx_bg_eot_key *key);
42 
43 void agx_bg_eot_init(struct agx_bg_eot_cache *cache, struct agx_device *dev);
44 void agx_bg_eot_cleanup(struct agx_bg_eot_cache *cache);
45