From 729ffba90fe2a8f2f2a3ebcbb87afba044b02047 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Wed, 25 Jun 2025 12:43:43 -0500 Subject: [PATCH] add texture_memory_alloc9 --- example/custom_resolution.cpp | 14 ++++++++++---- holly/texture_memory_alloc9.hpp | 32 +++++++++++++++++++++++++++++++ tools/texture_memory_allocator.py | 6 +++--- 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 holly/texture_memory_alloc9.hpp diff --git a/example/custom_resolution.cpp b/example/custom_resolution.cpp index 790e45a..344eb8d 100644 --- a/example/custom_resolution.cpp +++ b/example/custom_resolution.cpp @@ -275,14 +275,20 @@ void main() ta_polygon_converter_transfer(writer.buf, writer.offset); ta_wait_opaque_list(); - int framebuffer_size = framebuffer_width * framebuffer_height * bytes_per_pixel; - int framebuffer_address = (0x10000000 - (framebuffer_size / 2)); + //int framebuffer_size = framebuffer_width * framebuffer_height * bytes_per_pixel; + //int framebuffer_address = (0x10000000 - (framebuffer_size / 2)); //int framebuffer_address = texture_memory_alloc.framebuffer[1].start; + //holly.FB_W_SOF1 = framebuffer_address & 0x1ffffff; + //holly.STARTRENDER = 1; + + int framebuffer_address = texture_memory_alloc.framebuffer[0].start; + test_pattern(); - holly.FB_W_SOF1 = framebuffer_address & 0x1ffffff; - holly.STARTRENDER = 1; holly.FB_R_SOF1 = framebuffer_address & 0x0ffffff; printf("fb_w_sof1 0x%08x\n", holly.FB_W_SOF1); printf("fb_r_sof1 0x%08x\n", holly.FB_R_SOF1); + + while (1) { + } } diff --git a/holly/texture_memory_alloc9.hpp b/holly/texture_memory_alloc9.hpp new file mode 100644 index 0000000..08b0dcc --- /dev/null +++ b/holly/texture_memory_alloc9.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include +#include + +struct texture_memory_alloc__start_end { + uint32_t start; + uint32_t end; +}; + +struct texture_memory_alloc { + struct texture_memory_alloc__start_end isp_tsp_parameters; + struct texture_memory_alloc__start_end object_list; + struct texture_memory_alloc__start_end region_array; + struct texture_memory_alloc__start_end framebuffer[3]; + struct texture_memory_alloc__start_end background[2]; + struct texture_memory_alloc__start_end texture; +}; + +constexpr texture_memory_alloc texture_memory_alloc = { + // 32-bit addresses start end start end + .isp_tsp_parameters = {0x000000, 0x21bfe0}, + .object_list = {0x400000, 0x495fe0}, + .region_array = {0x21c000, 0x22c000}, + .framebuffer = {{0x496000, 0x53ec00}, + {0x22c000, 0x2d4c00}, + {0x53ec00, 0x5e7800}}, + .background = {{0x2d4c00, 0x2d4c20}, + {0x5e7800, 0x5e7820}}, + // 64-bit addresses + .texture = {0x5a9840, 0x800000} +}; diff --git a/tools/texture_memory_allocator.py b/tools/texture_memory_allocator.py index 7f8787b..3739bbf 100644 --- a/tools/texture_memory_allocator.py +++ b/tools/texture_memory_allocator.py @@ -40,10 +40,10 @@ allocations = { "object_list" : (0x09_6000 , 32 ), "region_array" : (0x01_0000 , 0 ), - "framebuffer0" : (0x09_6000 , 0 ), + "framebuffer0" : (0x0a_8c00 , 0 ), - "framebuffer1" : (0x09_6000 , 0 ), - "framebuffer2" : (0x09_6000 , 0 ), + "framebuffer1" : (0x0a_8c00 , 0 ), + "framebuffer2" : (0x0a_8c00 , 0 ), "background0" : (0x00_0040 , 32 ), "background1" : (0x00_0040 , 32 ),