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 cfb65791be19b9fb9919c261f6e175157a1f2ed2 (commit)
from 037831d2ff0f954bb4020d0119047a5738e7fc04 (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 cfb65791be19b9fb9919c261f6e175157a1f2ed2
Author: Paul Cercueil <pa...@cr...>
Date: Fri Oct 24 12:13:27 2025 +0200
pvr: Add function pvr_get_back_buffer()
Similar to pvr_get_front_buffer(), this function can be used to retrieve
a VRAM pointer to the back buffer.
Since the back buffer is only written after the current scene is
finished, it is actually possible to use the back buffer as a background
texture (similar to how the front buffer is used as a texture in the
fb_tex example) for doing additive double-buffering rendering, where the
background of each frame N is the frame N-2.
Signed-off-by: Paul Cercueil <pa...@cr...>
-----------------------------------------------------------------------
Summary of changes:
kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 12 ++++++++++--
kernel/arch/dreamcast/include/dc/pvr.h | 14 ++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c
index eff80f2e..bada5adc 100644
--- a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c
+++ b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c
@@ -266,7 +266,7 @@ void pvr_blank_polyhdr_buf(int type, pvr_poly_hdr_t * poly) {
poly->cmd = FIELD_PREP(PVR_TA_CMD_TYPE, type) | 0x80840012;
}
-pvr_ptr_t pvr_get_front_buffer(void) {
+static pvr_ptr_t pvr_get_frame_buffer(bool back) {
unsigned int idx;
uint32_t addr;
@@ -275,7 +275,7 @@ pvr_ptr_t pvr_get_front_buffer(void) {
/* The front buffer may not have been fully rendered or submitted to the
video hardware yet. In case this has yet to happen, we want the second
view target, aka. the one not currently being displayed. */
- idx = pvr_state.view_target ^ pvr_state.render_completed;
+ idx = pvr_state.view_target ^ pvr_state.render_completed ^ back;
addr = pvr_state.frame_buffers[idx].frame & (PVR_RAM_SIZE - 1);
@@ -284,6 +284,14 @@ pvr_ptr_t pvr_get_front_buffer(void) {
return (pvr_ptr_t)(addr * 2 + PVR_RAM_BASE);
}
+pvr_ptr_t pvr_get_front_buffer(void) {
+ return pvr_get_frame_buffer(false);
+}
+
+pvr_ptr_t pvr_get_back_buffer(void) {
+ return pvr_get_frame_buffer(true);
+}
+
int pvr_set_vertical_scale(float factor) {
uint32_t f16;
uint32_t cfg;
diff --git a/kernel/arch/dreamcast/include/dc/pvr.h b/kernel/arch/dreamcast/include/dc/pvr.h
index 7130d3e0..30aa14c3 100644
--- a/kernel/arch/dreamcast/include/dc/pvr.h
+++ b/kernel/arch/dreamcast/include/dc/pvr.h
@@ -1603,6 +1603,20 @@ void pvr_poly_cxt_txr_mod(pvr_poly_cxt_t *dst, pvr_list_t list,
*/
pvr_ptr_t pvr_get_front_buffer(void);
+/** \brief Get a pointer to the back buffer.
+ \ingroup pvr_txr_mgmt
+
+ This function can be used to retrieve a pointer to the back buffer, aka.
+ the frame buffer that will be rendered to.
+
+ Note that the frame buffers lie in 32-bit memory, while textures lie in
+ 64-bit memory. The address returned will point to 64-bit memory, but the
+ back buffer cannot be used directly as a regular texture.
+
+ \return A pointer to the back buffer.
+*/
+pvr_ptr_t pvr_get_back_buffer(void);
+
/*********************************************************************/
#include "pvr/pvr_regs.h"
hooks/post-receive
--
A pseudo Operating System for the Dreamcast.
|