From 288d97f24cf3010deae273178d3877b6e8b3ef03 Mon Sep 17 00:00:00 2001 From: joevt Date: Wed, 28 Feb 2024 15:45:45 -0800 Subject: [PATCH] atimach64gx: Add missing WRITE_VALUE_AND_LOG. This commit fixes conflict resolution mistakes in the following commits: "atimach64gx: Let crtc_update calculate fb_ptr." "atimach64gx: Redraw only when necessary." "atimach64gx: Log unhandled overlay registers." was mistakenly included in "atimach64gx: Let crtc_update calculate fb_ptr.". The OVR_ registers were included because they may be needed for 2D acceleration in System 7.5.3 and later. --- devices/video/atimach64gx.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/devices/video/atimach64gx.cpp b/devices/video/atimach64gx.cpp index dc3be86..1e701e2 100644 --- a/devices/video/atimach64gx.cpp +++ b/devices/video/atimach64gx.cpp @@ -362,6 +362,15 @@ uint32_t AtiMach64Gx::read_reg(uint32_t reg_offset, uint32_t size) return static_cast(result); } +#define WRITE_VALUE_AND_LOG() \ + do { \ + this->regs[reg_num] = new_value; \ + LOG_F(9, "%s: write %s %04x.%c = %0*x = %08x", this->name.c_str(), \ + get_reg_name(reg_num), reg_offset, SIZE_ARG(size), size * 2, \ + (uint32_t)extract_bits(value, offset * 8, size * 8), new_value \ + ); \ + } while (0) + void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) { uint32_t reg_num = reg_offset >> 2; @@ -389,6 +398,7 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) break; case ATI_CRTC_OFF_PITCH: new_value = value; + WRITE_VALUE_AND_LOG(); this->crtc_update(); return; case ATI_CRTC_INT_CNTL: @@ -506,6 +516,7 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) case ATI_OVR_WID_LEFT_RIGHT: case ATI_OVR_WID_TOP_BOTTOM: new_value = value; + WRITE_VALUE_AND_LOG(); if (value != 0) { LOG_F(ERROR, "%s: Unhandled value 0x%08x.", this->name.c_str(), value); } @@ -515,12 +526,14 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) new_value = value; this->cursor_dirty = true; draw_fb = true; + WRITE_VALUE_AND_LOG(); return; case ATI_CUR_OFFSET: new_value = value; if (old_value != new_value) this->cursor_dirty = true; draw_fb = true; + WRITE_VALUE_AND_LOG(); return; case ATI_CUR_HORZ_VERT_OFF: new_value = value; @@ -530,10 +543,12 @@ void AtiMach64Gx::write_reg(uint32_t reg_offset, uint32_t value, uint32_t size) ) this->cursor_dirty = true; draw_fb = true; + WRITE_VALUE_AND_LOG(); return; case ATI_CUR_HORZ_VERT_POSN: new_value = value; draw_fb = true; + WRITE_VALUE_AND_LOG(); return; case ATI_DAC_REGS: new_value = old_value; // no change