1 /* 2 * Copyright (C) 2019 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 * Authors: 24 * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> 25 */ 26 27 #ifndef PAN_PROPS_H 28 #define PAN_PROPS_H 29 30 #include <stdbool.h> 31 #include <stdint.h> 32 33 struct pan_kmod_dev; 34 struct pan_kmod_dev_props; 35 36 /** Implementation-defined tiler features */ 37 struct panfrost_tiler_features { 38 /** Number of bytes per tiler bin */ 39 unsigned bin_size; 40 41 /** Maximum number of levels that may be simultaneously enabled. 42 * Invariant: bitcount(hierarchy_mask) <= max_levels */ 43 unsigned max_levels; 44 }; 45 46 struct panfrost_model { 47 /* GPU ID */ 48 uint32_t gpu_id; 49 50 /* Marketing name for the GPU, used as the GL_RENDERER */ 51 const char *name; 52 53 /* Set of associated performance counters */ 54 const char *performance_counters; 55 56 /* Minimum GPU revision required for anisotropic filtering. ~0 and 0 57 * means "no revisions support anisotropy" and "all revisions support 58 * anistropy" respectively -- so checking for anisotropy is simply 59 * comparing the reivsion. 60 */ 61 uint32_t min_rev_anisotropic; 62 63 /* Default tilebuffer size in bytes for the model. */ 64 unsigned tilebuffer_size; 65 66 struct { 67 /* The GPU lacks the capability for hierarchical tiling, without 68 * an "Advanced Tiling Unit", instead requiring a single bin 69 * size for the entire framebuffer be selected by the driver 70 */ 71 bool no_hierarchical_tiling; 72 } quirks; 73 }; 74 75 const struct panfrost_model *panfrost_get_model(uint32_t gpu_id); 76 77 unsigned panfrost_query_l2_slices(const struct pan_kmod_dev_props *props); 78 79 struct panfrost_tiler_features 80 panfrost_query_tiler_features(const struct pan_kmod_dev_props *props); 81 82 unsigned 83 panfrost_query_thread_tls_alloc(const struct pan_kmod_dev_props *props); 84 85 uint32_t 86 panfrost_query_compressed_formats(const struct pan_kmod_dev_props *props); 87 88 unsigned panfrost_query_core_count(const struct pan_kmod_dev_props *props, 89 unsigned *core_id_range); 90 91 bool panfrost_query_afbc(const struct pan_kmod_dev_props *props); 92 93 unsigned panfrost_query_optimal_tib_size(const struct panfrost_model *model); 94 95 uint64_t panfrost_clamp_to_usable_va_range(const struct pan_kmod_dev *dev, 96 uint64_t va); 97 98 #endif 99