2 * Copyright (C) 2019 Collabora, Ltd.
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:
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
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
23 * Authors (Collabora):
24 * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
27 #ifndef __PAN_ENCODER_H
28 #define __PAN_ENCODER_H
31 #include "midgard_pack.h"
33 /* Invocation packing */
36 panfrost_pack_work_groups_compute(
37 struct mali_vertex_tiler_prefix
*out
,
47 panfrost_pack_work_groups_fused(
48 struct mali_vertex_tiler_prefix
*vertex
,
49 struct mali_vertex_tiler_prefix
*tiler
,
57 /* Tiler structure size computation */
60 panfrost_tiler_header_size(unsigned width
, unsigned height
, unsigned mask
, bool hierarchy
);
63 panfrost_tiler_full_size(unsigned width
, unsigned height
, unsigned mask
, bool hierarchy
);
66 panfrost_choose_hierarchy_mask(
67 unsigned width
, unsigned height
,
68 unsigned vertex_count
, bool hierarchy
);
73 panfrost_get_stack_shift(unsigned stack_size
);
76 panfrost_get_total_stack_size(
78 unsigned threads_per_core
,
81 /* Property queries */
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
);
88 const char * panfrost_model_name(unsigned gpu_id
);
90 /* Attributes / instancing */
93 panfrost_padded_vertex_count(unsigned vertex_count
);
96 panfrost_compute_magic_divisor(unsigned hw_divisor
, unsigned *o_shift
, unsigned *extra_flags
);
98 void panfrost_vertex_id(unsigned padded_count
, struct mali_attribute_buffer_packed
*attr
, bool instanced
);
99 void panfrost_instance_id(unsigned padded_count
, struct mali_attribute_buffer_packed
*attr
, bool instanced
);
104 panfrost_flip_compare_func(enum mali_func f
);