From 35cb8a4cf2f6ca1c04df2250e2ce69407ccdd6f8 Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Mon, 10 Feb 2025 02:32:02 +0000 Subject: [PATCH] Fix subchannel free detection. --- .../nv3 driver init status_2025-02-10.txt | 96 +++++++++++++++++++ .../nv3 driver status_CURRENT.txt | 4 - src/include/86box/nv/vid_nv3.h | 2 +- src/video/nv/nv3/subsystems/nv3_pfifo.c | 7 +- src/video/nv/nv3/subsystems/nv3_user.c | 2 +- 5 files changed, 102 insertions(+), 9 deletions(-) create mode 100644 doc/nvidia_notes/nv3 driver init status_2025-02-10.txt delete mode 100644 doc/nvidia_notes/nv3 driver status_CURRENT.txt diff --git a/doc/nvidia_notes/nv3 driver init status_2025-02-10.txt b/doc/nvidia_notes/nv3 driver init status_2025-02-10.txt new file mode 100644 index 000000000..c76e79743 --- /dev/null +++ b/doc/nvidia_notes/nv3 driver init status_2025-02-10.txt @@ -0,0 +1,96 @@ +nv3_disp: + +0x10fe -> DrvBitBlt +0x19be -> DrvCopyBits +0x597c -> DrvCreateDeviceBitmap +0x5a6e -> DrvDeleteDeviceBitmap +0x60b8 -> DrvTextOut +0x6248 -> DrvDestroyFont +0x64b8 -> DrvRealizeBrush +0x6a46 -> DrvDitherColor +0x797a -> DrvGetDirectDrawInfo +0x7b14 -> DrvEnableDirectDraw +0x7b70 -> DrvDisableDirectDraw +0x817c -> DrvPaint +0x81c2 -> DrvResetPDEV +0x82dc -> DrvEnableDriver +0x8312 -> DrvEnablePDEV +0x83ee -> DrvDisablePDEV +0x840a -> DrvCompletePDEV +0x8418 -> DrvSynchronise +0x845a -> DrvEnableSurface +0x851a -> DrvDisableSurface +0x8554 -> DrvAssertMode +0x8690 -> DrvGetModes +0xe59a -> DrvEscape +0xf3ee -> DrvFillPath +0xf3f6 -> DrvStrokePath +0xfa08 -> DrvLineTo +0x12fee -> DrvSetPalette +0x132a4 -> DrvMovePointer +0x13d20 -> DrvSetPointerShape +0x13dea -> DrvStretchBlt +0x147f2 -> DrvSetPixelFormat +0x1483c -> DrvDescribePixelFormat +0x1495a -> DrvClipChanged +0x255b8 -> DrvSwapBuffers + +DrvEnableDriver SUCCESS +DrvEnablePDEV SUCCESS 23:28 09/02/2025 + Check for cjCaps >= 0x130 && cjDevInfo >= 0x12C SUCCESS 23:31 09/02/2025 + EngAllocMem call SUCCESS 23:38 09/02/2025 + CreateOglGlobalMemory call SUCCESS 23:40 09/02/2025 + bInitializeModeFields call SUCCESS 23:41 09/02/2025 + bInitializePalette call SUCCESS 23:42 09/02/2025 + EngDeviceIoControl IOCTL 0x232020 (CHECK mini) SUCCESS + EngDeviceIoControl IOCTL 0x232044 (CHECK mini) SUCCESS (eax=0) +DrvCompletePDEV SUCCESS 23:52 09/02/2025 +DrvEnableSurface + bEnableHardware call + EngCreateSemaphore call #1 csCrtc SUCCESS 00:55 10/02/2025 + EngCreateSemaphore call #2 csFifo SUCCESS 00:57 10/02/2025 + EngDeviceIoControl IOCTL 0x230460 SUCCESS 00:57 10/02/2025 + EngDeviceIoControl IOCTL 0x230458 SUCCESS 00:57 10/02/2025 + NvAllocRoot SUCCESS 01:03 10/02/2025 + NvAllocDevice SUCCESS 01:04 10/02/2025 + NV3/NV4 architecture check SUCCESS 01:14 10/02/2025 + bAssertModeHardware call (bEnable=1) FAILURE - HANG/LOOP + EngDeviceIoControl IOCTL 0x23040C] FAILURE 01:27 10/02/2025 + nv3_mini NVStartIO ioctlcode=0x23040C + NVSetMode + NV3SetMode SUCCESS 01:53 10/02/2025 + RmUnloadState SUCCESS 01:48 10/02/2025 + VBESetModeEx SUCCESS 01:51 10/02/2025 + NV_OEMEnableExtensions SUCCESS 01:52 10/02/2025 + UpdateArbitrationSettings SUCCESS 01:52 10/02/2025 + RmLoadState SUCCESS 01:53 10/02/2025 + NV3EnableCursor SUCCESS 01:54 10/02/2025 + NV3WaitUntilFinished SUCCESS Passing 02:23 10/02/2025 + EngDeviceIoControl IOCTL 0x230408 + EngDeviceIoControl IOCTL 0x232024 + NvAllocHardware + bCreateStdPatches(?) + CHECK - NV4 + vDestroyStdPatches(?) + NV3_WaitForOneVerticalRefresh + EngDeviceIoControl IOCTL 0x230410 + + + SET UP CORRECT FUNCTION POINTERS + + _heap_init call + bEnableOffscreenHeap call + bEnablePointer call + bEnableText call + bEnablePalette call + bEnableDirectDraw call + EngCreateBitmap call + EngAssociateBitmap call + + + + + +DrvDisableSurface: ONLY IN THE CASE OF FAILURE + + diff --git a/doc/nvidia_notes/nv3 driver status_CURRENT.txt b/doc/nvidia_notes/nv3 driver status_CURRENT.txt deleted file mode 100644 index f284f7457..000000000 --- a/doc/nvidia_notes/nv3 driver status_CURRENT.txt +++ /dev/null @@ -1,4 +0,0 @@ -Failure condition: - Failed check, causes fifoService call in fifo service init in RM, FifoState STATE_LOAD - - CHECK NVSTARTIO! DEBUG TOMORROW \ No newline at end of file diff --git a/src/include/86box/nv/vid_nv3.h b/src/include/86box/nv/vid_nv3.h index 6b6e0e5d6..aeff3a8ce 100644 --- a/src/include/86box/nv/vid_nv3.h +++ b/src/include/86box/nv/vid_nv3.h @@ -1431,7 +1431,7 @@ void nv3_pfifo_cache1_push(uint32_t addr, uint32_t val); void nv3_pfifo_cache1_pull(); uint32_t nv3_pfifo_cache1_normal2gray(uint32_t val); uint32_t nv3_pfifo_cache1_gray2normal(uint32_t val); -bool nv3_pfifo_cache1_is_free(); +uint32_t nv3_pfifo_cache1_num_free_spaces(); // NV3 PFB void nv3_pfb_init(); diff --git a/src/video/nv/nv3/subsystems/nv3_pfifo.c b/src/video/nv/nv3/subsystems/nv3_pfifo.c index d5a18af03..5fe709ec6 100644 --- a/src/video/nv/nv3/subsystems/nv3_pfifo.c +++ b/src/video/nv/nv3/subsystems/nv3_pfifo.c @@ -185,7 +185,7 @@ uint32_t nv3_pfifo_read(uint32_t address) // Check if Cache1 (0x7C bytes in size depending on gpu?) is full // Based on how the drivers do it - if (!nv3_pfifo_cache1_is_free()) + if (!nv3_pfifo_cache1_num_free_spaces()) ret |= 1 << NV3_PFIFO_CACHE1_STATUS_FULL; if (nv3->pfifo.runout_put != nv3->pfifo.runout_get) @@ -605,7 +605,7 @@ void nv3_pfifo_cache1_push(uint32_t addr, uint32_t val) new_address |= (nv3_runout_reason_cache_ran_out << NV3_PFIFO_RUNOUT_RAMIN_ERR); } - if (!nv3_pfifo_cache1_is_free()) + if (!nv3_pfifo_cache1_num_free_spaces()) { oh_shit = true; oh_shit_reason = nv3_runout_reason_free_count_overrun; @@ -718,7 +718,8 @@ void nv3_pfifo_cache1_pull() //Todo: finish it } -bool nv3_pfifo_cache1_is_free() +// THIS IS PER SUBCHANNEL! +uint32_t nv3_pfifo_cache1_num_free_spaces() { // convert to gray code uint32_t real_get_address = nv3_pfifo_cache1_normal2gray(nv3->pfifo.cache1_settings.get_address); diff --git a/src/video/nv/nv3/subsystems/nv3_user.c b/src/video/nv/nv3/subsystems/nv3_user.c index b07bf63b5..43fa72a94 100644 --- a/src/video/nv/nv3/subsystems/nv3_user.c +++ b/src/video/nv/nv3/subsystems/nv3_user.c @@ -40,7 +40,7 @@ uint32_t nv3_user_read(uint32_t address) switch (method_offset) { case NV3_GENERIC_METHOD_IS_PFIFO_FREE: - return nv3_pfifo_cache1_is_free(); + return nv3_pfifo_cache1_num_free_spaces(); }