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_meta_cache { 13 struct agx_device *dev; 14 struct agx_pool pool; 15 16 /* Map from agx_meta_key to agx_meta_shader */ 17 struct hash_table *ht; 18 }; 19 20 enum agx_meta_op { 21 AGX_META_OP_NONE, 22 AGX_META_OP_CLEAR, 23 AGX_META_OP_LOAD, 24 AGX_META_OP_STORE, 25 }; 26 27 struct agx_meta_key { 28 struct agx_tilebuffer_layout tib; 29 enum agx_meta_op op[8]; 30 unsigned reserved_preamble; 31 }; 32 33 struct agx_meta_shader { 34 struct agx_meta_key key; 35 struct agx_shader_info info; 36 struct agx_bo *bo; 37 uint32_t ptr; 38 }; 39 40 struct agx_meta_shader *agx_get_meta_shader(struct agx_meta_cache *cache, 41 struct agx_meta_key *key); 42 43 void agx_meta_init(struct agx_meta_cache *cache, struct agx_device *dev); 44 void agx_meta_cleanup(struct agx_meta_cache *cache); 45