1 /* 2 * Copyright © 2021 Raspberry Pi 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 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24 /* This file generates the per-v3d-version function prototypes. It must only 25 * be included from v3dv_private.h. 26 */ 27 28 #ifndef V3DV_PRIVATE_H 29 #error This file is included by means other than v3dv_private.h 30 #endif 31 32 /* Used at v3dv_cmd_buffer */ 33 void 34 v3dX(job_emit_binning_flush)(struct v3dv_job *job); 35 36 void 37 v3dX(cmd_buffer_emit_color_write_mask)(struct v3dv_cmd_buffer *cmd_buffer); 38 39 void 40 v3dX(cmd_buffer_end_render_pass_secondary)(struct v3dv_cmd_buffer *cmd_buffer); 41 42 void 43 v3dX(job_emit_clip_window)(struct v3dv_job *job, const VkRect2D *rect); 44 45 void 46 v3dX(cmd_buffer_emit_render_pass_rcl)(struct v3dv_cmd_buffer *cmd_buffer); 47 48 void 49 v3dX(cmd_buffer_emit_viewport)(struct v3dv_cmd_buffer *cmd_buffer); 50 51 void 52 v3dX(cmd_buffer_emit_stencil)(struct v3dv_cmd_buffer *cmd_buffer); 53 54 void 55 v3dX(cmd_buffer_emit_depth_bias)(struct v3dv_cmd_buffer *cmd_buffer); 56 57 void 58 v3dX(cmd_buffer_emit_depth_bounds)(struct v3dv_cmd_buffer *cmd_buffer); 59 60 void 61 v3dX(cmd_buffer_emit_line_width)(struct v3dv_cmd_buffer *cmd_buffer); 62 63 void 64 v3dX(cmd_buffer_emit_default_point_size)(struct v3dv_cmd_buffer *cmd_buffer); 65 66 void 67 v3dX(cmd_buffer_emit_sample_state)(struct v3dv_cmd_buffer *cmd_buffer); 68 69 void 70 v3dX(cmd_buffer_emit_blend)(struct v3dv_cmd_buffer *cmd_buffer); 71 72 void 73 v3dX(cmd_buffer_emit_varyings_state)(struct v3dv_cmd_buffer *cmd_buffer); 74 75 void 76 v3dX(cmd_buffer_emit_configuration_bits)(struct v3dv_cmd_buffer *cmd_buffer); 77 78 void 79 v3dX(job_emit_binning_prolog)(struct v3dv_job *job, 80 const struct v3dv_frame_tiling *tiling, 81 uint32_t layers); 82 83 void 84 v3dX(job_emit_enable_double_buffer)(struct v3dv_job *job); 85 86 void 87 v3dX(job_patch_resume_address)(struct v3dv_job *first_suspend, 88 struct v3dv_job *suspend, 89 struct v3dv_job *resume); 90 91 void 92 v3dX(cmd_buffer_execute_inside_pass)(struct v3dv_cmd_buffer *primary, 93 uint32_t cmd_buffer_count, 94 const VkCommandBuffer *cmd_buffers); 95 96 void 97 v3dX(cmd_buffer_emit_occlusion_query)(struct v3dv_cmd_buffer *cmd_buffer); 98 99 void 100 v3dX(cmd_buffer_emit_gl_shader_state)(struct v3dv_cmd_buffer *cmd_buffer); 101 102 103 void 104 v3dX(cmd_buffer_emit_draw)(struct v3dv_cmd_buffer *cmd_buffer, 105 struct v3dv_draw_info *info); 106 107 108 void 109 v3dX(cmd_buffer_emit_index_buffer)(struct v3dv_cmd_buffer *cmd_buffer); 110 111 void 112 v3dX(cmd_buffer_emit_draw_indexed)(struct v3dv_cmd_buffer *cmd_buffer, 113 uint32_t indexCount, 114 uint32_t instanceCount, 115 uint32_t firstIndex, 116 int32_t vertexOffset, 117 uint32_t firstInstance); 118 119 void 120 v3dX(cmd_buffer_emit_draw_indirect)(struct v3dv_cmd_buffer *cmd_buffer, 121 struct v3dv_buffer *buffer, 122 VkDeviceSize offset, 123 uint32_t drawCount, 124 uint32_t stride); 125 126 void 127 v3dX(cmd_buffer_emit_indexed_indirect)(struct v3dv_cmd_buffer *cmd_buffer, 128 struct v3dv_buffer *buffer, 129 VkDeviceSize offset, 130 uint32_t drawCount, 131 uint32_t stride); 132 133 void 134 v3dX(cmd_buffer_suspend)(struct v3dv_cmd_buffer *cmd_buffer); 135 136 struct v3dv_job * 137 v3dX(cmd_buffer_prepare_suspend_job_for_submit)(struct v3dv_job *job); 138 139 void 140 v3dX(get_hw_clear_color)(const VkClearColorValue *color, 141 uint32_t internal_type, 142 uint32_t internal_size, 143 uint32_t *hw_color); 144 145 /* Used at v3dv_device */ 146 147 void 148 v3dX(pack_sampler_state)(const struct v3dv_device *device, 149 struct v3dv_sampler *sampler, 150 const VkSamplerCreateInfo *pCreateInfo, 151 const VkSamplerCustomBorderColorCreateInfoEXT *bc_info); 152 153 void 154 v3dX(framebuffer_compute_internal_bpp_msaa)(const struct v3dv_framebuffer *framebuffer, 155 const struct v3dv_cmd_buffer_attachment_state *attachments, 156 const struct v3dv_subpass *subpass, 157 uint8_t *max_internal_bpp, 158 uint8_t *total_color_bpp, 159 bool *msaa); 160 161 #if MESA_DEBUG 162 void 163 v3dX(device_check_prepacked_sizes)(void); 164 #endif 165 166 /* Used at v3dv_format */ 167 const struct v3dv_format * 168 v3dX(get_format)(VkFormat); 169 170 void 171 v3dX(get_internal_type_bpp_for_output_format)(uint32_t format, 172 uint32_t *type, 173 uint32_t *bpp); 174 175 bool 176 v3dX(format_supports_tlb_resolve)(const struct v3dv_format *format); 177 178 bool 179 v3dX(format_supports_blending)(const struct v3dv_format *format); 180 181 /* FIXME: tex_format should be `enum V3DX(Texture_Data_Formats)`, but using 182 * that enum type in the header requires including v3dx_pack.h, which triggers 183 * circular include dependencies issues, so we're using a `uint32_t` for now. 184 */ 185 bool 186 v3dX(tfu_supports_tex_format)(uint32_t tex_format); 187 188 /* Used at v3dv_image */ 189 190 void 191 v3dX(pack_texture_shader_state)(struct v3dv_device *device, 192 struct v3dv_image_view *iview); 193 194 void 195 v3dX(pack_texture_shader_state_from_buffer_view)(struct v3dv_device *device, 196 struct v3dv_buffer_view *buffer_view); 197 198 /* Used at v3dv_meta_* */ 199 200 uint32_t 201 v3dX(zs_buffer_from_aspect_bits)(VkImageAspectFlags aspects); 202 203 uint8_t 204 v3dX(get_internal_depth_type)(VkFormat format); 205 206 struct v3dv_meta_framebuffer; 207 208 void 209 v3dX(meta_emit_copy_image_to_buffer_rcl)(struct v3dv_job *job, 210 struct v3dv_buffer *buffer, 211 struct v3dv_image *image, 212 struct v3dv_meta_framebuffer *framebuffer, 213 const VkBufferImageCopy2 *region); 214 215 void 216 v3dX(meta_emit_resolve_image_rcl)(struct v3dv_job *job, 217 struct v3dv_image *dst, 218 struct v3dv_image *src, 219 struct v3dv_meta_framebuffer *framebuffer, 220 const VkImageResolve2 *region); 221 222 void 223 v3dX(meta_emit_copy_buffer)(struct v3dv_job *job, 224 struct v3dv_bo *dst, 225 struct v3dv_bo *src, 226 uint32_t dst_offset, 227 uint32_t src_offset, 228 struct v3dv_meta_framebuffer *framebuffer, 229 uint32_t format, 230 uint32_t item_size); 231 232 void 233 v3dX(meta_emit_copy_buffer_rcl)(struct v3dv_job *job, 234 struct v3dv_bo *dst, 235 struct v3dv_bo *src, 236 uint32_t dst_offset, 237 uint32_t src_offset, 238 struct v3dv_meta_framebuffer *framebuffer, 239 uint32_t format, 240 uint32_t item_size); 241 242 void 243 v3dX(meta_emit_copy_image_rcl)(struct v3dv_job *job, 244 struct v3dv_image *dst, 245 struct v3dv_image *src, 246 struct v3dv_meta_framebuffer *framebuffer, 247 const VkImageCopy2 *region); 248 249 void 250 v3dX(meta_emit_tfu_job)(struct v3dv_cmd_buffer *cmd_buffer, 251 uint32_t dst_bo_handle, 252 uint32_t dst_offset, 253 enum v3d_tiling_mode dst_tiling, 254 uint32_t dst_padded_height_or_stride, 255 uint32_t dst_cpp, 256 uint32_t src_bo_handle, 257 uint32_t src_offset, 258 enum v3d_tiling_mode src_tiling, 259 uint32_t src_padded_height_or_stride, 260 uint32_t src_cpp, 261 uint32_t width, 262 uint32_t height, 263 const struct v3dv_format_plane *format_plane); 264 265 void 266 v3dX(meta_emit_clear_image_rcl)(struct v3dv_job *job, 267 struct v3dv_image *image, 268 struct v3dv_meta_framebuffer *framebuffer, 269 const union v3dv_clear_value *clear_value, 270 VkImageAspectFlags aspects, 271 uint32_t min_layer, 272 uint32_t max_layer, 273 uint32_t level); 274 275 void 276 v3dX(meta_emit_fill_buffer_rcl)(struct v3dv_job *job, 277 struct v3dv_bo *bo, 278 uint32_t offset, 279 struct v3dv_meta_framebuffer *framebuffer, 280 uint32_t data); 281 282 void 283 v3dX(meta_emit_copy_buffer_to_image_rcl)(struct v3dv_job *job, 284 struct v3dv_image *image, 285 struct v3dv_buffer *buffer, 286 struct v3dv_meta_framebuffer *framebuffer, 287 const VkBufferImageCopy2 *region); 288 289 void 290 v3dX(get_internal_type_bpp_for_image_aspects)(VkFormat vk_format, 291 VkImageAspectFlags aspect_mask, 292 uint32_t *internal_type, 293 uint32_t *internal_bpp); 294 295 struct v3dv_job * 296 v3dX(meta_copy_buffer)(struct v3dv_cmd_buffer *cmd_buffer, 297 struct v3dv_bo *dst, 298 uint32_t dst_offset, 299 struct v3dv_bo *src, 300 uint32_t src_offset, 301 const VkBufferCopy2 *region); 302 303 void 304 v3dX(meta_fill_buffer)(struct v3dv_cmd_buffer *cmd_buffer, 305 struct v3dv_bo *bo, 306 uint32_t offset, 307 uint32_t size, 308 uint32_t data); 309 310 void 311 v3dX(meta_framebuffer_init)(struct v3dv_meta_framebuffer *fb, 312 VkFormat vk_format, 313 uint32_t internal_type, 314 const struct v3dv_frame_tiling *tiling); 315 316 /* Used at v3dv_pipeline */ 317 void 318 v3dX(pipeline_pack_state)(struct v3dv_pipeline *pipeline, 319 const VkPipelineColorBlendStateCreateInfo *cb_info, 320 const VkPipelineDepthStencilStateCreateInfo *ds_info, 321 const VkPipelineRasterizationStateCreateInfo *rs_info, 322 const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *pv_info, 323 const VkPipelineRasterizationLineStateCreateInfoEXT *ls_info, 324 const VkPipelineMultisampleStateCreateInfo *ms_info, 325 const struct vk_graphics_pipeline_state *state); 326 void 327 v3dX(pipeline_pack_compile_state)(struct v3dv_pipeline *pipeline, 328 const VkPipelineVertexInputStateCreateInfo *vi_info, 329 const VkPipelineVertexInputDivisorStateCreateInfoEXT *vd_info); 330 331 bool 332 v3dX(pipeline_needs_default_attribute_values)(struct v3dv_pipeline *pipeline); 333 334 struct v3dv_bo * 335 v3dX(create_default_attribute_values)(struct v3dv_device *device, 336 struct v3dv_pipeline *pipeline); 337 338 /* Used at v3dv_queue */ 339 void 340 v3dX(job_emit_noop)(struct v3dv_job *job); 341 342 /* Used at v3dv_query */ 343 VkResult 344 v3dX(enumerate_performance_query_counters)(struct v3dv_physical_device *pDevice, 345 uint32_t *pCounterCount, 346 VkPerformanceCounterKHR *pCounters, 347 VkPerformanceCounterDescriptionKHR *pCounterDescriptions); 348 349 /* Used at v3dv_descriptor_set, and other descriptor set utils */ 350 uint32_t v3dX(descriptor_bo_size)(VkDescriptorType type); 351 352 uint32_t v3dX(max_descriptor_bo_size)(void); 353 354 uint32_t v3dX(combined_image_sampler_texture_state_offset)(uint8_t plane); 355 356 uint32_t v3dX(combined_image_sampler_sampler_state_offset)(uint8_t plane); 357 358 /* General utils */ 359 360 uint32_t 361 v3dX(clamp_for_format_and_type)(uint32_t rt_type, 362 VkFormat vk_format); 363 364 uint32_t 365 v3dX(clamp_for_format_and_type)(uint32_t rt_type, 366 VkFormat vk_format); 367 368 void 369 v3dX(viewport_compute_xform)(const VkViewport *viewport, 370 float scale[3], 371 float translate[3]); 372 373 uint32_t 374 v3dX(translate_stencil_op)(VkStencilOp op); 375