}
if (query_pool) {
- struct pvr_sub_cmd_event *sub_cmd;
struct pvr_query_info query_info;
assert(query_bo);
if (result != VK_SUCCESS)
return result;
- sub_cmd = &cmd_buffer->state.current_sub_cmd->event;
-
- *sub_cmd = (struct pvr_sub_cmd_event) {
+ cmd_buffer->state.current_sub_cmd->event = (struct pvr_sub_cmd_event){
.type = PVR_EVENT_TYPE_BARRIER,
.barrier = {
.wait_for_stage_mask = PVR_PIPELINE_STAGE_FRAG_BIT,
uint32_t src_stage_mask,
uint32_t dst_stage_mask)
{
- struct pvr_sub_cmd_event *sub_cmd;
VkResult result;
assert(cmd_buffer->state.current_sub_cmd->type == PVR_SUB_CMD_TYPE_GRAPHICS);
if (result != VK_SUCCESS)
return result;
- sub_cmd = &cmd_buffer->state.current_sub_cmd->event;
-
- sub_cmd->type = PVR_EVENT_TYPE_BARRIER;
- sub_cmd->barrier.in_render_pass = true;
- sub_cmd->barrier.wait_for_stage_mask = src_stage_mask;
- sub_cmd->barrier.wait_at_stage_mask = dst_stage_mask;
+ cmd_buffer->state.current_sub_cmd->event = (struct pvr_sub_cmd_event){
+ .type = PVR_EVENT_TYPE_BARRIER,
+ .barrier = {
+ .in_render_pass = true,
+ .wait_for_stage_mask = src_stage_mask,
+ .wait_at_stage_mask = dst_stage_mask,
+ },
+ };
pvr_cmd_buffer_end_sub_cmd(cmd_buffer);
pvr_cmd_buffer_start_sub_cmd(cmd_buffer, PVR_SUB_CMD_TYPE_GRAPHICS);
uint32_t src_stage_mask,
uint32_t dst_stage_mask)
{
- struct pvr_sub_cmd_event *sub_cmd;
VkResult result;
result = pvr_cmd_buffer_start_sub_cmd(cmd_buffer, PVR_SUB_CMD_TYPE_EVENT);
if (result != VK_SUCCESS)
return result;
- sub_cmd = &cmd_buffer->state.current_sub_cmd->event;
-
- sub_cmd->type = PVR_EVENT_TYPE_BARRIER;
- sub_cmd->barrier.wait_for_stage_mask = src_stage_mask;
- sub_cmd->barrier.wait_at_stage_mask = dst_stage_mask;
+ cmd_buffer->state.current_sub_cmd->event = (struct pvr_sub_cmd_event){
+ .type = PVR_EVENT_TYPE_BARRIER,
+ .barrier = {
+ .wait_for_stage_mask = src_stage_mask,
+ .wait_at_stage_mask = dst_stage_mask,
+ },
+ };
return pvr_cmd_buffer_end_sub_cmd(cmd_buffer);
}
{
PVR_FROM_HANDLE(pvr_cmd_buffer, cmd_buffer, commandBuffer);
PVR_FROM_HANDLE(pvr_event, event, _event);
- struct pvr_sub_cmd_event *sub_cmd;
VkResult result;
PVR_CHECK_COMMAND_BUFFER_BUILDING_STATE(cmd_buffer);
if (result != VK_SUCCESS)
return;
- sub_cmd = &cmd_buffer->state.current_sub_cmd->event;
-
- sub_cmd->type = PVR_EVENT_TYPE_RESET;
- sub_cmd->reset.event = event;
- sub_cmd->reset.wait_for_stage_mask = pvr_stage_mask_src(stageMask);
+ cmd_buffer->state.current_sub_cmd->event = (struct pvr_sub_cmd_event){
+ .type = PVR_EVENT_TYPE_RESET,
+ .set_reset = {
+ .event = event,
+ .wait_for_stage_mask = pvr_stage_mask_src(stageMask),
+ },
+ };
pvr_cmd_buffer_end_sub_cmd(cmd_buffer);
}
PVR_FROM_HANDLE(pvr_cmd_buffer, cmd_buffer, commandBuffer);
PVR_FROM_HANDLE(pvr_event, event, _event);
VkPipelineStageFlags2 stage_mask = 0;
- struct pvr_sub_cmd_event *sub_cmd;
VkResult result;
PVR_CHECK_COMMAND_BUFFER_BUILDING_STATE(cmd_buffer);
for (uint32_t i = 0; i < pDependencyInfo->imageMemoryBarrierCount; i++)
stage_mask |= pDependencyInfo->pImageMemoryBarriers[i].srcStageMask;
- sub_cmd = &cmd_buffer->state.current_sub_cmd->event;
-
- sub_cmd->type = PVR_EVENT_TYPE_SET;
- sub_cmd->set.event = event;
- sub_cmd->set.wait_for_stage_mask = pvr_stage_mask_dst(stage_mask);
+ cmd_buffer->state.current_sub_cmd->event = (struct pvr_sub_cmd_event){
+ .type = PVR_EVENT_TYPE_SET,
+ .set_reset = {
+ .event = event,
+ .wait_for_stage_mask = pvr_stage_mask_dst(stage_mask),
+ },
+ };
pvr_cmd_buffer_end_sub_cmd(cmd_buffer);
}
const VkDependencyInfo *pDependencyInfos)
{
PVR_FROM_HANDLE(pvr_cmd_buffer, cmd_buffer, commandBuffer);
- struct pvr_sub_cmd_event *sub_cmd;
struct pvr_event **events_array;
uint32_t *stage_masks;
VkResult result;
stage_masks[i] = pvr_stage_mask_dst(mask);
}
- sub_cmd = &cmd_buffer->state.current_sub_cmd->event;
-
- sub_cmd->type = PVR_EVENT_TYPE_WAIT;
- sub_cmd->wait.count = eventCount;
- sub_cmd->wait.events = events_array;
- sub_cmd->wait.wait_at_stage_masks = stage_masks;
+ cmd_buffer->state.current_sub_cmd->event = (struct pvr_sub_cmd_event){
+ .type = PVR_EVENT_TYPE_WAIT,
+ .wait = {
+ .count = eventCount,
+ .events = events_array,
+ .wait_at_stage_masks = stage_masks,
+ },
+ };
pvr_cmd_buffer_end_sub_cmd(cmd_buffer);
}
return result;
}
-static VkResult pvr_process_event_cmd_barrier(struct pvr_device *device,
- struct pvr_queue *queue,
- struct pvr_sub_cmd_event *sub_cmd)
+static VkResult
+pvr_process_event_cmd_barrier(struct pvr_device *device,
+ struct pvr_queue *queue,
+ struct pvr_sub_cmd_event_barrier *sub_cmd)
{
- const uint32_t src_mask = sub_cmd->barrier.wait_for_stage_mask;
- const uint32_t dst_mask = sub_cmd->barrier.wait_at_stage_mask;
+ const uint32_t src_mask = sub_cmd->wait_for_stage_mask;
+ const uint32_t dst_mask = sub_cmd->wait_at_stage_mask;
struct vk_sync_wait wait_syncs[PVR_JOB_TYPE_MAX + 1];
uint32_t src_wait_count = 0;
VkResult result;
- assert(sub_cmd->type == PVR_EVENT_TYPE_BARRIER);
-
assert(!(src_mask & ~PVR_PIPELINE_STAGE_ALL_BITS));
assert(!(dst_mask & ~PVR_PIPELINE_STAGE_ALL_BITS));
static VkResult
pvr_process_event_cmd_set_or_reset(struct pvr_device *device,
struct pvr_queue *queue,
- struct pvr_sub_cmd_event *sub_cmd)
+ struct pvr_sub_cmd_event_set_reset *sub_cmd,
+ const enum pvr_event_state new_event_state)
{
/* Not PVR_JOB_TYPE_MAX since that also includes
* PVR_JOB_TYPE_OCCLUSION_QUERY so no stage in the src mask.
struct vk_sync_signal signal;
struct vk_sync *signal_sync;
- uint32_t wait_for_stage_mask;
uint32_t wait_count = 0;
VkResult result;
- assert(sub_cmd->type == PVR_EVENT_TYPE_SET ||
- sub_cmd->type == PVR_EVENT_TYPE_RESET);
-
- if (sub_cmd->type == PVR_EVENT_TYPE_SET)
- wait_for_stage_mask = sub_cmd->set.wait_for_stage_mask;
- else
- wait_for_stage_mask = sub_cmd->reset.wait_for_stage_mask;
-
- assert(!(wait_for_stage_mask & ~PVR_PIPELINE_STAGE_ALL_BITS));
+ assert(!(sub_cmd->wait_for_stage_mask & ~PVR_PIPELINE_STAGE_ALL_BITS));
- u_foreach_bit (stage, wait_for_stage_mask) {
+ u_foreach_bit (stage, sub_cmd->wait_for_stage_mask) {
if (!queue->last_job_signal_sync[stage])
continue;
return result;
}
- if (sub_cmd->type == PVR_EVENT_TYPE_SET) {
- if (sub_cmd->set.event->sync)
- vk_sync_destroy(&device->vk, sub_cmd->set.event->sync);
+ if (sub_cmd->event->sync)
+ vk_sync_destroy(&device->vk, sub_cmd->event->sync);
- sub_cmd->set.event->sync = signal_sync;
- sub_cmd->set.event->state = PVR_EVENT_STATE_SET_BY_DEVICE;
- } else {
- if (sub_cmd->reset.event->sync)
- vk_sync_destroy(&device->vk, sub_cmd->reset.event->sync);
-
- sub_cmd->reset.event->sync = signal_sync;
- sub_cmd->reset.event->state = PVR_EVENT_STATE_RESET_BY_DEVICE;
- }
+ sub_cmd->event->sync = signal_sync;
+ sub_cmd->event->state = new_event_state;
return VK_SUCCESS;
}
+static inline VkResult
+pvr_process_event_cmd_set(struct pvr_device *device,
+ struct pvr_queue *queue,
+ struct pvr_sub_cmd_event_set_reset *sub_cmd)
+{
+ return pvr_process_event_cmd_set_or_reset(device,
+ queue,
+ sub_cmd,
+ PVR_EVENT_STATE_SET_BY_DEVICE);
+}
+
+static inline VkResult
+pvr_process_event_cmd_reset(struct pvr_device *device,
+ struct pvr_queue *queue,
+ struct pvr_sub_cmd_event_set_reset *sub_cmd)
+{
+ return pvr_process_event_cmd_set_or_reset(device,
+ queue,
+ sub_cmd,
+ PVR_EVENT_STATE_RESET_BY_DEVICE);
+}
+
/**
* \brief Process an event sub command of wait type.
*
* \parma[in,out] per_cmd_buffer_syncobjs Completion syncobjs for the command
* buffer being processed.
*/
-static VkResult pvr_process_event_cmd_wait(struct pvr_device *device,
- struct pvr_queue *queue,
- struct pvr_sub_cmd_event *sub_cmd)
+static VkResult
+pvr_process_event_cmd_wait(struct pvr_device *device,
+ struct pvr_queue *queue,
+ struct pvr_sub_cmd_event_wait *sub_cmd)
{
uint32_t dst_mask = 0;
VkResult result;
- STACK_ARRAY(struct vk_sync_wait, waits, sub_cmd->wait.count + 1);
+ STACK_ARRAY(struct vk_sync_wait, waits, sub_cmd->count + 1);
if (!waits)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
- for (uint32_t i = 0; i < sub_cmd->wait.count; i++)
- dst_mask |= sub_cmd->wait.wait_at_stage_masks[i];
+ for (uint32_t i = 0; i < sub_cmd->count; i++)
+ dst_mask |= sub_cmd->wait_at_stage_masks[i];
u_foreach_bit (stage, dst_mask) {
struct vk_sync_signal signal;
struct vk_sync *signal_sync;
uint32_t wait_count = 0;
- for (uint32_t i = 0; i < sub_cmd->wait.count; i++) {
- if (sub_cmd->wait.wait_at_stage_masks[i] & stage) {
+ for (uint32_t i = 0; i < sub_cmd->count; i++) {
+ if (sub_cmd->wait_at_stage_masks[i] & stage) {
waits[wait_count++] = (struct vk_sync_wait){
- .sync = sub_cmd->wait.events[i]->sync,
+ .sync = sub_cmd->events[i]->sync,
.stage_mask = ~(VkPipelineStageFlags2)0,
.wait_value = 0,
};
};
}
- assert(wait_count <= (sub_cmd->wait.count + 1));
+ assert(wait_count <= (sub_cmd->count + 1));
result = vk_sync_create(&device->vk,
&device->pdevice->ws->syncobj_type,
{
switch (sub_cmd->type) {
case PVR_EVENT_TYPE_SET:
+ return pvr_process_event_cmd_set(device, queue, &sub_cmd->set_reset);
case PVR_EVENT_TYPE_RESET:
- return pvr_process_event_cmd_set_or_reset(device, queue, sub_cmd);
+ return pvr_process_event_cmd_reset(device, queue, &sub_cmd->set_reset);
case PVR_EVENT_TYPE_WAIT:
- return pvr_process_event_cmd_wait(device, queue, sub_cmd);
+ return pvr_process_event_cmd_wait(device, queue, &sub_cmd->wait);
case PVR_EVENT_TYPE_BARRIER:
- return pvr_process_event_cmd_barrier(device, queue, sub_cmd);
+ return pvr_process_event_cmd_barrier(device, queue, &sub_cmd->barrier);
default:
unreachable("Invalid event sub-command type.");
};
switch (sub_cmd->type) {
case PVR_SUB_CMD_TYPE_GRAPHICS: {
if (sub_cmd->gfx.has_occlusion_query) {
- struct pvr_sub_cmd_event frag_to_transfer_barrier = {
- .type = PVR_EVENT_TYPE_BARRIER,
- .barrier = {
- .wait_for_stage_mask = PVR_PIPELINE_STAGE_OCCLUSION_QUERY_BIT,
- .wait_at_stage_mask = PVR_PIPELINE_STAGE_FRAG_BIT,
- },
+ struct pvr_sub_cmd_event_barrier occlusion_to_frag_barrier = {
+ .wait_for_stage_mask = PVR_PIPELINE_STAGE_OCCLUSION_QUERY_BIT,
+ .wait_at_stage_mask = PVR_PIPELINE_STAGE_FRAG_BIT,
};
/* If the fragment job utilizes occlusion queries, for data
result = pvr_process_event_cmd_barrier(device,
queue,
- &frag_to_transfer_barrier);
+ &occlusion_to_frag_barrier);
if (result != VK_SUCCESS)
break;
}
const bool serialize_with_frag = sub_cmd->transfer.serialize_with_frag;
if (serialize_with_frag) {
- struct pvr_sub_cmd_event frag_to_transfer_barrier = {
- .type = PVR_EVENT_TYPE_BARRIER,
- .barrier = {
- .wait_for_stage_mask = PVR_PIPELINE_STAGE_FRAG_BIT,
- .wait_at_stage_mask = PVR_PIPELINE_STAGE_TRANSFER_BIT,
- },
+ struct pvr_sub_cmd_event_barrier frag_to_transfer_barrier = {
+ .wait_for_stage_mask = PVR_PIPELINE_STAGE_FRAG_BIT,
+ .wait_at_stage_mask = PVR_PIPELINE_STAGE_TRANSFER_BIT,
};
result = pvr_process_event_cmd_barrier(device,
result = pvr_process_transfer_cmds(device, queue, &sub_cmd->transfer);
if (serialize_with_frag) {
- struct pvr_sub_cmd_event transfer_to_frag_barrier = {
- .type = PVR_EVENT_TYPE_BARRIER,
- .barrier = {
- .wait_for_stage_mask = PVR_PIPELINE_STAGE_TRANSFER_BIT,
- .wait_at_stage_mask = PVR_PIPELINE_STAGE_FRAG_BIT,
- },
+ struct pvr_sub_cmd_event_barrier transfer_to_frag_barrier = {
+ .wait_for_stage_mask = PVR_PIPELINE_STAGE_TRANSFER_BIT,
+ .wait_at_stage_mask = PVR_PIPELINE_STAGE_FRAG_BIT,
};
if (result != VK_SUCCESS)