@@ -71,7 +71,8 @@ func get_gpu_info() -> GPUInfo:
7171 # to look into vulkaninfo as this can only gather the data
7272 # for the currently active GPU. Vulkaninfo can provide data
7373 # on all detected GPU devices.
74- match RenderingServer .get_video_adapter_vendor ():
74+ gpu_info .vendor = RenderingServer .get_video_adapter_vendor ()
75+ match gpu_info .vendor :
7576 "AMD" , "AuthenticAMD" , 'AuthenticAMD Advanced Micro Devices, Inc.' , "Advanced Micro Devices, Inc. [AMD/ATI]" :
7677 gpu_info .vendor = "AMD"
7778 "Intel" , "GenuineIntel" , "Intel Corporation" :
@@ -160,11 +161,11 @@ func get_kernel_version() -> String:
160161## (e.g. get_gpu_card("card1"))
161162func get_gpu_card (card_dir : String ) -> DRMCardInfo :
162163 var file_prefix := "/" .join (["/sys/class/drm" , card_dir , "device" ])
163- var vendor_id := _get_card_property_from_path ("/" .join ([file_prefix , "vendor" ]))
164- var device_id := _get_card_property_from_path ("/" .join ([file_prefix , "device" ]))
165- var revision_id := _get_card_property_from_path ("/" .join ([file_prefix , "revision" ]))
166- var subvendor_id := _get_card_property_from_path ("/" .join ([file_prefix , "subsystem_vendor" ]))
167- var subdevice_id := _get_card_property_from_path ("/" .join ([file_prefix , "subsystem_device" ]))
164+ var vendor_id := _get_card_property_from_cat ("/" .join ([file_prefix , "vendor" ]))
165+ var device_id := _get_card_property_from_cat ("/" .join ([file_prefix , "device" ]))
166+ var revision_id := _get_card_property_from_cat ("/" .join ([file_prefix , "revision" ]))
167+ var subvendor_id := _get_card_property_from_cat ("/" .join ([file_prefix , "subsystem_vendor" ]))
168+ var subdevice_id := _get_card_property_from_cat ("/" .join ([file_prefix , "subsystem_device" ]))
168169
169170 # Try to load the card info if it already exists
170171 var res_path := "/" .join (["drmcardinfo://" , vendor_id , device_id , subvendor_id , subdevice_id ])
@@ -272,7 +273,7 @@ func get_gpu_cards() -> Array[DRMCardInfo]:
272273 var card_info := get_gpu_card (card_name )
273274 if not card_info :
274275 continue
275-
276+
276277 found_cards .append (card_info )
277278
278279 var vulkan_info := _get_cards_from_vulkan ()
@@ -378,6 +379,16 @@ func _get_card_property_from_path(path: String) -> String:
378379 return FileAccess .get_file_as_string (path ).lstrip ("0x" ).to_lower ().strip_escapes ()
379380
380381
382+ func _get_card_property_from_cat (path : String ) -> String :
383+ var output := []
384+ OS .execute ("cat" , [path ], output )
385+ if output .is_empty ():
386+ return ""
387+ var value := output [0 ] as String
388+ logger .debug ("Got cat output:" , value )
389+ return value .lstrip ("0x" ).to_lower ().strip_escapes ()
390+
391+
381392## Returns a an array of PackedStringArray's that each represent a sing GPU
382393## identified in vulkaninfo.
383394func _get_cards_from_vulkan () -> Array [PackedStringArray ]:
0 commit comments