pvr: run clang-format

This fixes up a bunch of clang-format issues that was missed recently.

Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38886>
This commit is contained in:
Erik Faye-Lund 2025-12-08 11:18:44 +01:00 committed by Marge Bot
parent 306de6782c
commit 708d331a04
23 changed files with 333 additions and 351 deletions

View file

@ -1896,7 +1896,8 @@ static VkResult pvr_add_deferred_rta_clear(struct pvr_cmd_buffer *cmd_buffer,
image = vk_to_pvr_image(image_view->vk.image);
for (uint32_t i = 0; i < rect->layerCount; i++) {
struct pvr_transfer_cmd *transfer_cmd = pvr_transfer_cmd_alloc(cmd_buffer);
struct pvr_transfer_cmd *transfer_cmd =
pvr_transfer_cmd_alloc(cmd_buffer);
list_addtail(&transfer_cmd->link, &cmd_buffer->deferred_clears);
@ -2003,8 +2004,8 @@ static void pvr_clear_attachments(struct pvr_cmd_buffer *cmd_buffer,
hw_render =
pvr_pass_info_get_hw_render(&cmd_buffer->state.render_pass_info, 0);
/* TODO: verify that the hw_render if is_render_init is true is exclusive to
* a non dynamic rendering path.
/* TODO: verify that the hw_render if is_render_init is true is
* exclusive to a non dynamic rendering path.
*/
if (is_render_init) {
mrt_resource =
@ -2021,7 +2022,8 @@ static void pvr_clear_attachments(struct pvr_cmd_buffer *cmd_buffer,
global_attachment_idx =
dr_info->color_attachments[local_attachment_idx].index_color;
} else {
struct pvr_render_subpass *sub_pass = &pass->subpasses[hw_pass->index];
struct pvr_render_subpass *sub_pass =
&pass->subpasses[hw_pass->index];
mrt_resource = &hw_pass->setup.mrt_resources[local_attachment_idx];
@ -2171,7 +2173,6 @@ static void pvr_clear_attachments(struct pvr_cmd_buffer *cmd_buffer,
if (!PVR_HAS_FEATURE(dev_info, gs_rta_support) &&
(clear_rect->baseArrayLayer != 0 || clear_rect->layerCount > 1)) {
if (pass_info->attachments) {
result = pvr_add_deferred_rta_clear(cmd_buffer,
attachment,
@ -2182,7 +2183,8 @@ static void pvr_clear_attachments(struct pvr_cmd_buffer *cmd_buffer,
continue;
} else {
pvr_finishme("incomplete support for deferred (emulated) RTA clears");
pvr_finishme(
"incomplete support for deferred (emulated) RTA clears");
}
}

View file

@ -43,14 +43,14 @@ pvr_copy_or_resolve_color_image_region(struct pvr_cmd_buffer *cmd_buffer,
const struct pvr_image *dst,
const VkImageCopy2 *region);
VkResult
pvr_copy_or_resolve_depth_stencil_region(struct pvr_cmd_buffer *cmd_buffer,
const struct pvr_image *src,
const struct pvr_image *dst,
int resolve_op,
bool clear_complement,
const VkClearDepthStencilValue *ds_clear_values,
const VkImageCopy2 *region);
VkResult pvr_copy_or_resolve_depth_stencil_region(
struct pvr_cmd_buffer *cmd_buffer,
const struct pvr_image *src,
const struct pvr_image *dst,
int resolve_op,
bool clear_complement,
const VkClearDepthStencilValue *ds_clear_values,
const VkImageCopy2 *region);
VkResult
pvr_copy_buffer_to_image_region_format(struct pvr_cmd_buffer *cmd_buffer,

View file

@ -415,11 +415,12 @@ static inline void pvr_border_color_swizzle_to_tex_format(
*color = swizzled_color;
}
VkResult
pvr_border_color_table_init(struct pvr_device *const device)
VkResult pvr_border_color_table_init(struct pvr_device *const device)
{
struct pvr_border_color_table *table = device->border_color_table =
vk_zalloc(&device->vk.alloc, sizeof(struct pvr_border_color_table), 8,
vk_zalloc(&device->vk.alloc,
sizeof(struct pvr_border_color_table),
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!table)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@ -469,8 +470,7 @@ err_out:
return result;
}
void
pvr_border_color_table_finish(struct pvr_device *const device)
void pvr_border_color_table_finish(struct pvr_device *const device)
{
#if MESA_DEBUG
BITSET_SET_RANGE_INSIDE_WORD(device->border_color_table->unused_entries,

View file

@ -59,11 +59,9 @@ struct pvr_border_color_table {
struct pvr_bo *table;
};
VkResult
pvr_border_color_table_init(struct pvr_device *const device);
VkResult pvr_border_color_table_init(struct pvr_device *const device);
void
pvr_border_color_table_finish(struct pvr_device *device);
void pvr_border_color_table_finish(struct pvr_device *device);
VkResult
pvr_border_color_table_get_or_create_entry(struct pvr_device *device,

View file

@ -478,7 +478,8 @@ VkResult pvr_device_init_graphics_static_clear_state(struct pvr_device *device)
struct pvr_device_static_clear_state *state = device->static_clear_state =
vk_zalloc(&device->vk.alloc,
sizeof(struct pvr_device_static_clear_state), 8,
sizeof(struct pvr_device_static_clear_state),
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!state)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);

View file

@ -106,11 +106,9 @@ pvr_dynamic_render_info_destroy(const struct pvr_device *device,
struct pvr_cmd_buffer *cmd_buffer,
struct pvr_dynamic_render_info *dr_info);
static void
pvr_cmd_buffer_clear_values_free(struct pvr_cmd_buffer *cmd_buffer);
static void pvr_cmd_buffer_clear_values_free(struct pvr_cmd_buffer *cmd_buffer);
static void
pvr_cmd_buffer_attachments_free(struct pvr_cmd_buffer *cmd_buffer);
static void pvr_cmd_buffer_attachments_free(struct pvr_cmd_buffer *cmd_buffer);
struct pvr_renderpass_hwsetup_render *
pvr_pass_info_get_hw_render(const struct pvr_render_pass_info *render_pass_info,
@ -130,10 +128,10 @@ static void pvr_cmd_buffer_free_sub_cmd(struct pvr_cmd_buffer *cmd_buffer,
if (sub_cmd->owned) {
switch (sub_cmd->type) {
case PVR_SUB_CMD_TYPE_GRAPHICS:
secondary_cont =
cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY &&
(cmd_buffer->usage_flags &
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT);
secondary_cont = cmd_buffer->vk.level ==
VK_COMMAND_BUFFER_LEVEL_SECONDARY &&
(cmd_buffer->usage_flags &
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT);
util_dynarray_fini(&sub_cmd->gfx.sec_query_indices);
pvr_csb_finish(&sub_cmd->gfx.control_stream);
@ -143,7 +141,8 @@ static void pvr_cmd_buffer_free_sub_cmd(struct pvr_cmd_buffer *cmd_buffer,
pvr_bo_suballoc_free(sub_cmd->gfx.scissor_bo);
if (sub_cmd->is_dynamic_render && !secondary_cont) {
pvr_rstate_entry_remove(cmd_buffer->device, sub_cmd->gfx.rstate);
pvr_dynamic_render_info_destroy(cmd_buffer->device, cmd_buffer,
pvr_dynamic_render_info_destroy(cmd_buffer->device,
cmd_buffer,
sub_cmd->gfx.dr_info);
}
break;
@ -720,8 +719,7 @@ static VkResult pvr_setup_texture_state_words(
pvr_csb_pack (&descriptor->sampler.words[1],
TEXSTATE_SAMPLER_WORD1,
sampler) {
}
sampler) {}
return VK_SUCCESS;
}
@ -1197,7 +1195,7 @@ static void pvr_setup_pbe_state(
break;
}
#define PVR_DEC_IF_NOT_ZERO(_v) (((_v) > 0) ? (_v)-1 : 0)
#define PVR_DEC_IF_NOT_ZERO(_v) (((_v) > 0) ? (_v) - 1 : 0)
render_params.min_x_clip = MAX2(0, render_area->offset.x);
render_params.min_y_clip = MAX2(0, render_area->offset.y);
@ -1243,9 +1241,9 @@ pvr_get_render_target(const struct pvr_renderpass_hwsetup_render *hw_render,
return &rstate->render_targets[rt_idx];
}
static uint32_t
pvr_get_pixel_output_width(const struct pvr_renderpass_hwsetup_render *hw_render,
const struct pvr_device_info *dev_info)
static uint32_t pvr_get_pixel_output_width(
const struct pvr_renderpass_hwsetup_render *hw_render,
const struct pvr_device_info *dev_info)
{
/* Default value based on the maximum value found in all existing cores. The
* maximum is used as this is being treated as a lower bound, making it a
@ -1510,8 +1508,7 @@ pvr_setup_emit_state(const struct pvr_device_info *dev_info,
resource_type <= USC_MRT_RESOURCE_TYPE_MEMORY;
resource_type++) {
for (uint32_t i = 0; i < hw_render->eot_surface_count; i++) {
const struct pvr_render_state *rstate =
render_pass_info->rstate;
const struct pvr_render_state *rstate = render_pass_info->rstate;
const struct pvr_renderpass_hwsetup_eot_surface *surface =
&hw_render->eot_surfaces[i];
const struct pvr_image_view *iview =
@ -1736,7 +1733,8 @@ static VkResult pvr_sub_cmd_gfx_job_init(const struct pvr_device_info *dev_info,
job->view_state.rt_datasets = &render_target->rt_dataset[0];
if (cmd_buffer->state.current_sub_cmd->is_dynamic_render) {
result = pvr_render_targets_dataset_init(cmd_buffer->device, rstate, hw_render);
result =
pvr_render_targets_dataset_init(cmd_buffer->device, rstate, hw_render);
if (result != VK_SUCCESS) {
vk_command_buffer_set_error(&cmd_buffer->vk, result);
return result;
@ -1755,8 +1753,7 @@ static VkResult pvr_sub_cmd_gfx_job_init(const struct pvr_device_info *dev_info,
else
job->scissor_table_addr = PVR_DEV_ADDR_INVALID;
job->pixel_output_width =
pvr_get_pixel_output_width(hw_render, dev_info);
job->pixel_output_width = pvr_get_pixel_output_width(hw_render, dev_info);
/* Setup depth/stencil job information. */
if (hw_render->ds_attach_idx != VK_ATTACHMENT_UNUSED) {
@ -2394,7 +2391,7 @@ VkResult pvr_cmd_buffer_end_sub_cmd(struct pvr_cmd_buffer *cmd_buffer)
const bool secondary_cont =
cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY &&
cmd_buffer->usage_flags &
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT;
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT;
query_indices_size =
util_dynarray_num_elements(&state->query_indices, char);
@ -2717,11 +2714,12 @@ VkResult pvr_cmd_buffer_start_sub_cmd(struct pvr_cmd_buffer *cmd_buffer,
sub_cmd->gfx.hw_render_idx = 0;
sub_cmd->gfx.dr_info = state->render_pass_info.dr_info;
} else {
sub_cmd->gfx.hw_render_idx = state->render_pass_info.current_hw_subpass;
sub_cmd->gfx.hw_render_idx =
state->render_pass_info.current_hw_subpass;
sub_cmd->gfx.multiview_enabled =
state->render_pass_info.pass
? state->render_pass_info.pass->multiview_enabled
: false;
? state->render_pass_info.pass->multiview_enabled
: false;
}
if (state->vis_test_enabled)
@ -3101,8 +3099,7 @@ void pvr_CmdPushConstants2KHR(VkCommandBuffer commandBuffer,
}
}
static void
pvr_cmd_buffer_attachments_free(struct pvr_cmd_buffer *cmd_buffer)
static void pvr_cmd_buffer_attachments_free(struct pvr_cmd_buffer *cmd_buffer)
{
struct pvr_cmd_buffer_state *state = &cmd_buffer->state;
@ -3116,9 +3113,9 @@ pvr_cmd_buffer_attachments_free(struct pvr_cmd_buffer *cmd_buffer)
state->render_pass_info.attachments = NULL;
}
static VkResult pvr_cmd_buffer_attachments_alloc(
struct pvr_cmd_buffer *cmd_buffer,
uint32_t attachment_count)
static VkResult
pvr_cmd_buffer_attachments_alloc(struct pvr_cmd_buffer *cmd_buffer,
uint32_t attachment_count)
{
struct pvr_cmd_buffer_state *state = &cmd_buffer->state;
struct pvr_render_pass_info *info = &state->render_pass_info;
@ -3134,11 +3131,10 @@ static VkResult pvr_cmd_buffer_attachments_alloc(
const size_t size = attachment_count * sizeof(*info->attachments);
info->attachments =
vk_zalloc(&cmd_buffer->vk.pool->alloc,
size,
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
info->attachments = vk_zalloc(&cmd_buffer->vk.pool->alloc,
size,
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!info->attachments) {
return vk_command_buffer_set_error(&cmd_buffer->vk,
VK_ERROR_OUT_OF_HOST_MEMORY);
@ -3163,7 +3159,8 @@ static VkResult pvr_cmd_buffer_attachments_setup(
if (!pImageless)
assert(pass->attachment_count == framebuffer->attachment_count);
result = pvr_cmd_buffer_attachments_alloc(cmd_buffer, pass->attachment_count);
result =
pvr_cmd_buffer_attachments_alloc(cmd_buffer, pass->attachment_count);
if (result != VK_SUCCESS)
return result;
@ -3263,13 +3260,13 @@ pvr_get_hw_subpass(const struct pvr_render_pass *pass, const uint32_t subpass)
return &pass->hw_setup->renders[map->render].subpasses[map->subpass];
}
static void pvr_perform_start_of_render_attachment_clear(
struct pvr_cmd_buffer *cmd_buffer,
uint32_t layers,
uint32_t index,
bool is_depth_stencil,
uint32_t *index_list_clear_mask,
bool resume_render)
static void
pvr_perform_start_of_render_attachment_clear(struct pvr_cmd_buffer *cmd_buffer,
uint32_t layers,
uint32_t index,
bool is_depth_stencil,
uint32_t *index_list_clear_mask,
bool resume_render)
{
ASSERTED static const VkImageAspectFlags dsc_aspect_flags =
VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT |
@ -3277,8 +3274,8 @@ static void pvr_perform_start_of_render_attachment_clear(
struct pvr_render_pass_info *info = &cmd_buffer->state.render_pass_info;
const struct pvr_render_pass *pass = info->pass;
const struct pvr_renderpass_hwsetup *hw_setup = pass ? pass->hw_setup : NULL;
const uint32_t hw_render_idx = hw_setup ?
hw_setup->subpass_map[info->subpass_idx].render : 0;
const uint32_t hw_render_idx =
hw_setup ? hw_setup->subpass_map[info->subpass_idx].render : 0;
const struct pvr_renderpass_hwsetup_render *hw_render =
pvr_pass_info_get_hw_render(info, hw_render_idx);
VkImageAspectFlags image_aspect;
@ -3433,7 +3430,8 @@ static void pvr_stash_depth_format(struct pvr_cmd_buffer_state *state,
struct pvr_sub_cmd_gfx *const sub_cmd)
{
const struct pvr_renderpass_hwsetup_render *hw_render =
pvr_pass_info_get_hw_render(&state->render_pass_info, sub_cmd->hw_render_idx);
pvr_pass_info_get_hw_render(&state->render_pass_info,
sub_cmd->hw_render_idx);
if (hw_render->ds_attach_idx != VK_ATTACHMENT_UNUSED) {
struct pvr_image_view **iviews = state->render_pass_info.attachments;
@ -3468,8 +3466,7 @@ static bool pvr_loadops_contain_clear(struct pvr_renderpass_hwsetup *hw_setup)
return false;
}
static void
pvr_cmd_buffer_clear_values_free(struct pvr_cmd_buffer *cmd_buffer)
static void pvr_cmd_buffer_clear_values_free(struct pvr_cmd_buffer *cmd_buffer)
{
struct pvr_cmd_buffer_state *state = &cmd_buffer->state;
@ -3498,8 +3495,8 @@ pvr_cmd_buffer_clear_values_alloc(struct pvr_cmd_buffer *cmd_buffer,
return VK_SUCCESS;
}
const size_t size = clear_value_count *
sizeof(*state->render_pass_info.clear_values);
const size_t size =
clear_value_count * sizeof(*state->render_pass_info.clear_values);
state->render_pass_info.clear_values =
vk_zalloc(&cmd_buffer->vk.pool->alloc,
@ -3520,11 +3517,12 @@ pvr_cmd_buffer_set_clear_values(struct pvr_cmd_buffer *cmd_buffer,
{
struct pvr_cmd_buffer_state *state = &cmd_buffer->state;
const size_t size = pRenderPassBegin->clearValueCount *
sizeof(*state->render_pass_info.clear_values);
sizeof(*state->render_pass_info.clear_values);
VkResult result;
result = pvr_cmd_buffer_clear_values_alloc(cmd_buffer,
pRenderPassBegin->clearValueCount);
result =
pvr_cmd_buffer_clear_values_alloc(cmd_buffer,
pRenderPassBegin->clearValueCount);
if (result != VK_SUCCESS)
return result;
@ -3764,7 +3762,8 @@ pvr_resolve_unemitted_resolve_attachments(struct pvr_cmd_buffer *cmd_buffer,
{
struct pvr_cmd_buffer_state *state = &cmd_buffer->state;
const struct pvr_renderpass_hwsetup_render *hw_render =
pvr_pass_info_get_hw_render(&state->render_pass_info, info->current_hw_subpass);
pvr_pass_info_get_hw_render(&state->render_pass_info,
info->current_hw_subpass);
for (uint32_t i = 0U; i < hw_render->eot_surface_count; i++) {
const struct pvr_renderpass_hwsetup_eot_surface *surface =
@ -3845,9 +3844,9 @@ pvr_resolve_unemitted_resolve_attachments(struct pvr_cmd_buffer *cmd_buffer,
if (both_stencil && !hw_render->stencil_resolve_mode &&
resolve_attachment.stencil_store_op ==
VK_ATTACHMENT_STORE_OP_STORE &&
VK_ATTACHMENT_STORE_OP_STORE &&
resolve_attachment.stencil_load_op ==
VK_ATTACHMENT_LOAD_OP_CLEAR) {
VK_ATTACHMENT_LOAD_OP_CLEAR) {
clear_values.stencil = resolve_clear_values->depthStencil.stencil;
clear_stencil = true;
}
@ -3920,8 +3919,8 @@ void pvr_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
const VkSubpassBeginInfo *pSubpassBeginInfo)
{
VK_FROM_HANDLE(pvr_framebuffer,
framebuffer,
pRenderPassBeginInfo->framebuffer);
framebuffer,
pRenderPassBeginInfo->framebuffer);
VK_FROM_HANDLE(pvr_render_pass, pass, pRenderPassBeginInfo->renderPass);
VK_FROM_HANDLE(pvr_cmd_buffer, cmd_buffer, commandBuffer);
const struct pvr_renderpass_hwsetup_subpass *hw_subpass;
@ -3953,7 +3952,8 @@ void pvr_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
if (result != VK_SUCCESS)
return;
result = pvr_render_targets_init_for_render(cmd_buffer->device, pass, framebuffer);
result =
pvr_render_targets_init_for_render(cmd_buffer->device, pass, framebuffer);
if (result != VK_SUCCESS) {
pvr_cmd_buffer_set_error_unwarned(cmd_buffer, result);
return;
@ -3988,8 +3988,9 @@ void pvr_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
&cmd_buffer->state.current_sub_cmd->gfx);
}
static inline uint32_t pvr_get_ds_component_bits(const VkFormat vk_format,
const VkImageAspectFlags ds_aspect)
static inline uint32_t
pvr_get_ds_component_bits(const VkFormat vk_format,
const VkImageAspectFlags ds_aspect)
{
uint32_t component;
@ -4007,11 +4008,11 @@ static inline uint32_t pvr_get_ds_component_bits(const VkFormat vk_format,
component);
}
static inline bool pvr_can_pbe_resolve_ds_attachment(
const struct pvr_device_info *dev_info,
VkFormat vk_format,
uint32_t sample_count,
VkResolveModeFlagBits resolve_mode)
static inline bool
pvr_can_pbe_resolve_ds_attachment(const struct pvr_device_info *dev_info,
VkFormat vk_format,
uint32_t sample_count,
VkResolveModeFlagBits resolve_mode)
{
if (!PVR_HAS_FEATURE(dev_info, gs_rta_support))
return false;
@ -4025,12 +4026,12 @@ static inline bool pvr_can_pbe_resolve_ds_attachment(
return pvr_format_is_pbe_downscalable(dev_info, vk_format);
}
static inline VkResult pvr_mrt_setup_partial_init(
struct pvr_device *const device,
struct usc_mrt_setup *mrt_setup,
uint32_t num_renger_targets,
uint32_t num_output_regs,
uint32_t num_tile_buffers)
static inline VkResult
pvr_mrt_setup_partial_init(struct pvr_device *const device,
struct usc_mrt_setup *mrt_setup,
uint32_t num_renger_targets,
uint32_t num_output_regs,
uint32_t num_tile_buffers)
{
struct usc_mrt_resource *mrt_resources = NULL;
@ -4064,7 +4065,8 @@ static void pvr_dynamic_rendering_output_attachments_cleanup(
if (!dr_info)
return;
pvr_mrt_load_op_state_cleanup(device, allocator,
pvr_mrt_load_op_state_cleanup(device,
allocator,
dr_info->hw_render.load_op_state);
pvr_destroy_mrt_setup(device, &dr_info->hw_render.eot_setup);
@ -4095,8 +4097,8 @@ static VkResult pvr_dynamic_rendering_output_attachments_setup(
dr_info->color_attachment_count = pRenderingInfo->colorAttachmentCount;
if (dr_info->color_attachment_count) {
const uint32_t size = sizeof(*dr_info->color_attachments) *
dr_info->color_attachment_count;
const uint32_t size =
sizeof(*dr_info->color_attachments) * dr_info->color_attachment_count;
dr_info->color_attachments = vk_zalloc(&device->vk.alloc,
size,
@ -4190,12 +4192,12 @@ static VkResult pvr_dynamic_rendering_output_attachments_setup(
resolve_attach->sample_count = image->vk.samples;
resolve_attach->index = resolve_attach_idx;
resolve_attach->vk_format = resolve_iview->vk.view_format;
resolve_attach->load_op =
resolve_attach->stencil_load_op = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
resolve_attach->store_op =
resolve_attach->stencil_store_op = VK_ATTACHMENT_STORE_OP_DONT_CARE;
resolve_attach->resolve_mode =
resolve_attach->stencil_resolve_mode = VK_RESOLVE_MODE_NONE;
resolve_attach->load_op = resolve_attach->stencil_load_op =
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
resolve_attach->store_op = resolve_attach->stencil_store_op =
VK_ATTACHMENT_STORE_OP_DONT_CARE;
resolve_attach->resolve_mode = resolve_attach->stencil_resolve_mode =
VK_RESOLVE_MODE_NONE;
resolve_attach->resolve_target = VK_ATTACHMENT_UNUSED;
/* If resolving with a tranfer, then always store the source */
@ -4233,12 +4235,13 @@ static VkResult pvr_dynamic_rendering_output_attachments_setup(
if (dr_info->hw_render.color_init_count) {
const uint32_t size = dr_info->hw_render.color_init_count *
sizeof(*dr_info->hw_render.color_init);
sizeof(*dr_info->hw_render.color_init);
dr_info->hw_render.color_init = vk_zalloc(&device->vk.alloc,
size,
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
dr_info->hw_render.color_init =
vk_zalloc(&device->vk.alloc,
size,
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!dr_info->hw_render.color_init) {
result = vk_command_buffer_set_error(&cmd_buffer->vk,
VK_ERROR_OUT_OF_HOST_MEMORY);
@ -4248,12 +4251,13 @@ static VkResult pvr_dynamic_rendering_output_attachments_setup(
if (dr_info->hw_render.eot_surface_count) {
const uint32_t size = dr_info->hw_render.eot_surface_count *
sizeof(*dr_info->hw_render.eot_surfaces);
sizeof(*dr_info->hw_render.eot_surfaces);
dr_info->hw_render.eot_surfaces = vk_zalloc(&device->vk.alloc,
size,
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
dr_info->hw_render.eot_surfaces =
vk_zalloc(&device->vk.alloc,
size,
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!dr_info->hw_render.eot_surfaces) {
result = vk_command_buffer_set_error(&cmd_buffer->vk,
VK_ERROR_OUT_OF_HOST_MEMORY);
@ -4350,7 +4354,8 @@ static VkResult pvr_dynamic_rendering_output_attachments_setup(
if (attachment->resolve_mode) {
struct pvr_renderpass_hwsetup_eot_surface *surface =
&dr_info->hw_render.eot_surfaces[eot_surface_idx]; /* next surface */
&dr_info->hw_render.eot_surfaces[eot_surface_idx]; /* next surface
*/
surface->src_attachment_idx = i;
surface->mrt_idx = eot_mrt_idx;
@ -4434,10 +4439,9 @@ pvr_dynamic_render_info_destroy(const struct pvr_device *device,
struct pvr_cmd_buffer *cmd_buffer,
struct pvr_dynamic_render_info *dr_info)
{
pvr_dynamic_rendering_output_attachments_cleanup(
device,
&device->vk.alloc,
dr_info);
pvr_dynamic_rendering_output_attachments_cleanup(device,
&device->vk.alloc,
dr_info);
pvr_cmd_buffer_clear_values_free(cmd_buffer);
pvr_cmd_buffer_attachments_free(cmd_buffer);
@ -4461,12 +4465,10 @@ pvr_dynamic_render_info_create(struct pvr_cmd_buffer *cmd_buffer,
pRenderingInfo->pDepthAttachment &&
pRenderingInfo->pDepthAttachment->resolveMode &&
pRenderingInfo->pDepthAttachment->resolveImageView;
const bool has_stencil_iview =
pRenderingInfo->pStencilAttachment &&
pRenderingInfo->pStencilAttachment->imageView;
const bool has_depth_iview =
pRenderingInfo->pDepthAttachment &&
pRenderingInfo->pDepthAttachment->imageView;
const bool has_stencil_iview = pRenderingInfo->pStencilAttachment &&
pRenderingInfo->pStencilAttachment->imageView;
const bool has_depth_iview = pRenderingInfo->pDepthAttachment &&
pRenderingInfo->pDepthAttachment->imageView;
struct pvr_cmd_buffer_state *state = &cmd_buffer->state;
struct pvr_device *device = cmd_buffer->device;
struct pvr_dynamic_render_info *dr_info;
@ -4497,10 +4499,13 @@ pvr_dynamic_render_info_create(struct pvr_cmd_buffer *cmd_buffer,
}
dr_info->attachment_count += has_depth_iview || has_stencil_iview;
dr_info->attachment_count += has_depth_resolve_iview || has_stencil_resolve_iview;
dr_info->attachment_count += has_depth_resolve_iview ||
has_stencil_resolve_iview;
dr_info->mrt_setup = mrt_setup;
rstate = vk_zalloc(&device->vk.alloc, sizeof(*rstate), 8,
rstate = vk_zalloc(&device->vk.alloc,
sizeof(*rstate),
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!rstate) {
result = vk_command_buffer_set_error(&cmd_buffer->vk,
@ -4529,14 +4534,16 @@ pvr_dynamic_render_info_create(struct pvr_cmd_buffer *cmd_buffer,
goto err_free_rstate;
}
result = pvr_cmd_buffer_attachments_alloc(cmd_buffer, dr_info->attachment_count);
result = pvr_cmd_buffer_attachments_alloc(cmd_buffer,
dr_info->attachment_count);
if (result != VK_SUCCESS) {
result = vk_command_buffer_set_error(&cmd_buffer->vk, result);
goto err_free_dr_info_attachments;
}
result = pvr_cmd_buffer_clear_values_alloc(cmd_buffer, dr_info->attachment_count);
if (result != VK_SUCCESS){
result = pvr_cmd_buffer_clear_values_alloc(cmd_buffer,
dr_info->attachment_count);
if (result != VK_SUCCESS) {
result = vk_command_buffer_set_error(&cmd_buffer->vk, result);
goto err_free_cmd_buffer_attachments;
}
@ -4556,7 +4563,8 @@ pvr_dynamic_render_info_create(struct pvr_cmd_buffer *cmd_buffer,
};
if (has_depth_iview || has_stencil_iview) {
struct pvr_render_pass_attachment *ds_attach = &dr_info->attachments[attach_idx];
struct pvr_render_pass_attachment *ds_attach =
&dr_info->attachments[attach_idx];
VkClearDepthStencilValue *clear_value;
const struct pvr_image *image;
struct pvr_image_view *iview;
@ -4571,7 +4579,8 @@ pvr_dynamic_render_info_create(struct pvr_cmd_buffer *cmd_buffer,
ds_attach->is_depth = true;
ds_attach->load_op = pRenderingInfo->pDepthAttachment->loadOp;
ds_attach->store_op = pRenderingInfo->pDepthAttachment->storeOp;
ds_attach->resolve_mode = pRenderingInfo->pDepthAttachment->resolveMode;
ds_attach->resolve_mode =
pRenderingInfo->pDepthAttachment->resolveMode;
}
ds_attach->stencil_load_op = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
@ -4580,9 +4589,12 @@ pvr_dynamic_render_info_create(struct pvr_cmd_buffer *cmd_buffer,
iview = pvr_image_view_from_handle(
pRenderingInfo->pStencilAttachment->imageView);
ds_attach->is_stencil = true;
ds_attach->stencil_load_op = pRenderingInfo->pStencilAttachment->loadOp;
ds_attach->stencil_store_op = pRenderingInfo->pStencilAttachment->storeOp;
ds_attach->stencil_resolve_mode = pRenderingInfo->pStencilAttachment->resolveMode;
ds_attach->stencil_load_op =
pRenderingInfo->pStencilAttachment->loadOp;
ds_attach->stencil_store_op =
pRenderingInfo->pStencilAttachment->storeOp;
ds_attach->stencil_resolve_mode =
pRenderingInfo->pStencilAttachment->resolveMode;
}
image = pvr_image_view_get_image(iview);
@ -4599,18 +4611,19 @@ pvr_dynamic_render_info_create(struct pvr_cmd_buffer *cmd_buffer,
dr_info->hw_render.ds_attach_idx = attach_idx;
dr_info->hw_render.depth_init = ds_attach->load_op;
dr_info->hw_render.depth_store =
ds_attach->store_op == VK_ATTACHMENT_STORE_OP_STORE;
dr_info->hw_render.depth_store = ds_attach->store_op ==
VK_ATTACHMENT_STORE_OP_STORE;
dr_info->hw_render.depth_resolve_mode = ds_attach->resolve_mode;
dr_info->hw_render.stencil_init = ds_attach->stencil_load_op;
dr_info->hw_render.stencil_store =
ds_attach->stencil_store_op == VK_ATTACHMENT_STORE_OP_STORE;
dr_info->hw_render.stencil_store = ds_attach->stencil_store_op ==
VK_ATTACHMENT_STORE_OP_STORE;
dr_info->hw_render.sample_count =
MAX2(dr_info->hw_render.sample_count, ds_attach->sample_count);
dr_info->hw_render.stencil_resolve_mode = ds_attach->stencil_resolve_mode;
clear_value = &state->render_pass_info.clear_values[attach_idx].depthStencil;
clear_value =
&state->render_pass_info.clear_values[attach_idx].depthStencil;
if (ds_attach->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
clear_value->depth =
@ -4676,12 +4689,14 @@ pvr_dynamic_render_info_create(struct pvr_cmd_buffer *cmd_buffer,
}
if (state->render_pass_info.rstate->height == UINT32_MAX) {
state->render_pass_info.rstate->height = pRenderingInfo->renderArea.offset.y +
state->render_pass_info.rstate->height =
pRenderingInfo->renderArea.offset.y +
pRenderingInfo->renderArea.extent.height;
}
if (state->render_pass_info.rstate->width == UINT32_MAX) {
state->render_pass_info.rstate->width = pRenderingInfo->renderArea.offset.x +
state->render_pass_info.rstate->width =
pRenderingInfo->renderArea.offset.x +
pRenderingInfo->renderArea.extent.width;
}
@ -4712,9 +4727,9 @@ err_free_dr_info:
return result;
}
static inline uint64_t
pvr_render_pass_info_get_scratch_buffer_size(struct pvr_device *device,
const struct pvr_render_pass_info *info)
static inline uint64_t pvr_render_pass_info_get_scratch_buffer_size(
struct pvr_device *device,
const struct pvr_render_pass_info *info)
{
return pvr_spm_scratch_buffer_calc_required_size(
&info->dr_info->hw_render,
@ -4751,7 +4766,8 @@ void pvr_CmdBeginRendering(VkCommandBuffer commandBuffer,
return;
}
result = pvr_dynamic_render_info_create(cmd_buffer, pRenderingInfo, &dr_info);
result =
pvr_dynamic_render_info_create(cmd_buffer, pRenderingInfo, &dr_info);
if (result != VK_SUCCESS) {
vk_command_buffer_set_error(&cmd_buffer->vk, result);
return;
@ -4761,12 +4777,14 @@ void pvr_CmdBeginRendering(VkCommandBuffer commandBuffer,
state->render_pass_info.hw_render = &dr_info->hw_render;
state->render_pass_info.render_area = (VkRect2D){
.extent = pRenderingInfo->renderArea.extent,
.offset = (VkOffset2D){
.x = MAX2(0, pRenderingInfo->renderArea.offset.x),
.y = MAX2(0, pRenderingInfo->renderArea.offset.y),
},
.offset =
(VkOffset2D){
.x = MAX2(0, pRenderingInfo->renderArea.offset.x),
.y = MAX2(0, pRenderingInfo->renderArea.offset.y),
},
};
state->render_pass_info.pipeline_bind_point = VK_PIPELINE_BIND_POINT_GRAPHICS;
state->render_pass_info.pipeline_bind_point =
VK_PIPELINE_BIND_POINT_GRAPHICS;
state->render_pass_info.dynamic_render = true;
state->render_pass_info.suspend = suspend;
state->render_pass_info.resume = resume;
@ -4785,7 +4803,7 @@ void pvr_CmdBeginRendering(VkCommandBuffer commandBuffer,
if (pRenderingInfo->pDepthAttachment &&
pRenderingInfo->pDepthAttachment->imageView) {
struct pvr_image_view *iview = pvr_image_view_from_handle(
pRenderingInfo->pDepthAttachment->imageView);
pRenderingInfo->pDepthAttachment->imageView);
state->depth_format = iview->vk.format;
} else if (pRenderingInfo->pStencilAttachment &&
pRenderingInfo->pStencilAttachment->imageView) {
@ -4860,8 +4878,7 @@ void pvr_CmdEndRendering(VkCommandBuffer commandBuffer)
struct pvr_cmd_buffer_state *state = &cmd_buffer->state;
VkResult result;
if (state->current_sub_cmd &&
state->current_sub_cmd->is_suspend) {
if (state->current_sub_cmd && state->current_sub_cmd->is_suspend) {
return;
}
@ -4871,9 +4888,8 @@ void pvr_CmdEndRendering(VkCommandBuffer commandBuffer)
goto exit_teardown_render;
}
result =
pvr_resolve_unemitted_resolve_attachments(cmd_buffer,
&state->render_pass_info);
result = pvr_resolve_unemitted_resolve_attachments(cmd_buffer,
&state->render_pass_info);
if (result != VK_SUCCESS) {
vk_command_buffer_set_error(&cmd_buffer->vk, result);
goto exit_teardown_render;
@ -4889,10 +4905,10 @@ static void pvr_cmd_buffer_state_from_dynamic_inheritance(
struct pvr_cmd_buffer *cmd_buffer,
const VkCommandBufferInheritanceRenderingInfo *inheritance_info)
{
const bool has_stencil =
inheritance_info->stencilAttachmentFormat != VK_FORMAT_UNDEFINED;
const bool has_depth =
inheritance_info->depthAttachmentFormat != VK_FORMAT_UNDEFINED;
const bool has_stencil = inheritance_info->stencilAttachmentFormat !=
VK_FORMAT_UNDEFINED;
const bool has_depth = inheritance_info->depthAttachmentFormat !=
VK_FORMAT_UNDEFINED;
VkFormat attachment_formats[inheritance_info->colorAttachmentCount];
uint32_t mrt_attachment_map[inheritance_info->colorAttachmentCount];
struct pvr_device *const device = cmd_buffer->device;
@ -4907,8 +4923,7 @@ static void pvr_cmd_buffer_state_from_dynamic_inheritance(
if (!vk_multialloc_zalloc(&ma,
&device->vk.alloc,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)) {
vk_command_buffer_set_error(&cmd_buffer->vk,
VK_ERROR_OUT_OF_HOST_MEMORY);
vk_command_buffer_set_error(&cmd_buffer->vk, VK_ERROR_OUT_OF_HOST_MEMORY);
}
dr_info->hw_render.sample_count = inheritance_info->rasterizationSamples;
@ -4922,11 +4937,11 @@ static void pvr_cmd_buffer_state_from_dynamic_inheritance(
dr_info->attachment_count++;
if (dr_info->attachment_count) {
dr_info->attachments = vk_zalloc(
&cmd_buffer->vk.pool->alloc,
sizeof(*dr_info->attachments) * dr_info->attachment_count,
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
dr_info->attachments =
vk_zalloc(&cmd_buffer->vk.pool->alloc,
sizeof(*dr_info->attachments) * dr_info->attachment_count,
8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!dr_info->attachments) {
vk_command_buffer_set_error(&cmd_buffer->vk,
VK_ERROR_OUT_OF_HOST_MEMORY);
@ -4951,7 +4966,7 @@ static void pvr_cmd_buffer_state_from_dynamic_inheritance(
assert(inheritance_info->stencilAttachmentFormat == VK_FORMAT_UNDEFINED ||
inheritance_info->depthAttachmentFormat == VK_FORMAT_UNDEFINED ||
inheritance_info->depthAttachmentFormat ==
inheritance_info->stencilAttachmentFormat);
inheritance_info->stencilAttachmentFormat);
dr_info->hw_render.ds_attach_idx = VK_ATTACHMENT_UNUSED;
@ -4959,8 +4974,8 @@ static void pvr_cmd_buffer_state_from_dynamic_inheritance(
struct pvr_render_pass_attachment *ds_attachment =
&dr_info->attachments[attach_idx];
const VkFormat vk_format = has_depth
? inheritance_info->depthAttachmentFormat
: inheritance_info->stencilAttachmentFormat;
? inheritance_info->depthAttachmentFormat
: inheritance_info->stencilAttachmentFormat;
dr_info->hw_render.ds_attach_idx = attach_idx;
dr_info->hw_render.stencil_store = has_stencil;
@ -5057,7 +5072,8 @@ static void pvr_cmd_buffer_state_from_dynamic_inheritance(
/* For setting the depth_format, first check stencil and then override */
if (has_stencil)
cmd_buffer->state.depth_format = inheritance_info->stencilAttachmentFormat;
cmd_buffer->state.depth_format =
inheritance_info->stencilAttachmentFormat;
if (has_depth)
cmd_buffer->state.depth_format = inheritance_info->depthAttachmentFormat;
@ -5119,14 +5135,12 @@ VkResult pvr_BeginCommandBuffer(VkCommandBuffer commandBuffer,
if (cmd_buffer->usage_flags &
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) {
const VkCommandBufferInheritanceRenderingInfo *dyn_inheritance_info =
vk_find_struct_const(
pBeginInfo->pInheritanceInfo->pNext,
COMMAND_BUFFER_INHERITANCE_RENDERING_INFO);
vk_find_struct_const(pBeginInfo->pInheritanceInfo->pNext,
COMMAND_BUFFER_INHERITANCE_RENDERING_INFO);
if (!pBeginInfo->pInheritanceInfo->renderPass) {
assert(dyn_inheritance_info);
pvr_cmd_buffer_state_from_dynamic_inheritance(
cmd_buffer,
dyn_inheritance_info);
pvr_cmd_buffer_state_from_dynamic_inheritance(cmd_buffer,
dyn_inheritance_info);
} else {
pvr_cmd_buffer_state_from_render_pass_inheritance(
state,
@ -5624,8 +5638,7 @@ static VkResult pvr_setup_descriptor_mappings(
pvr_csb_pack (&point_sampler_words[1],
TEXSTATE_SAMPLER_WORD1,
sampler) {
}
sampler) {}
struct pvr_suballoc_bo *point_sampler_bo;
result = pvr_cmd_buffer_upload_general(cmd_buffer,
@ -5660,8 +5673,7 @@ static VkResult pvr_setup_descriptor_mappings(
pvr_csb_pack (&ia_sampler_words[1],
TEXSTATE_SAMPLER_WORD1,
sampler) {
}
sampler) {}
struct pvr_suballoc_bo *ia_sampler_bo;
result = pvr_cmd_buffer_upload_general(cmd_buffer,
@ -9336,7 +9348,8 @@ static bool pvr_is_stencil_store_load_needed(
return false;
hw_render_idx = state->current_sub_cmd->gfx.hw_render_idx;
hw_render = pvr_pass_info_get_hw_render(&state->render_pass_info, hw_render_idx);
hw_render =
pvr_pass_info_get_hw_render(&state->render_pass_info, hw_render_idx);
if (hw_render->ds_attach_idx == VK_ATTACHMENT_UNUSED)
return false;
@ -9428,8 +9441,7 @@ pvr_cmd_buffer_insert_mid_frag_barrier_event(struct pvr_cmd_buffer *cmd_buffer,
cmd_buffer->state.current_sub_cmd->is_dynamic_render =
prev_sub_cmd->is_dynamic_render;
cmd_buffer->state.current_sub_cmd->is_suspend =
prev_sub_cmd->is_suspend;
cmd_buffer->state.current_sub_cmd->is_suspend = prev_sub_cmd->is_suspend;
return VK_SUCCESS;
}

View file

@ -274,9 +274,9 @@ struct pvr_sub_cmd {
enum pvr_sub_cmd_type type;
struct {
/* True if the sub_cmd is owned by this command buffer. False if taken from
* a secondary command buffer, in that case we are not supposed to free any
* resources associated with the sub_cmd.
/* True if the sub_cmd is owned by this command buffer. False if taken
* from a secondary command buffer, in that case we are not supposed to
* free any resources associated with the sub_cmd.
*/
bool owned : 1;
bool is_dynamic_render : 1;

View file

@ -400,9 +400,8 @@ write_sampler(const struct pvr_descriptor_set *set,
const struct pvr_descriptor_set_layout_binding *binding,
uint32_t elem);
static void
write_immutable_samplers(struct pvr_descriptor_set_layout *layout,
struct pvr_descriptor_set *set)
static void write_immutable_samplers(struct pvr_descriptor_set_layout *layout,
struct pvr_descriptor_set *set)
{
for (unsigned u = 0; u < layout->binding_count; ++u) {
const struct pvr_descriptor_set_layout_binding *binding =

View file

@ -749,8 +749,7 @@ pvr_get_tile_buffer_size_per_core(const struct pvr_device *device)
/**
* Gets the amount of memory to allocate for a tile buffer on the current BVNC.
*/
static uint32_t
pvr_get_tile_buffer_size(const struct pvr_device *device)
static uint32_t pvr_get_tile_buffer_size(const struct pvr_device *device)
{
/* On a multicore system duplicate the buffer for each core. */
/* TODO: Optimise tile buffer size to use core_count, not max_num_cores. */
@ -828,11 +827,10 @@ static void pvr_device_init_default_sampler_state(struct pvr_device *device)
}
}
VkResult
pvr_create_device(struct pvr_physical_device *pdevice,
const VkDeviceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDevice *pDevice)
VkResult pvr_create_device(struct pvr_physical_device *pdevice,
const VkDeviceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDevice *pDevice)
{
uint32_t initial_free_list_size = PVR_GLOBAL_FREE_LIST_INITIAL_SIZE;
struct pvr_instance *instance = pdevice->instance;
@ -1091,9 +1089,8 @@ void pvr_rstate_entry_remove(struct pvr_device *device,
simple_mtx_unlock(&device->rs_mtx);
}
void
pvr_destroy_device(struct pvr_device *device,
const VkAllocationCallbacks *pAllocator)
void pvr_destroy_device(struct pvr_device *device,
const VkAllocationCallbacks *pAllocator)
{
if (!device)
return;
@ -1968,8 +1965,7 @@ void pvr_render_state_cleanup(struct pvr_device *device,
pvr_spm_finish_bgobj_state(device,
&rstate->spm_bgobj_state_per_render[i]);
pvr_spm_finish_eot_state(device,
&rstate->spm_eot_state_per_render[i]);
pvr_spm_finish_eot_state(device, &rstate->spm_eot_state_per_render[i]);
}
pvr_spm_scratch_buffer_release(device, rstate->scratch_buffer);
@ -1979,12 +1975,12 @@ void pvr_render_state_cleanup(struct pvr_device *device,
vk_free(&device->vk.alloc, rstate->render_targets);
}
VkResult pvr_render_state_setup(
struct pvr_device *device,
const VkAllocationCallbacks *pAllocator,
struct pvr_render_state *rstate,
uint32_t render_count,
const struct pvr_renderpass_hwsetup_render *renders)
VkResult
pvr_render_state_setup(struct pvr_device *device,
const VkAllocationCallbacks *pAllocator,
struct pvr_render_state *rstate,
uint32_t render_count,
const struct pvr_renderpass_hwsetup_render *renders)
{
struct pvr_spm_bgobj_state *spm_bgobj_state_per_render;
struct pvr_spm_eot_state *spm_eot_state_per_render;
@ -2018,8 +2014,7 @@ VkResult pvr_render_state_setup(
rstate->render_targets = render_targets;
rstate->render_targets_count = render_targets_count;
if (!pvr_render_targets_init(rstate->render_targets,
render_targets_count)) {
if (!pvr_render_targets_init(rstate->render_targets, render_targets_count)) {
result = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
goto err_free_render_targets;
}
@ -2140,9 +2135,7 @@ VkResult pvr_CreateFramebuffer(VkDevice _device,
rstate->height = pCreateInfo->height;
rstate->layers = pCreateInfo->layers;
rstate->scratch_buffer_size =
pvr_render_pass_get_scratch_buffer_size(device,
pass,
rstate);
pvr_render_pass_get_scratch_buffer_size(device, pass, rstate);
result = pvr_render_state_setup(device,
pAllocator,

View file

@ -164,15 +164,13 @@ static inline struct pvr_device *vk_to_pvr_device(struct vk_device *device)
return container_of(device, struct pvr_device, vk);
}
VkResult
pvr_create_device(struct pvr_physical_device *pdevice,
const VkDeviceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDevice *pDevice);
VkResult pvr_create_device(struct pvr_physical_device *pdevice,
const VkDeviceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDevice *pDevice);
void
pvr_destroy_device(struct pvr_device *device,
const VkAllocationCallbacks *pAllocator);
void pvr_destroy_device(struct pvr_device *device,
const VkAllocationCallbacks *pAllocator);
uint32_t pvr_calc_fscommon_size_and_tiles_in_flight(
const struct pvr_device_info *dev_info,

View file

@ -65,11 +65,12 @@ struct pvr_framebuffer {
struct pvr_device;
struct pvr_renderpass_hwsetup_render;
VkResult pvr_render_state_setup(struct pvr_device *device,
const VkAllocationCallbacks *pAllocator,
struct pvr_render_state *rstate,
uint32_t render_count,
const struct pvr_renderpass_hwsetup_render *renders);
VkResult
pvr_render_state_setup(struct pvr_device *device,
const VkAllocationCallbacks *pAllocator,
struct pvr_render_state *rstate,
uint32_t render_count,
const struct pvr_renderpass_hwsetup_render *renders);
void pvr_render_state_cleanup(struct pvr_device *device,
const struct pvr_render_state *rstate);

View file

@ -64,9 +64,8 @@ static void pvr_image_init_memlayout(struct pvr_image *image)
}
}
static void
pvr_image_init_physical_extent(struct pvr_image *image,
unsigned pbe_stride_align)
static void pvr_image_init_physical_extent(struct pvr_image *image,
unsigned pbe_stride_align)
{
assert(image->memlayout != PVR_MEMLAYOUT_UNDEFINED);
@ -153,8 +152,7 @@ static void pvr_image_setup_mip_levels(struct pvr_image *image)
image->size = image->layer_size * image->vk.array_layers;
}
static unsigned
get_pbe_stride_align(const struct pvr_device_info *dev_info);
static unsigned get_pbe_stride_align(const struct pvr_device_info *dev_info);
VkResult pvr_CreateImage(VkDevice _device,
const VkImageCreateInfo *pCreateInfo,
@ -185,8 +183,7 @@ VkResult pvr_CreateImage(VkDevice _device,
*/
image->alignment = 4096U;
unsigned pbe_stride_align =
get_pbe_stride_align(&device->pdevice->dev_info);
unsigned pbe_stride_align = get_pbe_stride_align(&device->pdevice->dev_info);
/* Initialize the image using the saved information from pCreateInfo */
pvr_image_init_memlayout(image);
@ -586,9 +583,9 @@ void pvr_DestroyBufferView(VkDevice _device,
/* Leave this at the very end, to avoid leakage of HW-defs here */
#include "pvr_csb.h"
static unsigned
get_pbe_stride_align(const struct pvr_device_info *dev_info)
static unsigned get_pbe_stride_align(const struct pvr_device_info *dev_info)
{
return PVR_HAS_FEATURE(dev_info, pbe_stride_align_1pixel) ?
1 : ROGUE_PBESTATE_REG_WORD0_LINESTRIDE_UNIT_SIZE;
return PVR_HAS_FEATURE(dev_info, pbe_stride_align_1pixel)
? 1
: ROGUE_PBESTATE_REG_WORD0_LINESTRIDE_UNIT_SIZE;
}

View file

@ -518,7 +518,6 @@ static VkResult pvr_ctx_sr_programs_setup(struct pvr_device *device,
/* USC state update: SR state load. */
precomp_data = (pco_precomp_data *)pco_usclib_common[CS_LOAD_SR_256_COMMON];
if (target == PVR_CTX_SR_COMPUTE_TARGET && PVR_HAS_QUIRK(dev_info, 62269))
pvr_finishme("Missing support for brn62269");

View file

@ -54,10 +54,9 @@ static uint32_t pvr_get_accum_format_bitsize(VkFormat vk_format)
* Check if there is space in a buffer for storing a render target of a
* specified size.
*/
static int32_t
pvr_mrt_alloc_from_buffer(const struct pvr_device_info *dev_info,
struct pvr_mrt_alloc_mask *buffer,
uint32_t pixel_size)
static int32_t pvr_mrt_alloc_from_buffer(const struct pvr_device_info *dev_info,
struct pvr_mrt_alloc_mask *buffer,
uint32_t pixel_size)
{
const uint32_t max_out_regs = rogue_get_max_output_regs_per_pixel(dev_info);
uint32_t alignment = 1U;
@ -80,8 +79,7 @@ pvr_mrt_alloc_from_buffer(const struct pvr_device_info *dev_info,
return -1;
}
void
pvr_init_mrt_desc(VkFormat format, struct usc_mrt_desc *desc)
void pvr_init_mrt_desc(VkFormat format, struct usc_mrt_desc *desc)
{
uint32_t pixel_size_in_chunks;
uint32_t pixel_size_in_bits;
@ -141,8 +139,7 @@ static VkResult pvr_alloc_mrt(const struct pvr_device_info *dev_info,
unsigned tib = 0;
for (; tib < alloc->tile_buffers_count; tib++) {
struct pvr_mrt_alloc_mask *tib_alloc =
&alloc->tile_buffers[tib];
struct pvr_mrt_alloc_mask *tib_alloc = &alloc->tile_buffers[tib];
const int32_t tile_buffer_offset =
pvr_mrt_alloc_from_buffer(dev_info, tib_alloc, pixel_size);
@ -207,7 +204,8 @@ pvr_init_usc_mrt_setup(struct pvr_device *device,
setup->mrt_resources =
vk_alloc(&device->vk.alloc,
sizeof(*setup->mrt_resources) * attachment_count, 8U,
sizeof(*setup->mrt_resources) * attachment_count,
8U,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!setup->mrt_resources)
return vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY);
@ -232,9 +230,8 @@ fail:
return result;
}
void
pvr_destroy_mrt_setup(const struct pvr_device *device,
struct usc_mrt_setup *setup)
void pvr_destroy_mrt_setup(const struct pvr_device *device,
struct usc_mrt_setup *setup)
{
if (!setup)
return;
@ -331,10 +328,9 @@ static void pvr_load_op_destroy(struct pvr_device *device,
vk_free2(&device->vk.alloc, allocator, load_op);
}
void
pvr_mrt_load_op_state_cleanup(const struct pvr_device *device,
const VkAllocationCallbacks *alloc,
struct pvr_load_op_state *state)
void pvr_mrt_load_op_state_cleanup(const struct pvr_device *device,
const VkAllocationCallbacks *alloc,
struct pvr_load_op_state *state)
{
if (!state)
return;
@ -394,12 +390,11 @@ err_load_op_state_cleanup:
/* TODO: Can we gaurantee that if we have at least one render target there will
* be a render target allocated as a REG?
*/
static inline bool pvr_needs_output_register_writes(
const struct usc_mrt_setup *setup)
static inline bool
pvr_needs_output_register_writes(const struct usc_mrt_setup *setup)
{
for (uint32_t i = 0; i < setup->num_render_targets; i++) {
struct usc_mrt_resource *mrt_resource =
&setup->mrt_resources[i];
struct usc_mrt_resource *mrt_resource = &setup->mrt_resources[i];
if (mrt_resource->type == USC_MRT_RESOURCE_TYPE_OUTPUT_REG)
return true;
@ -408,9 +403,9 @@ static inline bool pvr_needs_output_register_writes(
return false;
}
static inline VkResult pvr_mrt_add_missing_output_register_write(
struct usc_mrt_setup *setup,
const VkAllocationCallbacks *alloc)
static inline VkResult
pvr_mrt_add_missing_output_register_write(struct usc_mrt_setup *setup,
const VkAllocationCallbacks *alloc)
{
const uint32_t last = setup->num_render_targets;
struct usc_mrt_resource *mrt_resources;
@ -420,12 +415,12 @@ static inline VkResult pvr_mrt_add_missing_output_register_write(
setup->num_render_targets++;
mrt_resources = vk_realloc(alloc,
setup->mrt_resources,
setup->num_render_targets *
sizeof(*mrt_resources),
8U,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
mrt_resources =
vk_realloc(alloc,
setup->mrt_resources,
setup->num_render_targets * sizeof(*mrt_resources),
8U,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!mrt_resources)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@ -469,8 +464,7 @@ VkResult pvr_mrt_load_ops_setup(struct pvr_cmd_buffer *cmd_buffer,
return VK_SUCCESS;
result =
pvr_mrt_add_missing_output_register_write(dr_info->mrt_setup,
alloc);
pvr_mrt_add_missing_output_register_write(dr_info->mrt_setup, alloc);
if (result != VK_SUCCESS)
return result;
@ -597,10 +591,9 @@ static VkResult pvr_pds_fragment_program_create_and_upload(
return VK_SUCCESS;
}
VkResult
pvr_load_op_shader_generate(struct pvr_device *device,
const VkAllocationCallbacks *allocator,
struct pvr_load_op *load_op)
VkResult pvr_load_op_shader_generate(struct pvr_device *device,
const VkAllocationCallbacks *allocator,
struct pvr_load_op *load_op)
{
const struct pvr_device_info *dev_info = &device->pdevice->dev_info;
const uint32_t cache_line_size = pvr_get_slc_cache_line_size(dev_info);
@ -658,4 +651,3 @@ err_free_usc_frag_prog_bo:
return result;
}

View file

@ -98,9 +98,8 @@ pvr_init_usc_mrt_setup(struct pvr_device *device,
const VkFormat attachment_formats[attachment_count],
struct usc_mrt_setup *setup);
void
pvr_destroy_mrt_setup(const struct pvr_device *device,
struct usc_mrt_setup *setup);
void pvr_destroy_mrt_setup(const struct pvr_device *device,
struct usc_mrt_setup *setup);
void pvr_init_mrt_desc(VkFormat format, struct usc_mrt_desc *desc);
@ -175,10 +174,9 @@ VkResult pvr_pds_unitex_state_program_create_and_upload(
uint32_t uniform_kicks,
struct pvr_pds_upload *const pds_upload_out);
VkResult pvr_load_op_shader_generate(
struct pvr_device *device,
const VkAllocationCallbacks *allocator,
struct pvr_load_op *load_op);
VkResult pvr_load_op_shader_generate(struct pvr_device *device,
const VkAllocationCallbacks *allocator,
struct pvr_load_op *load_op);
struct pvr_load_op_state {
uint32_t load_op_count;
@ -195,9 +193,8 @@ struct pvr_cmd_buffer;
VkResult pvr_mrt_load_ops_setup(struct pvr_cmd_buffer *cmd_buffer,
const VkAllocationCallbacks *alloc,
struct pvr_load_op_state **state);
void
pvr_mrt_load_op_state_cleanup(const struct pvr_device *device,
const VkAllocationCallbacks *alloc,
struct pvr_load_op_state *state);
void pvr_mrt_load_op_state_cleanup(const struct pvr_device *device,
const VkAllocationCallbacks *alloc,
struct pvr_load_op_state *state);
#endif

View file

@ -635,9 +635,8 @@ static inline VkResult pvr_hw_render_load_ops_setup(
VkResult result;
if (hw_render->tile_buffers_count) {
result = pvr_device_tile_buffer_ensure_cap(
device,
hw_render->tile_buffers_count);
result = pvr_device_tile_buffer_ensure_cap(device,
hw_render->tile_buffers_count);
if (result != VK_SUCCESS)
return result;
}
@ -927,12 +926,13 @@ VkResult pvr_CreateRenderPass2(VkDevice _device,
if (index != VK_ATTACHMENT_UNUSED) {
const VkFormat format = pCreateInfo->pAttachments[index].format;
const bool stencil_has_store = vk_format_has_stencil(format) &&
const bool stencil_has_store =
vk_format_has_stencil(format) &&
(pass->attachments[index].stencil_store_op ==
VK_ATTACHMENT_STORE_OP_STORE);
const bool depth_has_store = vk_format_has_depth(format) &&
(pass->attachments[index].store_op ==
VK_ATTACHMENT_STORE_OP_STORE);
(pass->attachments[index].store_op ==
VK_ATTACHMENT_STORE_OP_STORE);
if (stencil_has_store || depth_has_store) {
subpass->stencil_resolve_mode = resolve_desc->stencilResolveMode;

View file

@ -36,10 +36,9 @@
#define VK_VENDOR_ID_IMAGINATION 0x1010
void
pvr_physical_device_dump_info(const struct pvr_physical_device *pdevice,
char *const *comp_display,
char *const *comp_render)
void pvr_physical_device_dump_info(const struct pvr_physical_device *pdevice,
char *const *comp_display,
char *const *comp_render)
{
drmVersionPtr version_display = NULL, version_render;
struct pvr_device_dump_info info = { 0 };
@ -76,8 +75,7 @@ pvr_physical_device_dump_info(const struct pvr_physical_device *pdevice,
drmFreeVersion(version_render);
}
void
pvr_physical_device_destroy(struct vk_physical_device *vk_pdevice)
void pvr_physical_device_destroy(struct vk_physical_device *vk_pdevice)
{
struct pvr_physical_device *pdevice =
container_of(vk_pdevice, struct pvr_physical_device, vk);
@ -105,8 +103,8 @@ pvr_physical_device_destroy(struct vk_physical_device *vk_pdevice)
vk_free(&pdevice->vk.instance->alloc, pdevice);
}
void
pvr_physical_device_free_pipeline_cache(struct pvr_physical_device *const pdevice)
void pvr_physical_device_free_pipeline_cache(
struct pvr_physical_device *const pdevice)
{
#ifdef ENABLE_SHADER_CACHE
if (!pdevice->vk.disk_cache)

View file

@ -26,8 +26,7 @@
#include "pvr_device_info.h"
#if defined(VK_USE_PLATFORM_DISPLAY_KHR) || \
defined(VK_USE_PLATFORM_WAYLAND_KHR)
#if defined(VK_USE_PLATFORM_DISPLAY_KHR) || defined(VK_USE_PLATFORM_WAYLAND_KHR)
# define PVR_USE_WSI_PLATFORM true
#else
# define PVR_USE_WSI_PLATFORM false
@ -69,21 +68,18 @@ VK_DEFINE_HANDLE_CASTS(pvr_physical_device,
VkPhysicalDevice,
VK_OBJECT_TYPE_PHYSICAL_DEVICE)
VkResult
pvr_physical_device_init(struct pvr_physical_device *pdevice,
struct pvr_instance *instance,
drmDevicePtr drm_render_device,
drmDevicePtr drm_display_device);
VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice,
struct pvr_instance *instance,
drmDevicePtr drm_render_device,
drmDevicePtr drm_display_device);
void
pvr_physical_device_dump_info(const struct pvr_physical_device *pdevice,
char *const *comp_display,
char *const *comp_render);
void pvr_physical_device_dump_info(const struct pvr_physical_device *pdevice,
char *const *comp_display,
char *const *comp_render);
void
pvr_physical_device_destroy(struct vk_physical_device *vk_pdevice);
void pvr_physical_device_destroy(struct vk_physical_device *vk_pdevice);
void
pvr_physical_device_free_pipeline_cache(struct pvr_physical_device *const pdevice);
void pvr_physical_device_free_pipeline_cache(
struct pvr_physical_device *const pdevice);
#endif /* PVR_PHYSICAL_DEVICE_H */

View file

@ -974,7 +974,12 @@ static VkResult pvr_compute_pipeline_compile(
pvr_early_init_shader_data(&shader_data, nir, pCreateInfo);
pco_preprocess_nir(pco_ctx, nir);
pvr_preprocess_shader_data(&shader_data, nir, pCreateInfo, layout, NULL, NULL);
pvr_preprocess_shader_data(&shader_data,
nir,
pCreateInfo,
layout,
NULL,
NULL);
pco_lower_nir(pco_ctx, nir, &shader_data);
pco_postprocess_nir(pco_ctx, nir, &shader_data);
pvr_postprocess_shader_data(&shader_data, nir, pCreateInfo, layout, NULL);
@ -1923,10 +1928,9 @@ pvr_init_fs_outputs(pco_data *data,
}
}
static void
pvr_init_fs_outputs_mrt(pco_data *data,
const struct vk_render_pass_state *rp,
const struct usc_mrt_setup *setup)
static void pvr_init_fs_outputs_mrt(pco_data *data,
const struct vk_render_pass_state *rp,
const struct usc_mrt_setup *setup)
{
unsigned u;
pco_fs_data *fs = &data->fs;
@ -2019,10 +2023,9 @@ pvr_setup_fs_outputs(pco_data *data,
assert(!outputs_written);
}
static void
pvr_setup_fs_outputs_mrt(pco_data *data,
nir_shader *nir,
const struct usc_mrt_setup *setup)
static void pvr_setup_fs_outputs_mrt(pco_data *data,
nir_shader *nir,
const struct usc_mrt_setup *setup)
{
uint64_t outputs_written = nir->info.outputs_written;
pco_fs_data *fs = &data->fs;
@ -2098,10 +2101,10 @@ static void pvr_init_fs_input_attachments(
}
}
static void pvr_init_fs_input_attachments_mrt(
pco_data *data,
const struct vk_render_pass_state *rp,
const struct usc_mrt_setup *setup)
static void
pvr_init_fs_input_attachments_mrt(pco_data *data,
const struct vk_render_pass_state *rp,
const struct usc_mrt_setup *setup)
{
pco_fs_data *fs = &data->fs;
for (unsigned u = 0; u < rp->color_attachment_count; u++) {
@ -2204,10 +2207,9 @@ static void pvr_setup_fs_input_attachments(
}
}
static void pvr_setup_fs_input_attachments_mrt(
pco_data *data,
nir_shader *nir,
struct usc_mrt_setup *setup)
static void pvr_setup_fs_input_attachments_mrt(pco_data *data,
nir_shader *nir,
struct usc_mrt_setup *setup)
{
pco_fs_data *fs = &data->fs;
for (unsigned u = 0; u < setup->num_render_targets; ++u) {
@ -2732,9 +2734,9 @@ pvr_graphics_pipeline_compile(struct pvr_device *const device,
const struct vk_render_pass_state *rp = state->rp;
result = pvr_init_usc_mrt_setup(device,
rp->color_attachment_count,
rp->color_attachment_formats,
&mrt_setup);
rp->color_attachment_count,
rp->color_attachment_formats,
&mrt_setup);
if (result != VK_SUCCESS)
return result;
}
@ -2975,14 +2977,13 @@ pvr_rendering_info_setup(const VkGraphicsPipelineCreateInfo *const info,
struct vk_render_pass_state *rp)
{
const VkPipelineRenderingCreateInfo *ri =
vk_find_struct_const(info->pNext,
PIPELINE_RENDERING_CREATE_INFO);
vk_find_struct_const(info->pNext, PIPELINE_RENDERING_CREATE_INFO);
if (!ri) {
/* From the Vulkan spec for VkPipelineRenderingCreateInfo:
*
* "if this structure is not specified, and the pipeline does not include
* a VkRenderPass, viewMask and colorAttachmentCount are 0, and
* "if this structure is not specified, and the pipeline does not
* include a VkRenderPass, viewMask and colorAttachmentCount are 0, and
* depthAttachmentFormat and stencilAttachmentFormat are
* VK_FORMAT_UNDEFINED.
*/

View file

@ -411,7 +411,8 @@ VkResult pvr_add_query_program(struct pvr_cmd_buffer *cmd_buffer,
if (result != VK_SUCCESS)
return result;
cmd_buffer->state.current_sub_cmd->is_dynamic_render = query_info->is_dynamic_render;
cmd_buffer->state.current_sub_cmd->is_dynamic_render =
query_info->is_dynamic_render;
cmd_buffer->state.current_sub_cmd->is_suspend = query_info->is_suspend;
switch (query_info->type) {
@ -483,11 +484,11 @@ VkResult pvr_add_query_program(struct pvr_cmd_buffer *cmd_buffer,
case PVR_QUERY_TYPE_COPY_QUERY_RESULTS: {
VK_FROM_HANDLE(pvr_query_pool,
pool,
query_info->copy_query_results.query_pool);
pool,
query_info->copy_query_results.query_pool);
VK_FROM_HANDLE(pvr_buffer,
buffer,
query_info->copy_query_results.dst_buffer);
buffer,
query_info->copy_query_results.dst_buffer);
pvr_dev_addr_t dev_addr;
@ -531,8 +532,8 @@ VkResult pvr_add_query_program(struct pvr_cmd_buffer *cmd_buffer,
case PVR_QUERY_TYPE_RESET_QUERY_POOL: {
VK_FROM_HANDLE(pvr_query_pool,
pool,
query_info->reset_query_pool.query_pool);
pool,
query_info->reset_query_pool.query_pool);
uint64_t offset =
query_info->reset_query_pool.first_query * sizeof(uint32_t);

View file

@ -234,4 +234,3 @@ void pvr_DestroySampler(VkDevice _device,
vk_sampler_destroy(&device->vk, pAllocator, &sampler->vk);
}

View file

@ -109,8 +109,7 @@ uint64_t pvr_spm_scratch_buffer_calc_required_size(
nr_output_regs = MAX2(nr_output_regs, hw_render->output_regs_count);
}
dwords_per_pixel =
(uint64_t)sample_count * nr_output_regs * nr_tile_buffers;
dwords_per_pixel = (uint64_t)sample_count * nr_output_regs * nr_tile_buffers;
buffer_size = ALIGN_POT((uint64_t)framebuffer_width,
ROGUE_CR_PBE_WORD0_MRT0_LINESTRIDE_ALIGNMENT);

View file

@ -93,8 +93,7 @@ void pvr_spm_finish_scratch_buffer_store(struct pvr_device *device);
* VK_ATTACHMENT_STORE_OP_NONE, not currently supported) or lazily allocated
* attachments with no backing.
*/
uint64_t
pvr_spm_scratch_buffer_calc_required_size(
uint64_t pvr_spm_scratch_buffer_calc_required_size(
const struct pvr_renderpass_hwsetup_render *renders,
uint32_t render_count,
uint32_t sample_count,