mamedev / mame

MAME
https://www.mamedev.org/
Other
8.41k stars 2.04k forks source link

indy_4610 display issue (and crashes) #10723

Closed darkstar closed 1 year ago

darkstar commented 1 year ago

Running the indy_4610 driver with the IRIX 6.5 softlist HDD shows a shifted display and ultimately crashes MAME 0.250:

indy_4610_display

Steps to reproduce:

MAME crashes as soon as it tries to display the login screen, with the following exception in the RB2 device:

-----------------------------------------------------
Exception at EIP=00007ff6623e47fe (rb2_device::read_pixel()+0x000e): ACCESS VIOLATION
While attempting to read memory at 000001dd02d72000
-----------------------------------------------------
RAX=000001dd02d72000 RBX=000001dd73c6fa10 RCX=0000000000000000 RDX=000000878a4f938c
RSI=000001dd686749f0 RDI=00000000000000c6 RBP=0000000000000329 RSP=000000878a4f9328
 R8=000000878a4f9388  R9=000000878a4f9374 R10=0000000000001e00 R11=000001dd02d1bea0
R12=000001dd68673680 R13=000001dd68674970 R14=000001dd686749f0 R15=0000000000000000
-----------------------------------------------------
Stack crawl:
  000000878a4f9320: 00007ff6623e47fe (rb2_device::read_pixel()+0x000e)
  000000878a4f9350: 00007ff65c7cd17e (std::_Function_handler<unsigned int (unsigned int, unsigned int), devcb_read<unsigned int, 4294967295u>::creator_impl<devcb_read<unsigned int, 4294967295u>::delegate_builder<emu::device_delegate<unsigned int ()> > >::create()::{lambda(auto:1&&)#1}::operator()<devcb_read<unsigned int, 4294967295u>::delegate_builder<emu::device_delegate<unsigned int ()> >::build<{lambda(auto:1&&)#1}>({lambda(auto:1&&)#1}&&)::{lambda(unsigned int, unsigned int)#1}>({lambda(auto:1&&)#1}&&) const::{lambda(unsigned int, unsigned int)#1}>::_M_invoke(std::_Any_data const&, unsigned int&&, unsigned int&&)+0x000e)
  000000878a4f93b0: 00007ff65c7d7578 (devcb_read<unsigned int, 4294967295u>::operator()()+0x0038)
  000000878a4f9440: 00007ff6623ebe76 (newport_base_device::do_rex3_command()+0x0296)
  000000878a4f94b0: 00007ff6623ecf10 (newport_base_device::rex3_w(unsigned int, unsigned long long, unsigned long long)+0x00b0)
  000000878a4f94e0: 00007ff660f75817 (handler_entry_write_delegate<3, 0, emu::device_delegate<void (unsigned int, unsigned long long, unsigned long long)> >::write(unsigned int, unsigned long long, unsigned long long) const+0x0017)
  000000878a4f9510: 00007ff66054998c (handler_entry_write_dispatch<14, 3, 0>::write(unsigned int, unsigned long long, unsigned long long) const+0x001c)
  000000878a4f9540: 00007ff65daa94b5 (address_space_specific<1, 3, 0, (util::endianness)1>::write_qword(unsigned int, unsigned long long, unsigned long long)+0x0025)
  000000878a4f9570: 00007ff65f8448ca (gio64_device::write(unsigned int, unsigned long long, unsigned long long)+0x001a)
  000000878a4f95a0: 00007ff660f75817 (handler_entry_write_delegate<3, 0, emu::device_delegate<void (unsigned int, unsigned long long, unsigned long long)> >::write(unsigned int, unsigned long long, unsigned long long) const+0x0017)
  000000878a4f95d0: 00007ff65dacb39d (address_space_specific<1, 3, 0, (util::endianness)1>::write_dword(unsigned int, unsigned int)+0x004d)
  000000878a4f95d8: 000001dd68873024 (+0x68873024)
  000000878a4f95e0: 000000000000000a (+0x000a)
  000000878a4f9620: 00007ff65c797eda (mcs51_cpu_device::sfr_read(unsigned long long)+0x005a)
  000000878a4f9650: 00007ff65c79b879 (mcs51_cpu_device::iram_read(unsigned long long)+0x0039)

Things to note:

I will build a debug build from git and try and reproduce it there, but maybe someone else with a debug build handy can already confirm it

Pinging @FlyGoat and @MooglyGuy (this might be related to the recent REX3 changes)

FlyGoat commented 1 year ago

Does revert REX3 change commit help?

darkstar commented 1 year ago

The screen shift can be resolved by setenv monitor h in the PROM. My bad, I remember doing it in the past to fix the issue.

I'm currently bisecting the crash during the login screen

darkstar commented 1 year ago

This is the commit causing the crashes on the login screen

0b513144cbe45330659dae245acc09b2ba7dd368 is the first bad commit
commit 0b513144cbe45330659dae245acc09b2ba7dd368
Author: Jiaxun Yang
Date:   Mon Nov 14 16:19:27 2022 +0000

    newport: Split out iterator setup stage (#10546)

    In REX3, iterator setup should be a dedicated operation that
    is only execuated if
    a). A Draw command is execuated with DoSetup at DRAWMODE0 set
    or
    b). A host write is issued to SETUP register

    At setup stage REX3 will calcuate quadrant for a block or span
    drawcall or octant together with some Bresenham parameters for
    a line drawcall.

    Linux newport_con driver is rely on this behavior to use quadrant
    calculated by previous draw call to render characters.

    Fixes: #9667

 src/devices/bus/gio64/newport.cpp | 70 ++++++++++++++++++++++++++++++++++++---
 src/devices/bus/gio64/newport.h   |  1 +
 2 files changed, 67 insertions(+), 4 deletions(-)
FlyGoat commented 1 year ago

Will try to debug.