aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache/texture_cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/texture_cache/texture_cache.h')
-rw-r--r--src/video_core/texture_cache/texture_cache.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index fb8adef161..62cd523073 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -129,6 +129,12 @@ void TextureCache<P>::RunGarbageCollector() {
high_priority_mode = total_used_memory >= expected_memory;
aggressive_mode = allow_aggressive && total_used_memory >= critical_memory;
ticks_to_destroy = aggressive_mode ? 10ULL : high_priority_mode ? 25ULL : 50ULL;
+ // EDEN_NX2_TC_MIN_AGE=<frames>: never evict images used more recently (thrash tests).
+ static const u64 min_age = [] {
+ const char* value = std::getenv("EDEN_NX2_TC_MIN_AGE");
+ return value != nullptr ? std::strtoull(value, nullptr, 10) : 0ULL;
+ }();
+ ticks_to_destroy = (std::max)(ticks_to_destroy, min_age);
num_iterations = aggressive_mode ? 40 : (high_priority_mode ? 20 : 10);
};
const auto Cleanup = [this, &num_iterations, &high_priority_mode, &aggressive_mode](ImageId image_id) {
@@ -150,6 +156,7 @@ void TextureCache<P>::RunGarbageCollector() {
image.DownloadMemory(map, copies);
runtime.Finish();
SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, map.mapped_span, swizzle_data_buffer);
+ ++gc_download_deletes;
}
if (True(image.flags & ImageFlagBits::Tracked)) {
UntrackImage(image, image_id);
@@ -253,7 +260,7 @@ void TextureCache<P>::TickFrame() {
largest.end(), [](const auto& a, const auto& b) { return a.first > b.first; });
for (size_t i = 0; i < std::min<size_t>(12, largest.size()); ++i) {
const Image& image = *largest[i].second;
- LOG_INFO(HW_GPU, " {} MiB: {:#x} {}x{}x{} layers {} levels {} format {} type {} flags {:#x}",
+ LOG_DEBUG(HW_GPU, " {} MiB: {:#x} {}x{}x{} layers {} levels {} format {} type {} flags {:#x}",
largest[i].first >> 20, image.gpu_addr, image.info.size.width, image.info.size.height,
image.info.size.depth, image.info.resources.layers, image.info.resources.levels,
static_cast<u32>(image.info.format), static_cast<u32>(image.info.type),
@@ -263,14 +270,15 @@ void TextureCache<P>::TickFrame() {
for (const auto& [format, total] : by_format) formats.emplace_back(total.first, format);
std::sort(formats.rbegin(), formats.rend());
for (size_t i = 0; i < std::min<size_t>(8, formats.size()); ++i) {
- LOG_INFO(HW_GPU, " format {}: {} MiB in {} images", formats[i].second, formats[i].first >> 20,
+ LOG_DEBUG(HW_GPU, " format {}: {} MiB in {} images", formats[i].second, formats[i].first >> 20,
by_format[formats[i].second].second);
}
if constexpr (requires { runtime.LogMemoryStatistics(); }) {
runtime.LogMemoryStatistics();
}
- LOG_INFO(HW_GPU, "Texture cache last 600 frames: created {} images, deleted {} (collector {}, {} costly), {} async decodes, ASTC {} opaque / {} alpha",
+ LOG_INFO(HW_GPU, "Texture cache last 600 frames: created {} images, deleted {} (collector {}, {} costly, {} downloaded), {} async decodes, ASTC {} opaque / {} alpha",
images_created, images_deleted, gc_deletes + gc_costly_deletes, gc_costly_deletes,
+ gc_download_deletes,
async_decodes_queued, astc_opaque_images, astc_alpha_images);
astc_opaque_images = astc_alpha_images = 0;
std::vector<std::pair<u32, u64>> shapes;
@@ -278,13 +286,13 @@ void TextureCache<P>::TickFrame() {
std::sort(shapes.rbegin(), shapes.rend());
for (size_t i = 0; i < std::min<size_t>(10, shapes.size()); ++i) {
const u64 key = shapes[i].second;
- LOG_INFO(HW_GPU, " created {}x: format {} type {} levels {} layers {} {}x{} (last at {:#x})",
+ LOG_DEBUG(HW_GPU, " created {}x: format {} type {} levels {} layers {} {}x{} (last at {:#x})",
shapes[i].first, key >> 56, (key >> 52) & 0xF, (key >> 48) & 0xF,
(key >> 36) & 0xFFF, (key >> 18) & 0x3FFFF, key & 0x3FFFF,
created_shapes[key].second);
}
created_shapes.clear();
- gc_deletes = gc_costly_deletes = async_decodes_queued = 0;
+ gc_deletes = gc_costly_deletes = gc_download_deletes = async_decodes_queued = 0;
images_created = images_deleted = 0;
}
if (total_used_memory > minimum_memory) {
@@ -1755,7 +1763,7 @@ ImageId TextureCache<P>::InsertImage(const ImageInfo& info, GPUVAddr gpu_addr,
storage_info.native_tiling = gpu_memory->UsesNativeTiling();
if (storage_info.native_tiling && info.type == ImageType::e3D) {
// Switch 2 3D images (lighting/fog volumes) are rare: log each one's shape.
- LOG_INFO(HW_GPU, "3D image at {:#x}: {}x{}x{} levels {} format {} block {}x{}x{}",
+ LOG_DEBUG(HW_GPU, "3D image at {:#x}: {}x{}x{} levels {} format {} block {}x{}x{}",
gpu_addr, info.size.width, info.size.height, info.size.depth, info.resources.levels,
static_cast<u32>(info.format), info.block.width, info.block.height, info.block.depth);
}