Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
08302 Graphics Major Always Apr 24, 2022, 20:15 May 16, 2022, 23:20
Tester Augusto View Status Public Platform SDLMAME
Assigned To Resolution No change required OS Linux (64-bit)
Status [?] Closed Driver
Version 0.242 Fixed in Version Build 64-bit
Fixed in Git Commit Github Pull Request #
Summary 08302: BGFX using all cpu cores even not being rendered any graphics onscreen
Description Ubuntu 20.04.3 totally updated in current date using kernel 5.17 FX-6300 3.5 GHz 6 cores and nvidia driver 470 GT 640 1 GB.
Using SDLMAME 0.242.
If BGFX is selected when mame is being started in main game select GUI even only rendering an simple list of games is being used all cpus cores and less of 10 % GPU usage at point not is possible start any game in 100 % speed.
That problem happen if selecting both backend opengl or vulkan.
If selecting instead opengl return the normal mame speed.

That problem also is happening in windows or only in Linux ?
Thanks for read and have an nice week.
Steps To Reproduce
Additional Information
Github Commit
Regression Version
Affected Sets / Systems
Attached Files
png file icon WindowOpenGL.png (112,430 bytes) May 7, 2022, 03:41 Uploaded by ozfalcon
png file icon WindowUIVulcan.png (289,154 bytes) May 7, 2022, 03:41 Uploaded by ozfalcon
png file icon WindowVulcan.png (111,627 bytes) May 7, 2022, 03:42 Uploaded by ozfalcon
There are no relationship linked to this issue.
User avatar
Apr 25, 2022, 11:02
With some quick testing of -video bgfx in Windows and watching processor performance, I don't see any type of excessive CPU use when navigating menu in a -window compared to d3d or opengl. I'd have to think it is more of a non-windows/video driver issue of some type than something MAME can control.
User avatar
Apr 27, 2022, 10:46
edited on: Apr 27, 2022, 11:32
I understand you mentioned opengl/vulkan are similar. Please confirm your GPU operation, see my notes below.

Run mame with -bgfx_debug and confirm your running mode and device in the top left of the screen

Please make sure when using Vulkan, MAME is running with GPU Vulkan drivers and not the MESA software implementation, I found Ubuntu 22.04 was selecting MESA lavapipe in for Vulkan on my system instead of the GPU icd file, lavapipe is MESA's software vulkan implementation

I worked around this (i expect its a distro issue) issue here by forcing the Vulkan icd file at launch for my AMD card with (yours will be different):
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json ./mame ...

--- kept for reference ---

This seems to be happening for me, If rendering the gameslist only,
$ mame -video bgfx -bgfx_backend vulkan
Fullscreen: approx 30% usage all cores
Windowed: approx 20% usage all cores

$ mame -video bgfx -bgfx_backend opengl
No impact, core usage remained pretty close to normal for system

Running Virtua Racing
$ mame vr
Average speed: 100.00% (29 seconds)
negligable change in core usage
$ mame vr -video bgfx -bgfx_backend opengl
Average speed: 100.00% (32 seconds)
negligable change in core usage
$ mame vr -video bgfx -bgfx_backend vulkan
Average speed: 92.75% (28 seconds)
approx 40-50% all cores

$ mame -version
0.242 (mame0242)

Distro: Ubuntu 22.04 LTS
Kernel: 5.15.0-25-generic
CPU: AMD Ryzen 7 3700X 8-Core Processor
RAM: 32GiB
 Device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (rev e7)
 Driver: 4.6 (Core Profile) Mesa 22.0.1
 Info: AMD Radeon RX 580 Series (polaris10, LLVM 13.0.1, DRM 3.42, 5.15.0-25-generic)
User avatar
May 7, 2022, 03:40
edited on: May 7, 2022, 03:45
Running Debian 11 (Bullseye) using nVidia GT1030 (Budget Card) with nvidia-kernel-460.91.03.
./sdlmamearcade64.V0242.Mainline vr -video bgfx -bgfx_backend vulkan -window
./sdlmamearcade64.V0242.Mainline vr -video bgfx -bgfx_backend vulkan -nowindow
Both appear to use around 23-24% CPU

./sdlmamearcade64.V0242.Mainline vr -video bgfx -bgfx_backend opengl -nowindow
Uses around 23-24% CPU
./sdlmamearcade64.V0242.Mainline vr -video bgfx -bgfx_backend opengl -window
Used around 26-27% CPU

The UI is flipped for Vulkan (See attached images)
User avatar
May 11, 2022, 05:29
Thanks for all replies.
I had used BGFX Auto, OpenGL and Vulkan.
I need more tests before post an reply about an solution fixed it.
User avatar
May 13, 2022, 10:57
Here MAME was the only program using all cpu cores even thus having slow performance, but only if enabling BGFX. Using OpenGL had correct performance.
Thus I had posted here sharing that problem.
The problem was in OS using Mesa when selecting BGFX.
Reinstalling Nvidia driver had fixed it.
Possibly had restored default configuration files.

Thus is how the correct install order :

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install pkg-config
sudo apt-get install build-essential
sudo apt-get install libglvnd-dev
sudo apt-get install libglvnd-dev:i386
sudo apt-get install dkms
sudo apt-get install libc6
sudo apt-get install mesa

and last step installing Nvidia Driver

Nvidia Forums has many topics about that same problem.
Mesa files not having any file named Nvidia.
Is how if Nvidia not allow Mesa accessing Geforce video cards resulting in problems.
Have softwares need Mesa installed even if Mesa not will be used for video API.
Thus is better install before Nvidia driver install.

Now the topic is for reference if others users have the same problem.

Have an nice day.
User avatar
May 16, 2022, 23:20
So, the OP's issues are resolved as a system configuration issue?