fastfetch-cli / fastfetch

A maintained, feature-rich and performance oriented, neofetch like system information tool.
MIT License
10.69k stars 412 forks source link

[FEAT] Request testing on AMD GPU #1284

Closed CarterLi closed 1 month ago

CarterLi commented 1 month ago

https://gitlab.freedesktop.org/search?search=amdgpu_query_gpu_info&nav_source=navbar&project_id=177&group_id=1155&search_code=true&repository_ref=main

CarterLi commented 1 month ago

https://github.com/fastfetch-cli/fastfetch/commit/b3b6e5fec1ca845193366081ddda55331e7f99ca reworked AMD GPU detection code for Linux. It would be appreciated if someone can actually test it on host.

fastfetch -s gpu --format json --gpu-driver-specific --gpu-temp --gpu-detection-method auto --format json

howyay commented 1 month ago

I get the following with running CI version at 29ae56e :

[
  {
    "type": "GPU",
    "result": [
      {
        "index": null,
        "coreCount": null,
        "coreUsage": null,
        "memory": {
          "dedicated": {
            "total": null,
            "used": null
          },
          "shared": {
            "total": 536870912,
            "used": 242167808
          }
        },
        "driver": "amdgpu",
        "name": "AMD Device 1636 (VGA compatible)",
        "temperature": 37.0,
        "type": "Integrated",
        "vendor": "AMD",
        "platformApi": "DRM (card1)",
        "frequency": 0,
        "deviceId": 4000
      }
    ]
  }
]
CarterLi commented 1 month ago

@howyay What GPU do you actually use?

Did you compile fastfetch yourself, or download it from Github Actions?

howyay commented 1 month ago

Downloaded from Github Action - its the integrated GPU on a 4700U, sorry if that's not what you were looking for! 😅

CarterLi commented 1 month ago

The problem is that the distro you use (NixOS) doesn't follow the standard linux directory so that fastfetch fails to load necessary libraries to make the change work.

But at least I know the fall back path works. It's still very helpful! Thanks.

TimB87 commented 1 month ago

I just compiled the dev branch, hth:

tim@betapictoris ❯ build-fastfetch/fastfetch -s gpu --format json --gpu-driver-specific --gpu-temp --gpu-detection-method auto --format json
_amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
[
  {
    "type": "GPU",
    "result": [
      {
        "index": null,
        "coreCount": null,
        "coreUsage": null,
        "memory": {
          "dedicated": {
            "total": 17163091968,
            "used": 540876800
          },
          "shared": {
            "total": null,
            "used": null
          }
        },
        "driver": "amdgpu",
        "name": "Radeon RX 7700 XT / 7800 XT",
        "temperature": 23.0,
        "type": "Discrete",
        "vendor": "AMD",
        "platformApi": "DRM (card1)",
        "frequency": 0,
        "deviceId": 48000
      }
    ]
  }
]
CarterLi commented 1 month ago

_amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)

Google said that you should make sure that you are in video group

https://gitlab.freedesktop.org/drm/amd/-/issues/1993#note_1356967

TimB87 commented 1 month ago

I just checked and I am in the video group.

However, it works when running with sudo/doas:

tim@betapictoris ❯ doas build-fastfetch/fastfetch -s gpu --format json --gpu-driver-specific --gpu-temp --gpu-detection-method auto --format json
[
  {
    "type": "GPU",
    "result": [
      {
        "index": 29822,
        "coreCount": 3,
        "coreUsage": 4.0,
        "memory": {
          "dedicated": {
            "total": 16944787456,
            "used": 575197184
          },
          "shared": {
            "total": null,
            "used": null
          }
        },
        "driver": "amdgpu 3.58",
        "name": "AMD Radeon RX 7800 XT",
        "temperature": 23000.0,
        "type": "Discrete",
        "vendor": "AMD",
        "platformApi": "DRM (card1)",
        "frequency": 2213,
        "deviceId": 48000
      }
    ]
  }
]
CarterLi commented 1 month ago

Thanks @TimB87

Can you pull the latest code and try again?

Also you may try the command without --format json

TimB87 commented 1 month ago

@CarterLi no problem!

I still get the same error though without doas:

❯ build-fastfetch/fastfetch -s gpu --format json --gpu-driver-specific --gpu-temp --gpu-detection-method auto
_amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
[
  {
    "type": "GPU",
    "result": [
      {
        "index": null,
        "coreCount": null,
        "coreUsage": null,
        "memory": {
          "dedicated": {
            "total": 17163091968,
            "used": 565047296
          },
          "shared": {
            "total": null,
            "used": null
          }
        },
        "driver": "amdgpu",
        "name": "Radeon RX 7700 XT / 7800 XT",
        "temperature": 23.0,
        "type": "Discrete",
        "vendor": "AMD",
        "platformApi": "DRM (card1)",
        "frequency": 0,
        "deviceId": 48000
      }
    ]
  }
]
CarterLi commented 1 month ago

I can't fix the permission issue. I fixed some bugs found in your previous post.

TimB87 commented 1 month ago

I am unsure what is missing as e.g. amdgpu_top works just fine.

I ran it through strace and it seems htis is the relevant part of it:

access("/dev/dri/card1", F_OK)          = 0
ioctl(4, DRM_IOCTL_GET_CLIENT, 0x7ffd8db0e5f0) = 0
ioctl(4, DRM_IOCTL_VERSION, 0x559f1e691f40) = 0
ioctl(4, DRM_IOCTL_VERSION, 0x559f1e691f40) = 0
fcntl(4, F_DUPFD_CLOEXEC, 0)            = 5
ioctl(5, DRM_IOCTL_AMDGPU_INFO or DRM_IOCTL_IVPU_SUBMIT, 0x7ffd8db0e560) = -1 EACCES (Permission denied)
write(2, "_amdgpu_device_initialize: amdgp"..., 73_amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
) = 73
close(5)                                = 0
close(4)                                = 0
munmap(0x7fd8a9364000, 45712)           = 0
munmap(0x7fd8a934d000, 93464)           = 0
openat(AT_FDCWD, "/sys/class/drm/card1/device/hwmon/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4

which poped up here: https://gitlab.freedesktop.org/mesa/drm/-/issues/52 Maybe that makes sense to you? I dunno.

btw: I am not a fastfetch user, I saw that ticket calling for testers by accident and thought I can help :-)

CarterLi commented 1 month ago

Thanks for your information. I think I should use render instead of card

TimB87 commented 1 month ago

Feel free to ping me if you want another test with it

CarterLi commented 1 month ago

Can you paste the result running fastfetch with sudo, so I can check if core count and temperature report meaningful values.

TimB87 commented 1 month ago
 ❯ doas build-fastfetch/fastfetch -s gpu --format json --gpu-driver-specific --gpu-temp --gpu-detection-method auto
[
  {
    "type": "GPU",
    "result": [
      {
        "index": null,
        "coreCount": 60,
        "coreUsage": 5.0,
        "memory": {
          "dedicated": {
            "total": 16935841792,
            "used": 606416896
          },
          "shared": {
            "total": null,
            "used": null
          }
        },
        "driver": "amdgpu 3.58",
        "name": "AMD Radeon RX 7800 XT",
        "temperature": 24.0,
        "type": "Discrete",
        "vendor": "AMD",
        "platformApi": "DRM (card1)",
        "frequency": 2213,
        "deviceId": 48000
      }
    ]
  }
]
CarterLi commented 1 month ago

Thanks for your information. I think I should use render instead of card

Should be fixed in 5058a93

@TimB87 Can you test it again?

TimB87 commented 1 month ago

@CarterLi

❯ build-fastfetch/fastfetch -s gpu --format json --gpu-driver-specific --gpu-temp --gpu-detection-method auto
[
  {
    "type": "GPU",
    "result": [
      {
        "index": null,
        "coreCount": 60,
        "coreUsage": 0.0,
        "memory": {
          "dedicated": {
            "total": 16963362816,
            "used": 191377408
          },
          "shared": {
            "total": null,
            "used": null
          }
        },
        "driver": "amdgpu 3.58",
        "name": "AMD Radeon RX 7800 XT",
        "temperature": 23.0,
        "type": "Discrete",
        "vendor": "AMD",
        "platformApi": "DRM (card1)",
        "frequency": 2213,
        "deviceId": 48000
      }
    ]
  }
]
CarterLi commented 1 month ago

Good!