1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2022 Imagination Technologies Ltd. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy 5bf215546Sopenharmony_ci * of this software and associated documentation files (the "Software"), to deal 6bf215546Sopenharmony_ci * in the Software without restriction, including without limitation the rights 7bf215546Sopenharmony_ci * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8bf215546Sopenharmony_ci * copies of the Software, and to permit persons to whom the Software is 9bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18bf215546Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21bf215546Sopenharmony_ci * SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ci#ifndef PVR_JOB_RENDER_H 25bf215546Sopenharmony_ci#define PVR_JOB_RENDER_H 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#include <stdbool.h> 28bf215546Sopenharmony_ci#include <stdint.h> 29bf215546Sopenharmony_ci#include <vulkan/vulkan.h> 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci#include "hwdef/rogue_hw_defs.h" 32bf215546Sopenharmony_ci#include "pvr_limits.h" 33bf215546Sopenharmony_ci#include "pvr_types.h" 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_cistruct pvr_device; 36bf215546Sopenharmony_cistruct pvr_free_list; 37bf215546Sopenharmony_cistruct pvr_render_ctx; 38bf215546Sopenharmony_cistruct pvr_rt_dataset; 39bf215546Sopenharmony_cistruct pvr_winsys_job_bo; 40bf215546Sopenharmony_cistruct vk_sync; 41bf215546Sopenharmony_ci 42bf215546Sopenharmony_ci/* FIXME: Turn 'struct pvr_sub_cmd' into 'struct pvr_job' and change 'struct 43bf215546Sopenharmony_ci * pvr_render_job' to subclass it? This is approximately what v3dv does 44bf215546Sopenharmony_ci * (although it doesn't subclass). 45bf215546Sopenharmony_ci */ 46bf215546Sopenharmony_cistruct pvr_render_job { 47bf215546Sopenharmony_ci struct pvr_rt_dataset *rt_dataset; 48bf215546Sopenharmony_ci 49bf215546Sopenharmony_ci bool run_frag; 50bf215546Sopenharmony_ci bool geometry_terminate; 51bf215546Sopenharmony_ci bool frag_uses_atomic_ops; 52bf215546Sopenharmony_ci bool disable_compute_overlap; 53bf215546Sopenharmony_ci bool enable_bg_tag; 54bf215546Sopenharmony_ci bool process_empty_tiles; 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ci uint32_t pds_pixel_event_data_offset; 57bf215546Sopenharmony_ci 58bf215546Sopenharmony_ci pvr_dev_addr_t ctrl_stream_addr; 59bf215546Sopenharmony_ci 60bf215546Sopenharmony_ci pvr_dev_addr_t border_colour_table_addr; 61bf215546Sopenharmony_ci pvr_dev_addr_t depth_bias_table_addr; 62bf215546Sopenharmony_ci pvr_dev_addr_t scissor_table_addr; 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_ci pvr_dev_addr_t depth_addr; 65bf215546Sopenharmony_ci uint32_t depth_stride; 66bf215546Sopenharmony_ci uint32_t depth_height; 67bf215546Sopenharmony_ci uint32_t depth_physical_width; 68bf215546Sopenharmony_ci uint32_t depth_physical_height; 69bf215546Sopenharmony_ci uint32_t depth_layer_size; 70bf215546Sopenharmony_ci float depth_clear_value; 71bf215546Sopenharmony_ci VkFormat depth_vk_format; 72bf215546Sopenharmony_ci /* FIXME: This should be of type 'enum pvr_memlayout', but this is defined 73bf215546Sopenharmony_ci * in pvr_private.h, which causes a circular include dependency. For now, 74bf215546Sopenharmony_ci * treat it has a uint32_t. A couple of ways to possibly fix this: 75bf215546Sopenharmony_ci * 76bf215546Sopenharmony_ci * 1. Merge the contents of this header file into pvr_private.h. 77bf215546Sopenharmony_ci * 2. Move 'enum pvr_memlayout' into it a new header that can be included 78bf215546Sopenharmony_ci * by both this header and pvr_private.h. 79bf215546Sopenharmony_ci */ 80bf215546Sopenharmony_ci uint32_t depth_memlayout; 81bf215546Sopenharmony_ci 82bf215546Sopenharmony_ci pvr_dev_addr_t stencil_addr; 83bf215546Sopenharmony_ci 84bf215546Sopenharmony_ci uint32_t samples; 85bf215546Sopenharmony_ci 86bf215546Sopenharmony_ci uint32_t pixel_output_width; 87bf215546Sopenharmony_ci 88bf215546Sopenharmony_ci uint8_t max_shared_registers; 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_ci /* Upper limit for tiles in flight, '0' means use default limit based 91bf215546Sopenharmony_ci * on partition store. 92bf215546Sopenharmony_ci */ 93bf215546Sopenharmony_ci uint32_t max_tiles_in_flight; 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_ci uint64_t pbe_reg_words[PVR_MAX_COLOR_ATTACHMENTS] 96bf215546Sopenharmony_ci [ROGUE_NUM_PBESTATE_REG_WORDS]; 97bf215546Sopenharmony_ci 98bf215546Sopenharmony_ci uint64_t pds_bgnd_reg_values[ROGUE_NUM_CR_PDS_BGRND_WORDS]; 99bf215546Sopenharmony_ci}; 100bf215546Sopenharmony_ci 101bf215546Sopenharmony_ciVkResult pvr_free_list_create(struct pvr_device *device, 102bf215546Sopenharmony_ci uint32_t initial_size, 103bf215546Sopenharmony_ci uint32_t max_size, 104bf215546Sopenharmony_ci uint32_t grow_size, 105bf215546Sopenharmony_ci uint32_t grow_threshold, 106bf215546Sopenharmony_ci struct pvr_free_list *parent_free_list, 107bf215546Sopenharmony_ci struct pvr_free_list **const free_list_out); 108bf215546Sopenharmony_civoid pvr_free_list_destroy(struct pvr_free_list *free_list); 109bf215546Sopenharmony_ci 110bf215546Sopenharmony_ciVkResult 111bf215546Sopenharmony_cipvr_render_target_dataset_create(struct pvr_device *device, 112bf215546Sopenharmony_ci uint32_t width, 113bf215546Sopenharmony_ci uint32_t height, 114bf215546Sopenharmony_ci uint32_t samples, 115bf215546Sopenharmony_ci uint32_t layers, 116bf215546Sopenharmony_ci struct pvr_rt_dataset **const rt_dataset_out); 117bf215546Sopenharmony_civoid pvr_render_target_dataset_destroy(struct pvr_rt_dataset *dataset); 118bf215546Sopenharmony_ci 119bf215546Sopenharmony_ciVkResult pvr_render_job_submit(struct pvr_render_ctx *ctx, 120bf215546Sopenharmony_ci struct pvr_render_job *job, 121bf215546Sopenharmony_ci const struct pvr_winsys_job_bo *bos, 122bf215546Sopenharmony_ci uint32_t bo_count, 123bf215546Sopenharmony_ci struct vk_sync **waits, 124bf215546Sopenharmony_ci uint32_t wait_count, 125bf215546Sopenharmony_ci uint32_t *stage_flags, 126bf215546Sopenharmony_ci struct vk_sync *signal_sync_geom, 127bf215546Sopenharmony_ci struct vk_sync *signal_sync_frag); 128bf215546Sopenharmony_ci 129bf215546Sopenharmony_ci#endif /* PVR_JOB_RENDER_H */ 130