How do i know which graphics card does the program/game use?

hello i am using fedora kde plasma and i am not an advanced linux user and now my leptop has intel hd 4000 and nvidia gt740m graphics cards and when i run a program how can i find out which video card it is running on?. Or can I choose a special video card for each application?


Welcome to the ask :fedora: forum.

First off we need a little more info about your system.
Please post the output of inxi -Fzxx by copy & paste into the post, and use the preformatted text tags button on the toolbar </> to retain the formatting as seen on your screen.

Also the output of dnf list installed '*nvidia*' if you have already installed the nvidia drivers from rpmfusion.

  Kernel: 6.4.11-200.fc38.x86_64 arch: x86_64 bits: 64 compiler: gcc
    v: 2.39-9.fc38 Desktop: KDE Plasma v: 5.27.6 tk: Qt v: 5.15.10 wm: kwin_x11
    dm: SDDM Distro: Fedora release 38 (Thirty Eight)
  Type: Laptop System: Sony product: SVF1521USTW v: C10HBTKG
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: Sony model: VAIO serial: <superuser required> UEFI: Insyde
    v: R0220DA date: 11/18/2013
  ID-1: BAT1 charge: 41.1 Wh (100.0%) condition: 41.1/42.3 Wh (97.0%)
    volts: 5.2 min: 14.4 model: SONY Corp. VGP-BPS35A serial: <filter>
    status: full
  Info: dual core model: Intel Core i5-3337U bits: 64 type: MT MCP
    arch: Ivy Bridge rev: 9 cache: L1: 128 KiB L2: 512 KiB L3: 3 MiB
  Speed (MHz): avg: 798 min/max: 800/2700 cores: 1: 798 2: 798 3: 798 4: 798
    bogomips: 14367
  Flags: avx ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
  Device-1: Intel 3rd Gen Core processor Graphics vendor: Sony driver: i915
    v: kernel arch: Gen-7 ports: active: HDMI-A-1 off: LVDS-1 empty: DP-1,VGA-1
    bus-ID: 00:02.0 chip-ID: 8086:0166
  Device-2: NVIDIA GK208M [GeForce GT 740M] vendor: Sony driver: nouveau
    v: kernel arch: Kepler pcie: speed: 2.5 GT/s lanes: 8 bus-ID: 01:00.0
    chip-ID: 10de:1292 temp: 42.0 C
  Device-3: Chicony Front Camera driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 bus-ID: 2-1.3:4 chip-ID: 04f2:b3aa
  Display: x11 server: X.Org v: 1.20.14 with: Xwayland v: 22.1.9
    compositor: kwin_x11 driver: X: loaded: modesetting unloaded: fbdev,vesa
    dri: crocus gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1280x720 s-dpi: 96
  Monitor-1: HDMI-A-1 mapped: HDMI-1 pos: primary model: LG (GoldStar) TV
    res: 1280x720 dpi: 68 diag: 551mm (21.7")
  Monitor-2: LVDS-1 note: disabled size-res: N/A
  API: OpenGL v: 4.2 Mesa 23.1.6 renderer: Mesa Intel HD Graphics 4000 (IVB
    GT2) direct-render: Yes
  Device-1: Intel 7 Series/C216 Family High Definition Audio vendor: Sony
    driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:1e20
  API: ALSA v: k6.4.11-200.fc38.x86_64 status: kernel-api
  Server-1: PipeWire v: 0.3.77 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    driver: r8169 v: kernel pcie: speed: 2.5 GT/s lanes: 1 port: 2000
    bus-ID: 0e:00.0 chip-ID: 10ec:8168
  IF: enp14s0 state: down mac: <filter>
  Device-2: Ralink MT7601U Wireless Adapter driver: mt7601u type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 bus-ID: 1-3:2 chip-ID: 148f:7601
  IF: wlp0s20u3 state: up mac: <filter>
  Device-1: Foxconn / Hon Hai BCM43142A0 driver: btusb v: 0.8 type: USB
    rev: 2.0 speed: 12 Mb/s lanes: 1 bus-ID: 2-1.2:3 chip-ID: 0489:e062
  Report: rfkill ID: hci0 rfk-id: 2 state: up address: see --recommends
  Local Storage: total: 298.09 GiB used: 4.47 GiB (1.5%)
  ID-1: /dev/sda vendor: Seagate model: ST320LT007-9ZV142 size: 298.09 GiB
    speed: 3.0 Gb/s serial: <filter>
  ID-1: / size: 296.5 GiB used: 4.21 GiB (1.4%) fs: btrfs dev: /dev/sda3
  ID-2: /boot size: 973.4 MiB used: 245.2 MiB (25.2%) fs: ext4
    dev: /dev/sda2
  ID-3: /boot/efi size: 598.8 MiB used: 17.4 MiB (2.9%) fs: vfat
    dev: /dev/sda1
  ID-4: /home size: 296.5 GiB used: 4.21 GiB (1.4%) fs: btrfs dev: /dev/sda3
  ID-1: swap-1 type: zram size: 3.69 GiB used: 52.5 MiB (1.4%) priority: 100
    dev: /dev/zram0
  System Temperatures: cpu: 48.0 C mobo: N/A gpu: nouveau temp: 42.0 C
  Fan Speeds (RPM): N/A
  Processes: 258 Uptime: 11m Memory: available: 3.69 GiB
  used: 2.57 GiB (69.7%) Init: systemd v: 253 target: graphical (5)
  default: graphical Compilers: N/A Packages: pm: rpm pkgs: N/A
  note: see --rpm Shell: Bash v: 5.2.15 running-in: konsole inxi: 3.3.27

nvidia-gpu-firmware.noarch                             20230310-148.fc38                             @anaconda

The important details I see are that you still using the nouveau drivers on the nvidia adapter and that you are using the X11 DE. You also have the latest kernel it seems but the firmware is way behind the current version which is

# dnf list installed nvidia-gpu-firmware
Installed Packages
nvidia-gpu-firmware.noarch                                        20230804-153.fc38                                         @updates

On most laptops the default config seems to be that an external monitor would be driven by the dGPU and the laptop screen would be driven by the iGPU regardless of the app being used. I know that when using gnome one may select to use the dGPU for an app by right click on the icon and select to use the dedicated gpu. I do not use kde so am not sure about that DE and how to do the same.

It is quite possible to improve the performance of an nvidia gpu in most cases by installing the proprietary nvidia drivers. I don’t know how much improvement you may wish or how much difference there may be between the nvidia driver or the nouveau driver, but I do know that for most nvidia gpus (especially the newer ones from around the time yours was built) the nouveau driver is not able to access hardware acceleration on the gpu so gaming and other graphics intensive apps suffer from the need to offload rendering to the cpu. This causes extreme slowdown in output and for everything running on most systems.

To access the hardware acceleration on the gpu you would probably need to install the proprietary nvidia drivers, and your gpu can only use the 470xx driver from rpmfusion.

To install that driver one needs to first enable the rpmfusion repos as shown here.

Then installing the nvidia driver would be
sudo dnf install akmod-nvidia-470xx xorg-x11-drv-nvidia-470xx-cuda.

Once installed it is possible to enable the nvidia gpu to access both internal screens and external monitors by following the steps here in all ways including step #8 except for editing the file. If you wish to use the nvidia gpu full time then complete the editing in step #8 as well.

I have installed nvidia drivers but it gives me this error at system startup nvidia kernel missing . falling back to nouveau
and I see the nvidia driver from the cpu x program is still using nouveau.

and here is my dnf list installed '*nvidia*' output

Installed Packages
akmod-nvidia-470xx.x86_64                       3:470.199.02-1.fc38 @rpmfusion-nonfree-nvidia-driver
kmod-nvidia-470xx-6.4.11-200.fc38.x86_64.x86_64 3:470.199.02-1.fc38 @@commandline
nvidia-gpu-firmware.noarch                      20230804-153.fc38   @updates
nvidia-persistenced.x86_64                      3:535.98-1.fc38     @rpmfusion-nonfree-nvidia-driver
nvidia-settings-470xx.x86_64                    3:470.199.02-1.fc38 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-470xx.x86_64                3:470.199.02-1.fc38 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-470xx-cuda.x86_64           3:470.199.02-1.fc38 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-470xx-cuda-libs.i686        3:470.199.02-1.fc38 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-470xx-cuda-libs.x86_64      3:470.199.02-1.fc38 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-470xx-kmodsrc.x86_64        3:470.199.02-1.fc38 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-470xx-libs.i686             3:470.199.02-1.fc38 @rpmfusion-nonfree-nvidia-driver
xorg-x11-drv-nvidia-470xx-libs.x86_64           3:470.199.02-1.fc38 @rpmfusion-nonfree-nvidia-driver

note: my secure boot enable (and i cant disable it :slight_smile: )
plus note : i can exchange x11 with wayland from sigin menu

Since you have already installed the nvidia drivers and cannot disable secure boot that means the kernel modules must be signed before they will load.

Instructions on how to do that are found in /usr/share/doc/akmods/README.secureboot

  1. create and import the key as instructed, including the reboot and import during the reboot.
  2. after the reboot then remove the unsigned kernel modules with sudo dnf remove kmod-nvidia-470xx-6.4.11-200.fc38.x86_64
  3. Rebuild the kernel modules (signed this time) with sudo akmods --force
  4. After allowing adequate time for akmods to complete and the signed modules to be properly installed (at least 5 minutes) then reboot again. This time the modules should load.
  5. Loading of the modules can be verified with lsmod | grep nvidia which should return several lines showing the nvidia modules.

If this fails then let us know and we can try to determine why the failure.

When I entered this command $ /usr/sbin/kmodgenca , it asked me for a password and I entered my user password and output is

$ /usr/sbin/kmodgenca
Update cacert.config...
/usr/sbin/kmodgenca: line 103: /etc/pki/akmods/cacert.config: Permission denied
Generate new keypair...
sg: failed to crypt password with previous salt: Invalid argument
chmod: cannot access '/etc/pki/akmods/certs/fedora-2241557454.*': Permission denied
chmod: cannot access '/etc/pki/akmods/private/fedora-2241557454.*': Permission denied
/usr/sbin/restorecon: lstat(/etc/pki/akmods/certs/fedora-2241557454.der) failed: Permission denied
/usr/sbin/restorecon: lstat(/etc/pki/akmods/private/fedora-2241557454.priv) failed: Permission denied
ln: failed to access '/etc/pki/akmods/certs/public_key.der': Permission denied
ln: failed to access '/etc/pki/akmods/private/private_key.priv': Permission denied

when I entered this command $ sudo /usr/sbin/kmodgenca did not give any error or output

[sony@fedora ~]$ sudo /usr/sbin/kmodgenca
[sudo] password for sony: 
[sony@fedora ~]$ 

and when i input this command sudo mokutil --import /etc/pki/akmods/certs/public_key.der
Did it ask to create a password and then I reset the machine but MOK Management did not open as it was written in the instructions

than i checked with this command $ sudo mokutil --test-key /etc/pki/akmods/certs/public_key.
der and the output

[sudo] password for sony: 
/etc/pki/akmods/certs/public_key.der is not enrolled

The sudo mokutil --import step will need to be repeated, using a simple password, then reboot and when the blue screen appears during boot follow the given steps exactly to import and activate the key in bios. Then after the reboot completes and the test to verify the key is imported properly is successful, complete the remaining steps to get the driver signed and in use.

Note that these steps to import the key may not work properly if the bios is set to CSM mode, but should work if set to UEFI ONLY.

Actually, when I say I cannot disable security boot, i mean my laptop screen is broken :disappointed:, I can only mirror it to the external screen by using the linux operating system :slight_smile: .

And after I did the mokutil --import step, when I reset the machine, it turned back on automatically.
What I want to understand is if I don’t take any action when the blue screen comes, does it skip this blue screen by itself?

Suppose I can’t install new drivers for nvidia, and it mean I can’t run the game/program I want with nvidia with Nouveau driver?

Suppose I cannot run the program I want with the Nouveau driver, so how can I find out which GPU a program or game is running through?

Yes, there is a timeout on the mokutil blue screen during boot. I am not certain what that is but it seems it was about 5 seconds. If you do not respond the blue screen will not reappear unless you repeat the mokutil --import step.

Pressing enter at each step should get you to the last screen where the password is entered and import actually occurs

sudo mokutil --test-key /etc/pki/akmods/certs/public_key.der
output is
/etc/pki/akmods/certs/public_key.der is already enrolled

and sudo mokutil --list-enrolled | grep Issuer

        Issuer: CN=Fedora Secure Boot CA
                CA Issuers - URI:
        Issuer: O=fedora, OU=fedora/emailAddress=akmods@fedora, L=None, ST=None, C=US, CN=fedora-1061292005

then I continued to follow the instructions you gave

output of lsmod | grep nvidia command

nvidia_drm             81920  2
nvidia_modeset       1511424  2 nvidia_drm
nvidia_uvm           2760704  0
nvidia              40693760  73 nvidia_uvm,nvidia_modeset
video                  77824  3 i915,sony_laptop,nvidia_modeset

and I didn’t get the kernel missing message on system startup

That looks like the modules are properly signed and now have loaded.

Good work and enjoy! :+1:

1 Like

So now, can I decide on which GPU to open the program I want, or should I do these steps first?

I note you are on kde so cannot confirm it is the same, but with gnome, once the drivers for nvidia are properly loaded then by right-clicking on the desktop icon you should get a menu that will allow you to run the app on the discrete gpu. If you just click as normal then it runs on the iGPU by default.

I neglected to note that the changes done with that link only apply when running the xorg DE.

Thank you for the replys, But If i folow this instruction , do you think I should follow the command in step 4, will this affect the nvidia drivers I have installed?
note: I will not apply step 8