From: Lawrence S. <ljs...@us...> - 2021-04-30 21:36:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 2b200fb8aa4c37f259c5837a6fec13ca4bd966ef (commit) via 69d64eedf007fd56b24ee5192218e9cd3df9eaa8 (commit) via d9fff77cd4cb9e3cd6998c8c4a5e24f225cac9f1 (commit) from 057d05fe4f2b6fc3e2c93215d3b83c871ae4e23c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2b200fb8aa4c37f259c5837a6fec13ca4bd966ef Merge: 057d05f 69d64ee Author: Lawrence Sebald <ljs...@us...> Date: Fri Apr 30 17:35:42 2021 -0400 Merge pull request #51 from KallistiOS/pvr-buffer-bugfix Pvr buffer bugfix commit 69d64eedf007fd56b24ee5192218e9cd3df9eaa8 Author: Luke Benstead <ka...@gm...> Date: Fri Apr 30 20:43:43 2021 +0100 Clean up commit d9fff77cd4cb9e3cd6998c8c4a5e24f225cac9f1 Author: Luke Benstead <ka...@gm...> Date: Fri Apr 30 20:43:35 2021 +0100 Correctly set addresses for all lists ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c index 6b2ffaf..0178bdf 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c @@ -149,6 +149,7 @@ up and placed at 0x000000 and 0x400000. */ #define BUF_ALIGN 128 #define BUF_ALIGN_MASK (BUF_ALIGN - 1) +#define APPLY_ALIGNMENT(addr) (((addr) + BUF_ALIGN_MASK) & ~BUF_ALIGN_MASK) void pvr_allocate_buffers(pvr_init_params_t *params) { volatile pvr_ta_buffers_t *buf; @@ -242,23 +243,24 @@ void pvr_allocate_buffers(pvr_init_params_t *params) { buf->vertex_size = params->vertex_buf_size; outaddr += buf->vertex_size; /* N-byte align */ - outaddr = (outaddr + BUF_ALIGN_MASK) & ~BUF_ALIGN_MASK; + outaddr = APPLY_ALIGNMENT(outaddr); /* Object Pointer Buffers */ buf->opb = outaddr; buf->opb_size = opb_total_size; - outaddr += opb_total_size; /* Set up the opb pointers to each section */ opb_size_accum = 0; for(j = 0; j < PVR_OPB_COUNT; j++) { buf->opb_addresses[j] = buf->opb + opb_size_accum; - opb_size_accum += pvr_state.opb_size[j]; + opb_size_accum += pvr_state.opb_size[j] * pvr_state.tw * pvr_state.th; } + assert(buf->opb_size == opb_size_accum); + /* N-byte align */ - outaddr = (outaddr + BUF_ALIGN_MASK) & ~BUF_ALIGN_MASK; + outaddr = APPLY_ALIGNMENT(outaddr); /* Tile Matrix */ buf->tile_matrix = outaddr; @@ -266,7 +268,7 @@ void pvr_allocate_buffers(pvr_init_params_t *params) { outaddr += buf->tile_matrix_size; /* N-byte align */ - outaddr = (outaddr + BUF_ALIGN_MASK) & ~BUF_ALIGN_MASK; + outaddr = APPLY_ALIGNMENT(outaddr); /* Output buffer */ fbuf->frame = outaddr; @@ -274,7 +276,7 @@ void pvr_allocate_buffers(pvr_init_params_t *params) { outaddr += fbuf->frame_size; /* N-byte align */ - outaddr = (outaddr + BUF_ALIGN_MASK) & ~BUF_ALIGN_MASK; + outaddr = APPLY_ALIGNMENT(outaddr); } /* Texture ram is whatever is left */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |