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 (Collabora): 24 * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> 25 */ 26 27 #ifndef __PAN_ENCODER_H 28 #define __PAN_ENCODER_H 29 30 #include <stdbool.h> 31 #include "midgard_pack.h" 32 33 /* Invocation packing */ 34 35 void 36 panfrost_pack_work_groups_compute( 37 struct mali_invocation_packed *out, 38 unsigned num_x, 39 unsigned num_y, 40 unsigned num_z, 41 unsigned size_x, 42 unsigned size_y, 43 unsigned size_z, 44 bool quirk_graphics); 45 46 /* Tiler structure size computation */ 47 48 unsigned 49 panfrost_tiler_header_size(unsigned width, unsigned height, unsigned mask, bool hierarchy); 50 51 unsigned 52 panfrost_tiler_full_size(unsigned width, unsigned height, unsigned mask, bool hierarchy); 53 54 unsigned 55 panfrost_choose_hierarchy_mask( 56 unsigned width, unsigned height, 57 unsigned vertex_count, bool hierarchy); 58 59 /* Stack sizes */ 60 61 unsigned 62 panfrost_get_stack_shift(unsigned stack_size); 63 64 unsigned 65 panfrost_get_total_stack_size( 66 unsigned thread_size, 67 unsigned threads_per_core, 68 unsigned core_count); 69 70 const char * panfrost_model_name(unsigned gpu_id); 71 72 /* Attributes / instancing */ 73 74 unsigned 75 panfrost_padded_vertex_count(unsigned vertex_count); 76 77 unsigned 78 panfrost_compute_magic_divisor(unsigned hw_divisor, unsigned *o_shift, unsigned *extra_flags); 79 80 void panfrost_vertex_id(unsigned padded_count, struct mali_attribute_buffer_packed *attr, bool instanced); 81 void panfrost_instance_id(unsigned padded_count, struct mali_attribute_buffer_packed *attr, bool instanced); 82 83 /* Samplers */ 84 85 enum mali_func 86 panfrost_flip_compare_func(enum mali_func f); 87 88 89 90 #endif 91