From 2508b2e86b16fbf984fe141a95a21dab6b0e5011 Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Sun, 22 Jun 2025 14:10:15 +0100 Subject: [PATCH] redesign gpu visual debugging windows --- src/qt/CMakeLists.txt | 4 + src/qt/qt_gpudebug_visualnv.cpp | 54 ++++++++ src/qt/qt_gpudebug_visualnv.hpp | 40 ++++++ src/qt/qt_gpudebug_visualnv.ui | 154 ++++++++++++++++++++++ src/qt/qt_gpudebug_vram.ui | 20 +-- src/qt/qt_mainwindow.cpp | 11 ++ src/qt/qt_mainwindow.hpp | 3 +- src/qt/qt_mainwindow.ui | 2 +- src/video/nv/nv3/render/nv3_render_blit.c | 13 +- src/video/vid_mda.c | 6 +- 10 files changed, 285 insertions(+), 22 deletions(-) create mode 100644 src/qt/qt_gpudebug_visualnv.cpp create mode 100644 src/qt/qt_gpudebug_visualnv.hpp create mode 100644 src/qt/qt_gpudebug_visualnv.ui diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 64bcd01e5..5be854154 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -157,6 +157,10 @@ add_library(ui STATIC qt_gpudebug_vram.hpp qt_gpudebug_vram.ui + qt_gpudebug_visualnv.cpp + qt_gpudebug_visualnv.hpp + qt_gpudebug_visualnv.ui + qt_harddrive_common.cpp qt_harddrive_common.hpp qt_models_common.cpp diff --git a/src/qt/qt_gpudebug_visualnv.cpp b/src/qt/qt_gpudebug_visualnv.cpp new file mode 100644 index 000000000..4c0a52dde --- /dev/null +++ b/src/qt/qt_gpudebug_visualnv.cpp @@ -0,0 +1,54 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * GPU Debugging Tools - VRAM Viewer implementation + * + * + * + * Authors: starfrost + * + * Copyright 2025 starfrost + */ + +/* C++ includes */ +#include +#include + + +/* Qt includes*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ui_qt_gpudebug_visualnv.h" + +/* 86Box core includes */ +extern "C" +{ + +} + +VisualNVDialog::VisualNVDialog(QWidget *parent) + : QDialog(parent) + , ui(new Ui::VisualNVDialog) +{ + ui->setupUi(this); +} + +VisualNVDialog::~VisualNVDialog() +{ + +} \ No newline at end of file diff --git a/src/qt/qt_gpudebug_visualnv.hpp b/src/qt/qt_gpudebug_visualnv.hpp new file mode 100644 index 000000000..175d1c28a --- /dev/null +++ b/src/qt/qt_gpudebug_visualnv.hpp @@ -0,0 +1,40 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * GPU Debugging Tools - VRAM Viewer headers + * + * + * + * Authors: starfrost + * + * Copyright 2025 starfrost + */ + + +#pragma once + +#include + +namespace Ui +{ + class VisualNVDialog; +} + +class VisualNVDialog : public QDialog +{ + Q_OBJECT + + public: + explicit VisualNVDialog(QWidget *parent = nullptr); + ~VisualNVDialog(); + protected: + private: + Ui::VisualNVDialog* ui; + + +}; \ No newline at end of file diff --git a/src/qt/qt_gpudebug_visualnv.ui b/src/qt/qt_gpudebug_visualnv.ui new file mode 100644 index 000000000..e103ff03e --- /dev/null +++ b/src/qt/qt_gpudebug_visualnv.ui @@ -0,0 +1,154 @@ + + + VisualNVDialog + + + + 0 + 0 + 600 + 350 + + + + + 0 + 0 + + + + + 600 + 350 + + + + + 600 + 350 + + + + Nvidia GPU Realtime Debugger + + + + + + + + 10 + 0 + 201 + 171 + + + + PFIFO State + + + + + + 220 + 0 + 361 + 171 + + + + PGRAPH State + + + + + + 10 + 180 + 571 + 141 + + + + VRAM Control + + + + + 160 + 30 + 104 + 21 + + + + + + + 10 + 30 + 151 + 16 + + + + <html><head/><body><p>VRAM Visual Aperture Start</p></body></html> + + + + + + 420 + 30 + 91 + 16 + + + + <html><head/><body><p>FB Start Address:</p></body></html> + + + + + + 510 + 30 + 49 + 16 + + + + <html><head/><body><p><span style=" font-weight:700;">PLACEHOLDER 9000</span></p></body></html> + + + + + + 160 + 60 + 104 + 21 + + + + + + + 10 + 60 + 151 + 16 + + + + <html><head/><body><p>Pixel Depth</p></body></html> + + + + + + + + + + diff --git a/src/qt/qt_gpudebug_vram.ui b/src/qt/qt_gpudebug_vram.ui index 12c64e3b4..8118f0613 100644 --- a/src/qt/qt_gpudebug_vram.ui +++ b/src/qt/qt_gpudebug_vram.ui @@ -32,16 +32,6 @@ VRAM Viewer - - - - VRAM - - - Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop - - - @@ -52,6 +42,16 @@ + + + + VRAM + + + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop + + + diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index eb238051f..7a9132031 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -24,6 +24,7 @@ #include "qt_mainwindow.hpp" #include "qt_gpudebug_vram.hpp" +#include "qt_gpudebug_visualnv.hpp" #include "ui_qt_mainwindow.h" #include "qt_specifydimensions.h" @@ -2326,4 +2327,14 @@ void MainWindow::on_actionDebug_GPUDebug_VRAM_triggered() debugVramDialog.setWindowFlag(Qt::WindowTitleHint, true); debugVramDialog.setWindowFlag(Qt::WindowSystemMenuHint, false); debugVramDialog.exec(); +} + + +void MainWindow::on_actionDebug_GPUDebug_VisualNv_triggered() +{ + VisualNVDialog visualNvDialog(this); + visualNvDialog.setWindowFlag(Qt::CustomizeWindowHint, true); + visualNvDialog.setWindowFlag(Qt::WindowTitleHint, true); + visualNvDialog.setWindowFlag(Qt::WindowSystemMenuHint, false); + visualNvDialog.exec(); } \ No newline at end of file diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 5cda49fa8..c71dd1ffd 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -128,7 +128,8 @@ private slots: void on_actionEnable_Discord_integration_triggered(bool checked); void on_actionRenderer_options_triggered(); void on_actionDebug_GPUDebug_VRAM_triggered(); - + void on_actionDebug_GPUDebug_VisualNv_triggered(); + void refreshMediaMenu(); void showMessage_(int flags, const QString &header, const QString &message, bool richText, std::atomic_bool* done = nullptr); void getTitle_(wchar_t *title); diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 2861b65be..762361ae1 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -914,7 +914,7 @@ - GPU Debug - NV3 Visual Debugger + GPU Realtime Debugger (NVIDIA ONLY) diff --git a/src/video/nv/nv3/render/nv3_render_blit.c b/src/video/nv/nv3/render/nv3_render_blit.c index 596d7b7a1..9bf87ec6d 100644 --- a/src/video/nv/nv3/render/nv3_render_blit.c +++ b/src/video/nv/nv3/render/nv3_render_blit.c @@ -134,9 +134,8 @@ void nv3_render_blit_screen2screen(nv3_grobj_t grobj) if ((grobj.grobj_0 >> NV3_PGRAPH_CONTEXT_SWITCH_DST_BUFFER2_ENABLED) & 0x01) dst_buffer = 2; if ((grobj.grobj_0 >> NV3_PGRAPH_CONTEXT_SWITCH_DST_BUFFER3_ENABLED) & 0x01) dst_buffer = 3; - - nv3_coord_16_t old_position = nv3->pgraph.blit.point_in; - nv3_coord_16_t new_position = nv3->pgraph.blit.point_out; + nv3_coord_16_t in_position = nv3->pgraph.blit.point_in; + nv3_coord_16_t out_position = nv3->pgraph.blit.point_out; /* Coordinates for copying an entire line at a time */ uint32_t buf_position = 0, vram_position = 0, size_x = nv3->pgraph.blit.size.x; @@ -159,10 +158,10 @@ void nv3_render_blit_screen2screen(nv3_grobj_t grobj) { buf_position = (nv3->pgraph.blit.size.x * y); /* shouldn't matter in non-wtf mode */ - vram_position = nv3_render_get_vram_address_for_buffer(old_position, dst_buffer); + vram_position = nv3_render_get_vram_address_for_buffer(in_position, src_buffer); memcpy(&nv3_s2sb_line_buffer[buf_position], &nv3->nvbase.svga.vram[vram_position], size_x); - old_position.y++; + in_position.y++; /* 32bit buffer */ } @@ -170,9 +169,9 @@ void nv3_render_blit_screen2screen(nv3_grobj_t grobj) for (int32_t y = 0; y < nv3->pgraph.blit.size.y; y++) { buf_position = (nv3->pgraph.blit.size.x * y); - vram_position = nv3_render_get_vram_address_for_buffer(new_position, src_buffer); + vram_position = nv3_render_get_vram_address_for_buffer(out_position, dst_buffer); memcpy(&nv3->nvbase.svga.vram[vram_position], &nv3_s2sb_line_buffer[buf_position], size_x); - new_position.y++; + out_position.y++; } } \ No newline at end of file diff --git a/src/video/vid_mda.c b/src/video/vid_mda.c index 7b6e54806..63bb2df07 100644 --- a/src/video/vid_mda.c +++ b/src/video/vid_mda.c @@ -317,7 +317,7 @@ mda_standalone_init(UNUSED(const device_t *info)) mda->vram = malloc(0x1000); - switch(device_get_config_int("font")) { + switch (device_get_config_int("font")) { case 0: loadfont(FONT_IBM_MDA_437_PATH, 0); break; @@ -375,7 +375,7 @@ mda_speed_changed(void *priv) } static const device_config_t mda_config[] = { - // clang-format off + // clang-format off { .name = "rgb_type", .description = "Display type", @@ -411,7 +411,7 @@ static const device_config_t mda_config[] = { .bios = { { 0 } } }, { .name = "", .description = "", .type = CONFIG_END } - // clang-format on + // clang-format on }; const device_t mda_device = {