flightlessmango / MangoHud

A Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more. Discord: https://discordapp.com/invite/Gj5YmBb
MIT License
6.52k stars 288 forks source link

No GPU load shown on Intel Arc (post #1372 fix) #1478

Open Schlaefer opened 2 days ago

Schlaefer commented 2 days ago

No GPU load shown on Intel Arc.

List relevant hardware/software information

Operating System: CachyOS Linux KDE Plasma Version: 6.2.3 KDE Frameworks Version: 6.8.0 Qt Version: 6.8.0 Kernel Version: 6.11.7-2-cachyos (64-bit) Graphics Platform: Wayland Graphics Processor: Mesa Intel® Arc Mesa: 24.2.7 Driver: i915

To Reproduce Steps to reproduce the behavior:

  1. Install AUR package mangohud-git
  2. Start vkcube with MANGOHUD=1 vkcube

Expected behavior See GPU load with MANGOHUD=1 vkcube

Screenshots

Screenshot_20241114_201010

Additional context

With #1372 fixed I wanted to give it a try but didn't get any output. With logging:

[2024-11-14 20:15:00.172] [MANGOHUD] [debug] [gpu.cpp:69] GPU Found: node_name: renderD128, vendor_id: 8086 device_id: 56a1 pci_dev: 0000:03:00.0
[2024-11-14 20:15:00.172] [MANGOHUD] [debug] [gpu.cpp:165] failed to find active GPU

Checking the fdinfo for that process it seems there's no drm-driver and no drm-engine-gfx entry:

$ grep -R * | grep drm-
4:drm-pdev:     0000:03:00.0
4:drm-total-system0:    0
4:drm-shared-system0:   0
4:drm-active-system0:   0
4:drm-resident-system0: 0
4:drm-purgeable-system0:        0
4:drm-total-local0:     0
4:drm-shared-local0:    0
4:drm-active-local0:    0
4:drm-resident-local0:  0
4:drm-purgeable-local0: 0
4:drm-total-stolen-local0:      0
4:drm-shared-stolen-local0:     0
4:drm-active-stolen-local0:     0
4:drm-resident-stolen-local0:   0
4:drm-purgeable-stolen-local0:  0
4:drm-engine-render:    0 ns
4:drm-engine-copy:      0 ns
4:drm-engine-video:     0 ns
4:drm-engine-video-enhance:     0 ns
4:drm-engine-compute:   0 ns
6:drm-pdev:     0000:03:00.0
6:drm-total-system0:    2460 KiB
6:drm-shared-system0:   0
6:drm-active-system0:   0
6:drm-resident-system0: 2460 KiB
6:drm-purgeable-system0:        0
6:drm-total-local0:     13792 KiB
6:drm-shared-local0:    3264 KiB
6:drm-active-local0:    0
6:drm-resident-local0:  9696 KiB
6:drm-purgeable-local0: 64 KiB
6:drm-total-stolen-local0:      0
6:drm-shared-stolen-local0:     0
6:drm-active-stolen-local0:     0
6:drm-resident-stolen-local0:   0
6:drm-purgeable-stolen-local0:  0
6:drm-engine-copy:      0 ns
6:drm-engine-video:     0 ns
6:drm-engine-video-enhance:     0 ns
6:drm-engine-compute:   0 ns

Skipping the tests in gpu.c and returning early with a manual gpu->is_active = true; gives the expected result:

Screenshot_20241114_202856

flightlessmango commented 1 day ago

According to the fdinfo, it doesn't look like the GPU is being utilized. Is it possible you're using a software vulkan driver or something?

Schlaefer commented 1 day ago

My bad, improper use of grep above. This is the correct observation: there's always drm-driver and drm-pdev, but drm-engine-gfx is missing. Another example with glxgears

Screenshot_20241115_105108


Do we need something like this switch for drm-engine-* in the gpu.cpp?

17314642 commented 1 day ago

drm-engine-gfx is for amd cards, so no need to grep for that. Could you make same screenshot again, but this time grep for drm-engine-render?

Schlaefer commented 1 day ago

drm-engine-gfx is for amd cards, so no need to grep for that. Could you make same screenshot again, but this time grep for drm-engine-render?

Sorry, no domain knowledge before filing this and not a C programmer. So from what I understand drm-engine-render is Intel and drm-engine-gfx is AMD. Yes, drm-engine-render does always exist.

Screenshot_20241115_152705


From what I can observe searching for drm-engine-render and some more logging in gpu.cpp:

                if (line.find("drm-engine-render:") != std::string::npos) {
                    uint64_t render_time = std::stoull(line.substr(line.find(":") + 1));
                    SPDLOG_DEBUG("render_time: {}", render_time);
                    if (render_time > 0) {
                        has_drm_engine_gfx = true;
                    }
                }
            }

            SPDLOG_DEBUG("has_drm_driver: {}, has_drm_engine_gfx: {}", has_drm_driver, has_drm_engine_gfx);
            if (has_drm_driver && has_drm_engine_gfx) {

vlkcube

[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:69] GPU Found: node_name: renderD128, vendor_id: 8086 device_id: 56a1 pci_dev: 0000:03:00.0
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:126] render_time: 0
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: true, has_drm_engine_gfx: false
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:126] render_time: 358280
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: true, has_drm_engine_gfx: true
[2024-11-15 16:04:05.352] [MANGOHUD] [debug] [gpu.cpp:138] Active GPU Found: node_name: renderD128, pci_dev: 0000:03:00.0

Works as expected and outputs GPU data.

Screenshot_20241115_160747

glxgears

[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:69] GPU Found: node_name: renderD128, vendor_id: 8086 device_id: 56a1 pci_dev: 0000:03:00.0
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:126] render_time: 0
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: true, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:126] render_time: 0
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: true, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:126] render_time: 0
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: true, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:126] render_time: 0
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: true, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:133] has_drm_driver: false, has_drm_engine_gfx: false
[2024-11-15 16:05:39.841] [MANGOHUD] [debug] [gpu.cpp:167] failed to find active GPU

Still throws a failed to find active GPU because render time is 0 at time of checking, but does actually shows GPU data. Render time increases checking /proc/... while program is running though.

Screenshot_20241115_160734

17314642 commented 13 hours ago

Weird, on my system with compiled mangohud-git I have GPU usage just fine, even with those lines in log:

[2024-11-16 18:38:13.904] [MANGOHUD] [debug] [vulkan.cpp:1860] gpu: Intel(R) Arc(tm) A770 Graphics (DG2)
[2024-11-16 18:38:13.906] [MANGOHUD] [debug] [vulkan.cpp:720] Recreating font image
[2024-11-16 18:38:13.925] [MANGOHUD] [debug] [vulkan.cpp:739] Default font tex size: 1024x2048px
[2024-11-16 18:38:13.927] [MANGOHUD] [debug] [gpu.cpp:69] GPU Found: node_name: renderD128, vendor_id: 8086 device_id: 56a0 pci_dev: 0000:03:00.0
[2024-11-16 18:38:13.928] [MANGOHUD] [debug] [gpu.cpp:165] failed to find active GPU