Command prime-run sometimes crashes GUI

When running applications with:

prime-run <command>

simples exxample is:

prime-run glxinfo | grep "OpenGL renderer"

i usually get:

OpenGL renderer string: NVIDIA GeForce RTX 4060 Laptop GPU/PCIe/SSE2

but like 1 in 10 cases screen completely freezes
im able to recover with ctrl+alt+F1
after login i see command “successfully” completed

its similar with steam games (sometimes they run other times they freeze GUI), except after ctrl+alt+F1 and login, game isnt running

i have hdmi monitor connected
when i use only laptop screen, i dont have this problem

do you have any idea what could be problem? what logs/settings to check?

I could imagine that it is a bandwidth problem. Note that you run a AMD/INTEL CPU/GPU which can reduce the bandwidth for power saving. Now when you switch the GLX to Nvidia, which has way more bandwidth, it can throttle and or even freeze.

Set the frequency policy to performance with cpupower. Maybe that helps?

However, it just a guess.

i used:

cpupower frequency-set -g performance

but problem still persists

i suspect problem is related to fact that hdmi port is connected to nvidia GPU,
with laptop build-in display (connected to iGPU) i have no problem
its only when using external monitor that this happens