rsx: Improve sync_hint callback interface

This commit is contained in:
kd-11 2022-05-14 19:04:12 +03:00 committed by kd-11
parent 5315eb546f
commit d2de560060
6 changed files with 23 additions and 19 deletions

View File

@ -2576,7 +2576,7 @@ namespace rsx
if (!result.queries.empty())
{
cond_render_ctrl.set_eval_sources(result.queries);
sync_hint(FIFO_hint::hint_conditional_render_eval, reinterpret_cast<void*>(ref));
sync_hint(FIFO_hint::hint_conditional_render_eval, { .query = result.queries.front(), .address = ref });
}
else
{
@ -2624,9 +2624,9 @@ namespace rsx
//ensure(async_tasks_pending.load() == 0);
}
void thread::sync_hint(FIFO_hint /*hint*/, void* args)
void thread::sync_hint(FIFO_hint /*hint*/, rsx::reports::sync_hint_payload_t payload)
{
zcull_ctrl->on_sync_hint(args);
zcull_ctrl->on_sync_hint(payload);
}
bool thread::is_fifo_idle() const

View File

@ -694,7 +694,7 @@ namespace rsx
// sync
void sync();
flags32_t read_barrier(u32 memory_address, u32 memory_range, bool unconditional);
virtual void sync_hint(FIFO_hint hint, void* args);
virtual void sync_hint(FIFO_hint hint, reports::sync_hint_payload_t payload);
virtual bool release_GCM_label(u32 /*address*/, u32 /*value*/) { return false; }
std::span<const std::byte> get_raw_index_array(const draw_clause& draw_indexed_clause) const;

View File

@ -285,10 +285,9 @@ namespace rsx
}
}
void ZCULL_control::on_sync_hint(void* args)
void ZCULL_control::on_sync_hint(sync_hint_payload_t payload)
{
auto query = static_cast<occlusion_query_info*>(args);
m_sync_tag = std::max(m_sync_tag, query->sync_tag);
m_sync_tag = std::max(m_sync_tag, payload.query->sync_tag);
}
void ZCULL_control::write(vm::addr_t sink, u64 timestamp, u32 type, u32 value)
@ -397,7 +396,7 @@ namespace rsx
if (It->query->sync_tag > m_sync_tag)
{
// rsx_log.trace("[Performance warning] Query hint emit during sync command.");
ptimer->sync_hint(FIFO_hint::hint_zcull_sync, It->query);
ptimer->sync_hint(FIFO_hint::hint_zcull_sync, { .query = It->query });
}
break;
@ -501,7 +500,7 @@ namespace rsx
{
if (It->query->num_draws && It->query->sync_tag > m_sync_tag)
{
ptimer->sync_hint(FIFO_hint::hint_zcull_sync, It->query);
ptimer->sync_hint(FIFO_hint::hint_zcull_sync, { .query = It->query });
ensure(It->query->sync_tag <= m_sync_tag);
}
@ -526,7 +525,7 @@ namespace rsx
const auto elapsed = m_tsc - front.query->timestamp;
if (elapsed > max_zcull_delay_us)
{
ptimer->sync_hint(FIFO_hint::hint_zcull_sync, front.query);
ptimer->sync_hint(FIFO_hint::hint_zcull_sync, { .query = front.query });
ensure(front.query->sync_tag <= m_sync_tag);
}
@ -686,7 +685,7 @@ namespace rsx
{
if (query->sync_tag > m_sync_tag) [[unlikely]]
{
ptimer->sync_hint(FIFO_hint::hint_zcull_sync, query);
ptimer->sync_hint(FIFO_hint::hint_zcull_sync, { .query = query });
ensure(m_sync_tag >= query->sync_tag);
}
}

View File

@ -65,6 +65,13 @@ namespace rsx
u32 reserved;
};
struct sync_hint_payload_t
{
occlusion_query_info* query;
vm::addr_t address;
void* other_params;
};
struct MMIO_page_data_t : public rsx::ref_counted
{
utils::protection prot = utils::protection::rw;
@ -171,7 +178,7 @@ namespace rsx
void on_draw();
// Sync hint notification
void on_sync_hint(void* args);
void on_sync_hint(sync_hint_payload_t payload);
// Check for pending writes
bool has_pending() const { return !m_pending_writes.empty(); }

View File

@ -1573,10 +1573,9 @@ bool VKGSRender::release_GCM_label(u32 address, u32 args)
return true;
}
void VKGSRender::sync_hint(rsx::FIFO_hint hint, void* args)
void VKGSRender::sync_hint(rsx::FIFO_hint hint, rsx::reports::sync_hint_payload_t payload)
{
ensure(args);
rsx::thread::sync_hint(hint, args);
rsx::thread::sync_hint(hint, payload);
if (!(m_current_command_buffer->flags & vk::command_buffer::cb_has_occlusion_task))
{
@ -1596,7 +1595,7 @@ void VKGSRender::sync_hint(rsx::FIFO_hint hint, void* args)
}
// If the result is not going to be read by CELL, do nothing
const auto ref_addr = reinterpret_cast<u32>(args);
const auto ref_addr = static_cast<u32>(payload.address);
if (!zcull_ctrl->is_query_result_urgent(ref_addr))
{
// No effect on CELL behaviour, it will be faster to handle this in RSX code
@ -1620,8 +1619,7 @@ void VKGSRender::sync_hint(rsx::FIFO_hint hint, void* args)
case rsx::FIFO_hint::hint_zcull_sync:
{
// Check if the required report is synced to this CB
auto occlusion_info = static_cast<rsx::reports::occlusion_query_info*>(args);
auto& data = m_occlusion_map[occlusion_info->driver_handle];
auto& data = m_occlusion_map[payload.query->driver_handle];
// NOTE: Currently, a special condition exists where the indices can be empty even with active draw count.
// This is caused by async compiler and should be removed when ubershaders are added in

View File

@ -246,7 +246,7 @@ public:
void set_scissor(bool clip_viewport);
void bind_viewport();
void sync_hint(rsx::FIFO_hint hint, void* args) override;
void sync_hint(rsx::FIFO_hint hint, rsx::reports::sync_hint_payload_t payload) override;
bool release_GCM_label(u32 address, u32 data) override;
void begin_occlusion_query(rsx::reports::occlusion_query_info* query) override;