Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/panfrost/lib/pan_cs.h
4560 views
1
/*
2
* Copyright (C) 2021 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 <[email protected]>
25
* Boris Brezillon <[email protected]>
26
*/
27
28
#ifndef __PAN_CS_H
29
#define __PAN_CS_H
30
31
#include "pan_texture.h"
32
33
struct pan_compute_dim {
34
uint32_t x, y, z;
35
};
36
37
struct pan_fb_color_attachment {
38
const struct pan_image_view *view;
39
bool *crc_valid;
40
bool clear;
41
bool preload;
42
bool discard;
43
uint32_t clear_value[4];
44
};
45
46
struct pan_fb_zs_attachment {
47
struct {
48
const struct pan_image_view *zs, *s;
49
} view;
50
51
struct {
52
bool z, s;
53
} clear;
54
55
struct {
56
bool z, s;
57
} discard;
58
59
struct {
60
bool z, s;
61
} preload;
62
63
struct {
64
float depth;
65
uint8_t stencil;
66
} clear_value;
67
};
68
69
struct pan_tiler_context {
70
union {
71
mali_ptr bifrost;
72
struct {
73
bool disable;
74
struct panfrost_bo *polygon_list;
75
} midgard;
76
};
77
};
78
79
struct pan_tls_info {
80
struct {
81
mali_ptr ptr;
82
unsigned size;
83
} tls;
84
85
struct {
86
struct pan_compute_dim dim;
87
mali_ptr ptr;
88
unsigned size;
89
} wls;
90
};
91
92
struct pan_fb_bifrost_info {
93
struct {
94
struct panfrost_ptr dcds;
95
enum mali_pre_post_frame_shader_mode modes[3];
96
} pre_post;
97
};
98
99
struct pan_fb_info {
100
unsigned width, height;
101
struct {
102
/* Max values are inclusive */
103
unsigned minx, miny, maxx, maxy;
104
} extent;
105
unsigned nr_samples;
106
unsigned rt_count;
107
struct pan_fb_color_attachment rts[8];
108
struct pan_fb_zs_attachment zs;
109
110
struct {
111
unsigned stride;
112
mali_ptr base;
113
} tile_map;
114
115
union {
116
struct pan_fb_bifrost_info bifrost;
117
};
118
};
119
120
unsigned
121
pan_wls_mem_size(const struct panfrost_device *dev,
122
const struct pan_compute_dim *dim,
123
unsigned wls_size);
124
125
void
126
pan_emit_tls(const struct panfrost_device *dev,
127
const struct pan_tls_info *info,
128
void *out);
129
130
bool
131
pan_fbd_has_zs_crc_ext(const struct panfrost_device *dev,
132
const struct pan_fb_info *fb);
133
134
int
135
pan_select_crc_rt(const struct panfrost_device *dev,
136
const struct pan_fb_info *fb);
137
138
unsigned
139
pan_emit_fbd(const struct panfrost_device *dev,
140
const struct pan_fb_info *fb,
141
const struct pan_tls_info *tls,
142
const struct pan_tiler_context *tiler_ctx,
143
void *out);
144
145
void
146
pan_emit_bifrost_tiler_heap(const struct panfrost_device *dev,
147
void *out);
148
149
void
150
pan_emit_bifrost_tiler(const struct panfrost_device *dev,
151
unsigned fb_width, unsigned fb_height,
152
unsigned nr_samples,
153
mali_ptr heap,
154
void *out);
155
156
void
157
pan_emit_fragment_job(const struct panfrost_device *dev,
158
const struct pan_fb_info *fb,
159
mali_ptr fbd,
160
void *out);
161
162
#endif
163
164