Alternative mutex
This commit is contained in:
@@ -883,7 +883,7 @@ class PrimitiveProcessor {
|
||||
// Must be called in a global critical region.
|
||||
void UpdateCacheBucketsNonEmptyL2(
|
||||
uint32_t bucket_index_div_64,
|
||||
[[maybe_unused]] const std::unique_lock<std::recursive_mutex>&
|
||||
[[maybe_unused]] const global_unique_lock_type&
|
||||
global_lock) {
|
||||
uint64_t& cache_buckets_non_empty_l2_ref =
|
||||
cache_buckets_non_empty_l2_[bucket_index_div_64 >> 6];
|
||||
|
||||
@@ -35,7 +35,7 @@ class SharedMemory {
|
||||
virtual void SetSystemPageBlocksValidWithGpuDataWritten();
|
||||
|
||||
typedef void (*GlobalWatchCallback)(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock, void* context,
|
||||
const global_unique_lock_type& global_lock, void* context,
|
||||
uint32_t address_first, uint32_t address_last, bool invalidated_by_gpu);
|
||||
typedef void* GlobalWatchHandle;
|
||||
// Registers a callback invoked when something is invalidated in the GPU
|
||||
@@ -49,8 +49,8 @@ class SharedMemory {
|
||||
GlobalWatchHandle RegisterGlobalWatch(GlobalWatchCallback callback,
|
||||
void* callback_context);
|
||||
void UnregisterGlobalWatch(GlobalWatchHandle handle);
|
||||
typedef void (*WatchCallback)(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock, void* context,
|
||||
typedef void (*WatchCallback)(const global_unique_lock_type& global_lock,
|
||||
void* context,
|
||||
void* data, uint64_t argument, bool invalidated_by_gpu);
|
||||
typedef void* WatchHandle;
|
||||
// Registers a callback invoked when the specified memory range is invalidated
|
||||
|
||||
@@ -507,7 +507,7 @@ TextureCache::Texture::~Texture() {
|
||||
}
|
||||
|
||||
void TextureCache::Texture::MakeUpToDateAndWatch(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock) {
|
||||
const global_unique_lock_type& global_lock) {
|
||||
SharedMemory& shared_memory = texture_cache().shared_memory();
|
||||
if (base_outdated_) {
|
||||
assert_not_zero(GetGuestBaseSize());
|
||||
@@ -552,7 +552,7 @@ void TextureCache::Texture::MarkAsUsed() {
|
||||
}
|
||||
|
||||
void TextureCache::Texture::WatchCallback(
|
||||
[[maybe_unused]] const std::unique_lock<std::recursive_mutex>& global_lock,
|
||||
[[maybe_unused]] const global_unique_lock_type& global_lock,
|
||||
bool is_mip) {
|
||||
if (is_mip) {
|
||||
assert_not_zero(GetGuestMipsSize());
|
||||
@@ -565,8 +565,8 @@ void TextureCache::Texture::WatchCallback(
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCache::WatchCallback(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock, void* context,
|
||||
void TextureCache::WatchCallback(const global_unique_lock_type& global_lock,
|
||||
void* context,
|
||||
void* data, uint64_t argument, bool invalidated_by_gpu) {
|
||||
Texture& texture = *static_cast<Texture*>(context);
|
||||
texture.WatchCallback(global_lock, argument != 0);
|
||||
@@ -902,7 +902,7 @@ bool TextureCache::IsRangeScaledResolved(uint32_t start_unscaled,
|
||||
}
|
||||
|
||||
void TextureCache::ScaledResolveGlobalWatchCallbackThunk(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock, void* context,
|
||||
const global_unique_lock_type& global_lock, void* context,
|
||||
uint32_t address_first, uint32_t address_last, bool invalidated_by_gpu) {
|
||||
TextureCache* texture_cache = reinterpret_cast<TextureCache*>(context);
|
||||
texture_cache->ScaledResolveGlobalWatchCallback(
|
||||
@@ -910,7 +910,7 @@ void TextureCache::ScaledResolveGlobalWatchCallbackThunk(
|
||||
}
|
||||
|
||||
void TextureCache::ScaledResolveGlobalWatchCallback(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock,
|
||||
const global_unique_lock_type& global_lock,
|
||||
uint32_t address_first, uint32_t address_last, bool invalidated_by_gpu) {
|
||||
assert_true(IsDrawResolutionScaled());
|
||||
if (invalidated_by_gpu) {
|
||||
|
||||
@@ -230,19 +230,15 @@ class TextureCache {
|
||||
}
|
||||
bool IsResolved() const { return base_resolved_ || mips_resolved_; }
|
||||
|
||||
bool base_outdated(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock) const {
|
||||
bool base_outdated(const global_unique_lock_type& global_lock) const {
|
||||
return base_outdated_;
|
||||
}
|
||||
bool mips_outdated(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock) const {
|
||||
bool mips_outdated(const global_unique_lock_type& global_lock) const {
|
||||
return mips_outdated_;
|
||||
}
|
||||
void MakeUpToDateAndWatch(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock);
|
||||
void MakeUpToDateAndWatch(const global_unique_lock_type& global_lock);
|
||||
|
||||
void WatchCallback(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock, bool is_mip);
|
||||
void WatchCallback(const global_unique_lock_type& global_lock, bool is_mip);
|
||||
|
||||
// For LRU caching - updates the last usage frame and moves the texture to
|
||||
// the end of the usage queue. Must be called any time the texture is
|
||||
@@ -579,8 +575,8 @@ class TextureCache {
|
||||
void UpdateTexturesTotalHostMemoryUsage(uint64_t add, uint64_t subtract);
|
||||
|
||||
// Shared memory callback for texture data invalidation.
|
||||
static void WatchCallback(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock, void* context,
|
||||
static void WatchCallback(const global_unique_lock_type& global_lock,
|
||||
void* context,
|
||||
void* data, uint64_t argument, bool invalidated_by_gpu);
|
||||
|
||||
// Checks if there are any pages that contain scaled resolve data within the
|
||||
@@ -589,10 +585,10 @@ class TextureCache {
|
||||
// Global shared memory invalidation callback for invalidating scaled resolved
|
||||
// texture data.
|
||||
static void ScaledResolveGlobalWatchCallbackThunk(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock, void* context,
|
||||
const global_unique_lock_type& global_lock, void* context,
|
||||
uint32_t address_first, uint32_t address_last, bool invalidated_by_gpu);
|
||||
void ScaledResolveGlobalWatchCallback(
|
||||
const std::unique_lock<std::recursive_mutex>& global_lock,
|
||||
const global_unique_lock_type& global_lock,
|
||||
uint32_t address_first, uint32_t address_last, bool invalidated_by_gpu);
|
||||
|
||||
const RegisterFile& register_file_;
|
||||
|
||||
Reference in New Issue
Block a user