From aa805468d90a91b64fb5f51237b84cdda1e66d48 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Sun, 17 Dec 2023 22:06:17 +0800 Subject: [PATCH] holly/core: use End of TSP interrupt Core bug #20 is real: The "End_Of_Video" interrupt is sometimes not output. Replace with "End_Of_TSP --- example/cube.cpp | 6 ------ holly/core.cpp | 17 +++++++++-------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/example/cube.cpp b/example/cube.cpp index c1524a6..e67ddd0 100644 --- a/example/cube.cpp +++ b/example/cube.cpp @@ -174,23 +174,17 @@ void main() while (1) { ta_polygon_converter_init(opb_size.total() * tiles, ta_alloc); - auto parameter = ta_parameter_writer(ta_parameter_buf); for (uint32_t i = 0; i < num_faces; i++) { transform(parameter, cube_faces[i], 4); } parameter.append() = global_end_of_list(); - ta_polygon_converter_transfer(ta_parameter_buf, parameter.offset); - ta_wait_opaque_list(); - core_start_render(frame_ix, num_frames); - v_sync_out(); v_sync_in(); core_wait_end_of_render_video(frame_ix, num_frames); - theta += half_degree; frame_ix += 1; } diff --git a/holly/core.cpp b/holly/core.cpp index 89d8d58..199fd9a 100644 --- a/holly/core.cpp +++ b/holly/core.cpp @@ -69,17 +69,18 @@ void core_start_render(uint32_t frame_ix, uint32_t num_frames) holly.STARTRENDER = 1; } -static bool flycast_is_dumb = 0; +static bool flycast_is_dumb = false; + +#include "serial.hpp" void core_wait_end_of_render_video(uint32_t frame_ix, uint32_t num_frames) { + if (!flycast_is_dumb) { + flycast_is_dumb = true; + } else { + while ((system.ISTNRM & ISTNRM__END_OF_RENDER_TSP) == 0); + system.ISTNRM = ISTNRM__END_OF_RENDER_TSP; + } uint32_t r_fb = ((frame_ix + 1) & num_frames) * 0x00096000; holly.FB_R_SOF1 = (offsetof (struct texture_memory_alloc, framebuffer)) + r_fb; - - if (!flycast_is_dumb) { - flycast_is_dumb = 1; - } else { - while ((system.ISTNRM & ISTNRM__END_OF_RENDER_VIDEO) == 0); - system.ISTNRM = ISTNRM__END_OF_RENDER_VIDEO; - } }