7e815a7f2c8d9eaaeaa1d1637f38f0ddc0d5b7a5
[mesa.git] / src / panfrost / lib / pan_encoder.h
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_vertex_tiler_prefix *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 void
47 panfrost_pack_work_groups_fused(
48 struct mali_vertex_tiler_prefix *vertex,
49 struct mali_vertex_tiler_prefix *tiler,
50 unsigned num_x,
51 unsigned num_y,
52 unsigned num_z,
53 unsigned size_x,
54 unsigned size_y,
55 unsigned size_z);
56
57 /* Tiler structure size computation */
58
59 unsigned
60 panfrost_tiler_header_size(unsigned width, unsigned height, unsigned mask, bool hierarchy);
61
62 unsigned
63 panfrost_tiler_full_size(unsigned width, unsigned height, unsigned mask, bool hierarchy);
64
65 unsigned
66 panfrost_choose_hierarchy_mask(
67 unsigned width, unsigned height,
68 unsigned vertex_count, bool hierarchy);
69
70 /* Stack sizes */
71
72 unsigned
73 panfrost_get_stack_shift(unsigned stack_size);
74
75 unsigned
76 panfrost_get_total_stack_size(
77 unsigned stack_shift,
78 unsigned threads_per_core,
79 unsigned core_count);
80
81 /* Property queries */
82
83
84 unsigned panfrost_query_gpu_version(int fd);
85 unsigned panfrost_query_core_count(int fd);
86 unsigned panfrost_query_thread_tls_alloc(int fd);
87
88 const char * panfrost_model_name(unsigned gpu_id);
89
90 /* Attributes / instancing */
91
92 unsigned
93 panfrost_padded_vertex_count(unsigned vertex_count);
94
95 unsigned
96 panfrost_compute_magic_divisor(unsigned hw_divisor, unsigned *o_shift, unsigned *extra_flags);
97
98 void panfrost_vertex_id(unsigned padded_count, union mali_attr *attr);
99 void panfrost_instance_id(unsigned padded_count, union mali_attr *attr);
100
101 /* Samplers */
102
103 enum mali_func
104 panfrost_flip_compare_func(enum mali_func f);
105
106
107
108 #endif