Fix infill hidden in G-code preview on Linux (forced lite mode) - #581
Fix infill hidden in G-code preview on Linux (forced lite mode)#581lolli42 wants to merge 1 commit into
Conversation
The G-code preview had a Linux-only heuristic (in both the advanced and legacy renderers) that force-enabled "lite mode" whenever it judged memory tight or the preview huge, overriding the user's explicit gcode_preview_lite_mode setting. With lite mode on, infill and other internal toolpaths are hidden and the in-app toggle never sticks (issue CrealityOfficial#512). The memory check used available_physical_memory(), which on Linux returned sysinfo().freeram (MemFree) -- only fully-unused pages. Linux keeps MemFree low by design (idle RAM holds reclaimable page cache), so the "< 2 GB" and "< 12.5% of total" tests fired on essentially every Linux machine regardless of real memory pressure, making lite mode effectively always-on. Remove the override from both renderers so lite mode strictly follows the config value (&& !only_gcode). Also fix available_physical_memory() to report MemAvailable from /proc/meminfo (free + reclaimable cache), falling back to free + buffers on pre-3.14 kernels -- this also corrects the LOD memory estimate in 3DScene.cpp that used the same function.
|
Possibly related data point from a different angle: on an Intel Raptor Lake-U iGPU (8086:a7ac, Mesa 26.0.8, Kubuntu 26.04) the stock 7.2.1 AppImage does not just hide infill — the first draw of the toolpath preview never completes and the kernel resets the GPU context ( Scripted A/B runs on that machine: |
Summary
On Linux, the G-code preview permanently hid infill (and other internal
toolpaths), and the in-app Lite Mode toggle never stuck — regardless of the
gcode_preview_lite_modesetting.Fixes #512
Root cause
Both the advanced renderer (
AdvancedRenderer::load_toolpaths) and the legacyrenderer (
GUI_Preview) contain a Linux-only heuristic that force-enables litemode when it judges memory to be "tight":
avail_bytescomes fromavailable_physical_memory(), which on Linux returnedsysinfo().freeram— i.e. MemFree, only fully-unused pages. Linuxdeliberately keeps MemFree low (idle RAM is used for reclaimable page/buffer
cache), so on virtually any machine
freeramis below 2 GB and below 12.5% oftotal. The heuristic therefore fired unconditionally, overrode the user's
explicit
gcode_preview_lite_mode = false, and left lite mode effectivelyalways-on on Linux — hiding infill and making the toggle appear broken.
Fix
follows
gcode_preview_lite_mode(&& !only_gcode).available_physical_memory()to report MemAvailable from/proc/meminfo(free + reclaimable cache), falling back to free + buffers onpre-3.14 kernels. This also corrects the LOD memory estimate in
3DScene.cpp,which uses the same function and was being throttled on the same bad reading.
Platforms
#if defined(__linux__)or in the Linuxbranch of
available_physical_memory(). Windows/macOS behavior is unchanged.Testing
is_lite_mode=1evenwith
gcode_preview_lite_mode=false.is_lite_mode=0; toggling lite modeon/off (with a re-slice) is now honored.