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_invocation_packed
*out
,
46 /* Tiler structure size computation */
49 panfrost_tiler_header_size(unsigned width
, unsigned height
, unsigned mask
, bool hierarchy
);
52 panfrost_tiler_full_size(unsigned width
, unsigned height
, unsigned mask
, bool hierarchy
);
55 panfrost_choose_hierarchy_mask(
56 unsigned width
, unsigned height
,
57 unsigned vertex_count
, bool hierarchy
);
62 panfrost_get_stack_shift(unsigned stack_size
);
65 panfrost_get_total_stack_size(
67 unsigned threads_per_core
,
70 /* Property queries */
73 unsigned panfrost_query_gpu_version(int fd
);
74 unsigned panfrost_query_core_count(int fd
);
75 unsigned panfrost_query_thread_tls_alloc(int fd
);
77 const char * panfrost_model_name(unsigned gpu_id
);
79 /* Attributes / instancing */
82 panfrost_padded_vertex_count(unsigned vertex_count
);
85 panfrost_compute_magic_divisor(unsigned hw_divisor
, unsigned *o_shift
, unsigned *extra_flags
);
87 void panfrost_vertex_id(unsigned padded_count
, struct mali_attribute_buffer_packed
*attr
, bool instanced
);
88 void panfrost_instance_id(unsigned padded_count
, struct mali_attribute_buffer_packed
*attr
, bool instanced
);
93 panfrost_flip_compare_func(enum mali_func f
);