Skip to content

gfxinfo: add other sysfs location for the GPU devices

Dmitry Baryshkov requested to merge lumag/ci-tron:dt-gfxinfo into main

Gfxinfo will look up GPU only in /proc/device-tree/gpu*, which means only root nodes. Per the DeviceTree standard GPU usually a part of the SoC, so it can be nested under /soc*/. Instead of looking for GPU devices under /soc@0 and its subdirs, look for the corresponding platform device and fetch OF node from that device.

E.g. on Qualcomm devices:

$ ls -l /sys/bus/platform/devices/*gpu -d
lrwxrwxrwx 1 root root 0 Jan  1  1970 /sys/bus/platform/devices/3d00000.gpu -> ../../../devices/platform/soc@0/3d00000.gpu

$ ls -l /sys/bus/platform/devices/*gpu/of_node
lrwxrwxrwx 1 root root 0 Feb 20 03:32 /sys/bus/platform/devices/3d00000.gpu/of_node -> ../../../../firmware/devicetree/base/soc@0/gpu@3d00000
$ hexdump -C  /sys/bus/platform/devices/*gpu/of_node/compatible
00000000  71 63 6f 6d 2c 61 64 72  65 6e 6f 2d 36 39 30 2e  |qcom,adreno-690.|
00000010  30 00 71 63 6f 6d 2c 61  64 72 65 6e 6f 00        |0.qcom,adreno.|
0000001e

Generated result: {"tags": ["dt_gpu:vendor:qcom", "dt_gpu:model:adreno-690.0"], "structured_tags": {"type": "devicetree", "vendor": "qcom", "model": "adreno-690.0"}, "base_name": "qcom-adreno-690.0"}

Signed-off-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org

Edited by Dmitry Baryshkov

Merge request reports