1 /* 2 * Copyright (C) 2021 Collabora, Ltd. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 * SOFTWARE. 22 * 23 */ 24 25 #ifndef __PAN_FB_PRELOAD_H 26 #define __PAN_FB_PRELOAD_H 27 28 #include "util/format/u_format.h" 29 #include "pan_desc.h" 30 #include "pan_pool.h" 31 #include "pan_texture.h" 32 #include "pan_util.h" 33 34 struct pan_blend_shader_cache; 35 struct pan_fb_info; 36 struct pan_jc; 37 struct pan_pool; 38 39 struct pan_fb_preload_cache { 40 unsigned gpu_id; 41 struct { 42 struct pan_pool *pool; 43 struct hash_table *preload; 44 struct hash_table *blend; 45 pthread_mutex_t lock; 46 } shaders; 47 struct { 48 struct pan_pool *pool; 49 struct hash_table *rsds; 50 pthread_mutex_t lock; 51 } rsds; 52 struct pan_blend_shader_cache *blend_shader_cache; 53 }; 54 55 #ifdef PAN_ARCH 56 void GENX(pan_fb_preload_cache_init)( 57 struct pan_fb_preload_cache *cache, unsigned gpu_id, 58 struct pan_blend_shader_cache *blend_shader_cache, struct pan_pool *bin_pool, 59 struct pan_pool *desc_pool); 60 61 void GENX(pan_fb_preload_cache_cleanup)(struct pan_fb_preload_cache *cache); 62 63 unsigned GENX(pan_preload_fb)(struct pan_fb_preload_cache *cache, 64 struct pan_pool *desc_pool, 65 struct pan_fb_info *fb, uint64_t tsd, 66 struct panfrost_ptr *jobs); 67 #endif 68 69 #endif 70