Compare commits

..

14 Commits

Author SHA1 Message Date
yuzubot
df869c3bb9 Android 245 2024-02-12 00:57:02 +00:00
yuzubot
0a1bc07a33 Merge yuzu-emu#12975 2024-02-12 00:57:02 +00:00
yuzubot
78ddc16f6f Merge yuzu-emu#12873 2024-02-12 00:57:01 +00:00
yuzubot
7939fe7664 Merge yuzu-emu#12756 2024-02-12 00:57:01 +00:00
yuzubot
42a414b377 Merge yuzu-emu#12749 2024-02-12 00:57:01 +00:00
yuzubot
ff83b9ad82 Merge yuzu-emu#12461 2024-02-12 00:57:01 +00:00
liamwhite
98db796fde Merge pull request #12986 from t895/input-config-clear-fix
config: Always delete control settings in ClearControlPlayerValues
2024-02-11 12:24:18 -05:00
t895
adebc96a9c config: Always delete control settings in ClearControlPlayerValues 2024-02-11 07:35:54 -05:00
liamwhite
564a65a82e Merge pull request #12981 from lat9nq/tzdb-asan-custom
tzdb_to_nx: Update to latest
2024-02-10 22:42:47 -05:00
liamwhite
501ff2eda5 Merge pull request #12980 from merryhime/race-me
dynarmic: Fix invalidation race
2024-02-10 22:42:42 -05:00
Charles Lombardo
999ec5739d Merge pull request #12978 from liamwhite/ffs-qcom
host_shaders: add vendor workaround for adreno drivers
2024-02-10 22:42:25 -05:00
lat9nq
68b2db21b1 tzdb_to_nx: Update to latest
Includes memory leak fix.

Includes option to specify a custom zoneinfo dir.
2024-02-10 17:45:18 -05:00
Merry
211544fbc8 externals: Update dynarmic to 6.6.3 2024-02-10 19:40:47 +00:00
Liam
4eeac731ff host_shaders: add vendor workaround for adreno drivers 2024-02-10 12:02:37 -05:00
9 changed files with 115 additions and 79 deletions

View File

@@ -3,10 +3,8 @@
| [12461](https://github.com/yuzu-emu/yuzu//pull/12461) | [`acc26667b`](https://github.com/yuzu-emu/yuzu//pull/12461/files) | Rework Nvdec and VIC to fix out-of-order videos, and speed up decoding. | [Kelebek1](https://github.com/Kelebek1/) | Yes |
| [12749](https://github.com/yuzu-emu/yuzu//pull/12749) | [`aad4b0d6f`](https://github.com/yuzu-emu/yuzu//pull/12749/files) | general: workarounds for SMMU syncing issues | [liamwhite](https://github.com/liamwhite/) | Yes |
| [12756](https://github.com/yuzu-emu/yuzu//pull/12756) | [`4677fd3f6`](https://github.com/yuzu-emu/yuzu//pull/12756/files) | general: applet multiprocess | [liamwhite](https://github.com/liamwhite/) | Yes |
| [12873](https://github.com/yuzu-emu/yuzu//pull/12873) | [`1f64c9adf`](https://github.com/yuzu-emu/yuzu//pull/12873/files) | GPU: Implement channel scheduling. | [FernandoS27](https://github.com/FernandoS27/) | Yes |
| [12955](https://github.com/yuzu-emu/yuzu//pull/12955) | [`8d2ad3d8f`](https://github.com/yuzu-emu/yuzu//pull/12955/files) | dmnt: cheat: Avoid invalidating cache on 32bit | [german77](https://github.com/german77/) | Yes |
| [12978](https://github.com/yuzu-emu/yuzu//pull/12978) | [`4eeac731f`](https://github.com/yuzu-emu/yuzu//pull/12978/files) | host_shaders: add vendor workaround for adreno drivers | [liamwhite](https://github.com/liamwhite/) | Yes |
| [12980](https://github.com/yuzu-emu/yuzu//pull/12980) | [`211544fbc`](https://github.com/yuzu-emu/yuzu//pull/12980/files) | dynarmic: Fix invalidation race | [merryhime](https://github.com/merryhime/) | Yes |
| [12873](https://github.com/yuzu-emu/yuzu//pull/12873) | [`7a4ea8991`](https://github.com/yuzu-emu/yuzu//pull/12873/files) | GPU: Implement channel scheduling. | [FernandoS27](https://github.com/FernandoS27/) | Yes |
| [12975](https://github.com/yuzu-emu/yuzu//pull/12975) | [`9ce43ee67`](https://github.com/yuzu-emu/yuzu//pull/12975/files) | Texture Cache: Fix untracking on GPU remap | [FernandoS27](https://github.com/FernandoS27/) | Yes |
End of merge log. You can find the original README.md below the break.

View File

@@ -65,8 +65,7 @@ void StandardVmCallbacks::MemoryWriteUnsafe(VAddr address, const void* data, u64
return;
}
if (system.ApplicationMemory().WriteBlock(address, data, size) &&
system.ApplicationProcess()->Is64Bit()) {
if (system.ApplicationMemory().WriteBlock(address, data, size)) {
Core::InvalidateInstructionCacheRange(system.ApplicationProcess(), address, size);
}
}

View File

@@ -885,15 +885,9 @@ void Config::Reload() {
}
void Config::ClearControlPlayerValues() const {
// If key is an empty string, all keys in the current group() are removed.
// Removes the entire [Controls] section
const char* section = Settings::TranslateCategory(Settings::Category::Controls);
CSimpleIniA::TNamesDepend keys;
config->GetAllKeys(section, keys);
for (const auto& key : keys) {
if (std::string(config->GetValue(section, key.pItem)).empty()) {
config->Delete(section, key.pItem);
}
}
config->Delete(section, nullptr, true);
}
const std::string& Config::GetConfigFilePath() const {

View File

@@ -7,6 +7,7 @@
#include <memory>
#include <mutex>
#include <unordered_map>
#include <utility>
#include "common/assert.h"
#include "common/fiber.h"
@@ -53,29 +54,30 @@ void Scheduler::Init() {
}
void Scheduler::Resume() {
bool pending_work;
do {
pending_work = false;
{
std::unique_lock lk(impl->scheduling_guard);
impl->current_fifo = nullptr;
auto it = impl->schedule_priority_queue.begin();
while (it != impl->schedule_priority_queue.end()) {
pending_work = ScheduleLevel(it->second);
if (pending_work) {
break;
}
it = std::next(it);
}
if (pending_work) {
impl->must_reschedule = false;
}
while (UpdateHighestPriorityChannel()) {
impl->current_fifo->scheduled_count++;
Common::Fiber::YieldTo(impl->master_control, *impl->current_fifo->context);
}
}
bool Scheduler::UpdateHighestPriorityChannel() {
std::scoped_lock lk(impl->scheduling_guard);
// Clear needs to schedule state.
impl->must_reschedule = false;
// By default, we don't have a channel to schedule.
impl->current_fifo = nullptr;
// Check each level to see if we can schedule.
for (auto& level : impl->schedule_priority_queue) {
if (ScheduleLevel(level.second)) {
return true;
}
if (impl->current_fifo) {
impl->current_fifo->scheduled_count++;
Common::Fiber::YieldTo(impl->master_control, *impl->current_fifo->context);
}
} while (pending_work);
}
// Nothing to schedule.
return false;
}
bool Scheduler::ScheduleLevel(std::list<size_t>& queue) {
@@ -83,34 +85,48 @@ bool Scheduler::ScheduleLevel(std::list<size_t>& queue) {
size_t min_schedule_count = std::numeric_limits<size_t>::max();
for (auto id : queue) {
auto& fifo = impl->gpfifos[id];
std::scoped_lock lk2(fifo.guard);
if (!fifo.pending_work.empty() || fifo.is_running) {
if (fifo.scheduled_count > min_schedule_count) {
continue;
}
if (fifo.scheduled_count < fifo.yield_count) {
fifo.scheduled_count++;
continue;
}
min_schedule_count = fifo.scheduled_count;
impl->current_fifo = &fifo;
found_anything = true;
std::scoped_lock lk(fifo.guard);
// With no pending work and nothing running, this channel can't be scheduled.
if (fifo.pending_work.empty() && !fifo.is_running) {
continue;
}
// Prioritize channels at current priority which have been run the least.
if (fifo.scheduled_count > min_schedule_count) {
continue;
}
// Try not to select the same channel we just yielded from.
if (fifo.scheduled_count < fifo.yield_count) {
fifo.scheduled_count++;
continue;
}
// Update best selection.
min_schedule_count = fifo.scheduled_count;
impl->current_fifo = &fifo;
found_anything = true;
}
return found_anything;
}
void Scheduler::ChangePriority(s32 channel_id, u32 new_priority) {
std::unique_lock lk(impl->scheduling_guard);
std::scoped_lock lk(impl->scheduling_guard);
// Ensure we are tracking this channel.
auto fifo_it = impl->channel_gpfifo_ids.find(channel_id);
if (fifo_it == impl->channel_gpfifo_ids.end()) {
return;
}
// Get the fifo and update its priority.
const size_t fifo_id = fifo_it->second;
auto& fifo = impl->gpfifos[fifo_id];
const auto old_priority = fifo.info->priority;
fifo.info->priority = new_priority;
const auto old_priority = std::exchange(fifo.info->priority, new_priority);
// Create the new level if needed.
impl->schedule_priority_queue.try_emplace(new_priority);
// Remove the old level and add to the new level.
impl->schedule_priority_queue[new_priority].push_back(fifo_id);
impl->schedule_priority_queue[old_priority].remove_if(
[fifo_id](size_t id) { return id == fifo_id; });
@@ -118,6 +134,8 @@ void Scheduler::ChangePriority(s32 channel_id, u32 new_priority) {
void Scheduler::Yield() {
ASSERT(impl->current_fifo != nullptr);
// Set yield count higher
impl->current_fifo->yield_count = impl->current_fifo->scheduled_count + 1;
Common::Fiber::YieldTo(impl->current_fifo->context, *impl->master_control);
gpu.BindChannel(impl->current_fifo->bind_id);
@@ -126,50 +144,73 @@ void Scheduler::Yield() {
void Scheduler::CheckStatus() {
{
std::unique_lock lk(impl->scheduling_guard);
// If no reschedule is needed, don't transfer control
if (!impl->must_reschedule) {
return;
}
}
// Transfer control to the scheduler
Common::Fiber::YieldTo(impl->current_fifo->context, *impl->master_control);
gpu.BindChannel(impl->current_fifo->bind_id);
}
void Scheduler::Push(s32 channel, CommandList&& entries) {
std::unique_lock lk(impl->scheduling_guard);
std::scoped_lock lk(impl->scheduling_guard);
// Get and ensure we have this channel.
auto it = impl->channel_gpfifo_ids.find(channel);
ASSERT(it != impl->channel_gpfifo_ids.end());
auto gpfifo_id = it->second;
auto& fifo = impl->gpfifos[gpfifo_id];
// Add the new new work to the channel.
{
std::scoped_lock lk2(fifo.guard);
fifo.pending_work.emplace_back(std::move(entries));
}
if (impl->current_fifo != nullptr && impl->current_fifo->info->priority < fifo.info->priority) {
impl->must_reschedule = true;
// If the current running FIFO is null or the one being pushed to then
// just return
if (impl->current_fifo == nullptr || impl->current_fifo == &fifo) {
return;
}
// If the current fifo has higher or equal priority to the current fifo then return
if (impl->current_fifo->info->priority >= fifo.info->priority) {
return;
}
// Mark scheduler update as required.
impl->must_reschedule = true;
}
void Scheduler::ChannelLoop(size_t gpfifo_id, s32 channel_id) {
gpu.BindChannel(channel_id);
auto& fifo = impl->gpfifos[gpfifo_id];
while (true) {
auto* channel_state = fifo.info.get();
fifo.guard.lock();
while (!fifo.pending_work.empty()) {
fifo.is_running = true;
{
CommandList&& entries = std::move(fifo.pending_work.front());
channel_state->dma_pusher->Push(std::move(entries));
fifo.pending_work.pop_front();
}
fifo.guard.unlock();
channel_state->dma_pusher->DispatchCalls();
CheckStatus();
fifo.guard.lock();
auto* channel_state = fifo.info.get();
const auto SendToPuller = [&] {
std::scoped_lock lk(fifo.guard);
if (fifo.pending_work.empty()) {
// Stop if no work available.
fifo.is_running = false;
return false;
}
fifo.is_running = false;
fifo.guard.unlock();
// Otherwise, send work to puller and mark as running.
CommandList&& entries = std::move(fifo.pending_work.front());
channel_state->dma_pusher->Push(std::move(entries));
fifo.pending_work.pop_front();
fifo.is_running = true;
// Succeed.
return true;
};
// Inform the GPU about the current channel.
gpu.BindChannel(channel_id);
while (true) {
while (SendToPuller()) {
// Execute.
channel_state->dma_pusher->DispatchCalls();
// Reschedule.
CheckStatus();
}
// Return to host execution when all work is completed.
Common::Fiber::YieldTo(fifo.context, *impl->master_control);
// Inform the GPU about the current channel.
gpu.BindChannel(channel_id);
}
}

View File

@@ -39,6 +39,7 @@ private:
void ChannelLoop(size_t gpfifo_id, s32 channel_id);
bool ScheduleLevel(std::list<size_t>& queue);
void CheckStatus();
bool UpdateHighestPriorityChannel();
struct SchedulerImpl;
std::unique_ptr<SchedulerImpl> impl;

View File

@@ -42,6 +42,7 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept {
};
}
rescaleable = false;
is_sparse = config.is_sparse != 0;
tile_width_spacing = config.tile_width_spacing;
if (config.texture_type != TextureType::Texture2D &&
config.texture_type != TextureType::Texture2DNoMipmap) {

View File

@@ -41,6 +41,7 @@ struct ImageInfo {
bool downscaleable = false;
bool forced_flushed = false;
bool dma_downloaded = false;
bool is_sparse = false;
};
} // namespace VideoCommon

View File

@@ -600,17 +600,17 @@ void TextureCache<P>::UnmapGPUMemory(size_t as_id, GPUVAddr gpu_addr, size_t siz
[&](ImageId id, Image&) { deleted_images.push_back(id); });
for (const ImageId id : deleted_images) {
Image& image = slot_images[id];
if (True(image.flags & ImageFlagBits::CpuModified)) {
continue;
if (False(image.flags & ImageFlagBits::CpuModified)) {
image.flags |= ImageFlagBits::CpuModified;
if (True(image.flags & ImageFlagBits::Tracked)) {
UntrackImage(image, id);
}
}
image.flags |= ImageFlagBits::CpuModified;
if (True(image.flags & ImageFlagBits::Remapped)) {
continue;
}
image.flags |= ImageFlagBits::Remapped;
if (True(image.flags & ImageFlagBits::Tracked)) {
UntrackImage(image, id);
}
}
}
@@ -1469,7 +1469,8 @@ ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, DA
const ImageId new_image_id = slot_images.insert(runtime, new_info, gpu_addr, cpu_addr);
Image& new_image = slot_images[new_image_id];
if (!gpu_memory->IsContinuousRange(new_image.gpu_addr, new_image.guest_size_bytes)) {
if (!gpu_memory->IsContinuousRange(new_image.gpu_addr, new_image.guest_size_bytes) &&
new_info.is_sparse) {
new_image.flags |= ImageFlagBits::Sparse;
}