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.
This commit is contained in:
joevt 2024-02-28 15:45:45 -08:00 committed by dingusdev
parent 755dd7f60a
commit 288d97f24c
1 changed files with 15 additions and 0 deletions

View File

@ -362,6 +362,15 @@ uint32_t AtiMach64Gx::read_reg(uint32_t reg_offset, uint32_t size)
return static_cast<uint32_t>(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<uint64_t>(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