mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-27 19:54:38 +00:00
Clamp the profile VRAM and report its GPU in system_profiler
This commit is contained in:
1 parent
e4e98ea688
commit
f9d7f1a8ab
3 files changed
+28
-6
No files matched your search
@@ -156,3 +156,10 @@ keeps no identity of its own, so it reports the same values as IOKit, including
|
||||
override saved by this tool. A field the guest does not provide is left out.
|
||||
`python3 -m unittest tests.test_system_profiler` checks the output with stub
|
||||
commands.
|
||||
|
||||
`SPDisplaysDataType` reads the host DRM cards. With `DARLING_METAL_MAC_GPU_NAME`
|
||||
set (the launcher default), an AMD or NVIDIA host card is reported as the
|
||||
`MacBookPro16,1` discrete GPU: `AMD Radeon Pro 5500M`, vendor `0x1002`, device
|
||||
`0x7340`, bus PCIe and VRAM from `DARLING_METAL_VRAM_MB` (4096 by default). This
|
||||
keeps the display report consistent with `MTLDevice.name`; without the variable
|
||||
the host card is reported as-is.
|
||||
@@ -35,7 +35,11 @@ pci_name() { # vendor device (hex without 0x) -> "Vendor Model"
|
||||
done
|
||||
}
|
||||
|
||||
displays() { # one line per GPU: vendor|device|vram MB or empty|name
|
||||
displays() { # one line per GPU: vendor|device|vram MB or empty|name|bus
|
||||
# Same switch as the Metal device name: a Mac profile presents the MacBookPro16,1
|
||||
# discrete GPU instead of the host card, so system_profiler and Metal agree.
|
||||
mac_spoof=0
|
||||
case "${DARLING_METAL_MAC_GPU_NAME:-}" in '') ;; 0) ;; *) mac_spoof=1;; esac
|
||||
for card in "$host"/sys/class/drm/card[0-9] "$host"/sys/class/drm/card[0-9][0-9]; do
|
||||
[ -r "$card/device/vendor" ] || continue
|
||||
vendor=$(sed 's/^0x//' "$card/device/vendor"); device=$(sed 's/^0x//' "$card/device/device")
|
||||
@@ -44,7 +48,14 @@ displays() { # one line per GPU: vendor|device|vram MB or empty|name
|
||||
vram=$(awk '{ printf "%d", $1 / 1048576 }' "$card/device/mem_info_vram_total")
|
||||
fi
|
||||
name=$(pci_name "$vendor" "$device"); [ -n "$name" ] || name="Display"
|
||||
echo "$vendor|$device|$vram|$name"
|
||||
bus=builtin
|
||||
if [ "$mac_spoof" = 1 ]; then
|
||||
case "$vendor" in
|
||||
1002|10de) vendor=1002; device=7340; name='AMD Radeon Pro 5500M'
|
||||
vram=${DARLING_METAL_VRAM_MB:-4096}; bus=pcie;;
|
||||
esac
|
||||
fi
|
||||
echo "$vendor|$device|$vram|$name|$bus"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -144,11 +155,11 @@ if [ "$xml" = 1 ]; then
|
||||
SPHardwareDataType) hardware | overview_xml hardware_overview;;
|
||||
SPSoftwareDataType) software | overview_xml os_overview;;
|
||||
SPDisplaysDataType)
|
||||
displays | while IFS='|' read -r vendor device vram name; do
|
||||
displays | while IFS='|' read -r vendor device vram name bus; do
|
||||
name=$(printf '%s' "$name" | escape)
|
||||
echo ' <dict>'
|
||||
echo " <key>_name</key><string>$name</string>"
|
||||
echo ' <key>spdisplays_bus</key><string>spdisplays_builtin</string>'
|
||||
echo " <key>spdisplays_bus</key><string>spdisplays_$bus</string>"
|
||||
echo " <key>spdisplays_device-id</key><string>0x$device</string>"
|
||||
echo " <key>spdisplays_vendor</key><string>${name%% *} (0x$vendor)</string>"
|
||||
[ -z "$vram" ] || echo " <key>spdisplays_vram</key><string>$vram MB</string>"
|
||||
@@ -190,8 +201,9 @@ for type in $types; do
|
||||
SPSoftwareDataType) software | overview_text Software 'System Software Overview';;
|
||||
SPDisplaysDataType)
|
||||
printf 'Graphics/Displays:\n\n'
|
||||
displays | while IFS='|' read -r vendor device vram name; do
|
||||
printf ' %s:\n\n Chipset Model: %s\n Type: GPU\n Bus: Built-In\n' "$name" "$name"
|
||||
displays | while IFS='|' read -r vendor device vram name bus; do
|
||||
[ "$bus" = pcie ] && bus_text=PCIe || bus_text='Built-In'
|
||||
printf ' %s:\n\n Chipset Model: %s\n Type: GPU\n Bus: %s\n' "$name" "$name" "$bus_text"
|
||||
[ -z "$vram" ] || printf ' VRAM (Total): %s MB\n' "$vram"
|
||||
printf ' Vendor: %s (0x%s)\n Device ID: 0x%s\n\n' "${name%% *}" "$vendor" "$device"
|
||||
done;;
|
||||
|
||||
@@ -38,6 +38,9 @@ unset RCLOL_UX_ARG2 RCLOL_UX_ARG2_SLOT
|
||||
# Explicit 0 or an empty value selects the CPU fallback for diagnostics.
|
||||
# DARLING_METAL_MAC_GPU_NAME reports the MacBookPro16,1 GPU of the host vendor (AMD or Intel) as
|
||||
# MTLDevice.name, matching the model IOKit reports; memory figures stay the host's.
|
||||
# VRAM clamp: honor an explicit DARLING_METAL_VRAM_MB, otherwise pin 4096 MB so the
|
||||
# 5500M identity does not leak the host card's heap size.
|
||||
export DARLING_METAL_VRAM_MB="${DARLING_METAL_VRAM_MB:-4096}"
|
||||
for option in RCLOL_GPU_DIRECT_PRESENT RCLOL_GPU_DIRECT_ASYNC RCLOL_GPU_DIRECT_VSYNC DARLING_CA_PRESENT_AT_COMMIT DARLING_CA_SKIP_LOCAL_IOSURFACE_RENDER RCLOL_FORWARD_MOUSE_MOVED RCLOL_MOUSE_CONFINEMENT DARLING_METAL_MAC_GPU_NAME; do
|
||||
eval 'value=${'"$option"'-1}'
|
||||
case "$value" in 0|'') unset "$option";; *) export "$option=$value";; esac
|
||||
|
||||
Reference in new issue
Block a user