[android] do not reuse work for KONA detect(?), no weird hack for astroneer

This commit is contained in:
lizzie 2025-07-12 01:07:12 +01:00
parent 3df06da02c
commit 7a8fa6756f
3 changed files with 19 additions and 19 deletions

View file

@ -37,18 +37,18 @@ enum class ShuffleMode : u64 {
} }
} }
bool IsKONA() { void Shuffle(TranslatorVisitor& v, u64 insn, const IR::U32& index, const IR::U32& mask) {
// Static initializer ran once -- see Apple rosetta code in Dynarmic for backref
static bool is_kona = []{
std::ifstream machineFile("/sys/devices/soc0/machine"); std::ifstream machineFile("/sys/devices/soc0/machine");
if (machineFile.is_open()) { if (machineFile.is_open()) {
std::string line; std::string line{};
std::getline(machineFile, line); std::getline(machineFile, line);
if (line == "KONA") return line == "KONA";
return true;
} }
return false; return false;
} }();
void Shuffle(TranslatorVisitor& v, u64 insn, const IR::U32& index, const IR::U32& mask) {
union { union {
u64 insn; u64 insn;
BitField<0, 8, IR::Reg> dest_reg; BitField<0, 8, IR::Reg> dest_reg;
@ -59,7 +59,7 @@ void Shuffle(TranslatorVisitor& v, u64 insn, const IR::U32& index, const IR::U32
const IR::U32 result{ShuffleOperation(v.ir, v.X(shfl.src_reg), index, mask, shfl.mode)}; const IR::U32 result{ShuffleOperation(v.ir, v.X(shfl.src_reg), index, mask, shfl.mode)};
v.ir.SetPred(shfl.pred, v.ir.GetInBoundsFromOp(result)); v.ir.SetPred(shfl.pred, v.ir.GetInBoundsFromOp(result));
if (IsKONA()) if (is_kona)
v.X(shfl.dest_reg, v.ir.Imm32(0xffffffff)); // This fixes the freeze for Retroid / Snapdragon SD865 v.X(shfl.dest_reg, v.ir.Imm32(0xffffffff)); // This fixes the freeze for Retroid / Snapdragon SD865
else else
v.X(shfl.dest_reg, result); v.X(shfl.dest_reg, result);

View file

@ -21,11 +21,11 @@ Host1x::~Host1x() = default;
void Host1x::StartDevice(s32 fd, ChannelType type, u32 syncpt) { void Host1x::StartDevice(s32 fd, ChannelType type, u32 syncpt) {
switch (type) { switch (type) {
case ChannelType::NvDec: case ChannelType::NvDec:
std::call_once(nvdec_first_init, []() {std::this_thread::sleep_for(std::chrono::milliseconds{500});}); // HACK: For Astroneer //std::call_once(nvdec_first_init, []() {std::this_thread::sleep_for(std::chrono::milliseconds{500});}); // HACK: For Astroneer
devices[fd] = std::make_unique<Tegra::Host1x::Nvdec>(*this, fd, syncpt, frame_queue); devices[fd] = std::make_unique<Tegra::Host1x::Nvdec>(*this, fd, syncpt, frame_queue);
break; break;
case ChannelType::VIC: case ChannelType::VIC:
std::call_once(vic_first_init, []() {std::this_thread::sleep_for(std::chrono::milliseconds{500});}); // HACK: For Astroneer //std::call_once(vic_first_init, []() {std::this_thread::sleep_for(std::chrono::milliseconds{500});}); // HACK: For Astroneer
devices[fd] = std::make_unique<Tegra::Host1x::Vic>(*this, fd, syncpt, frame_queue); devices[fd] = std::make_unique<Tegra::Host1x::Vic>(*this, fd, syncpt, frame_queue);
break; break;
default: default:

View file

@ -197,15 +197,15 @@ public:
} }
private: private:
Core::System& system;
SyncpointManager syncpoint_manager; SyncpointManager syncpoint_manager;
Tegra::MaxwellDeviceMemoryManager memory_manager; Tegra::MaxwellDeviceMemoryManager memory_manager;
Tegra::MemoryManager gmmu_manager; Tegra::MemoryManager gmmu_manager;
std::unique_ptr<Common::FlatAllocator<u32, 0, 32>> allocator;
FrameQueue frame_queue; FrameQueue frame_queue;
std::unordered_map<s32, std::unique_ptr<CDmaPusher>> devices; std::unordered_map<s32, std::unique_ptr<CDmaPusher>> devices; //+12
std::once_flag nvdec_first_init; std::unique_ptr<Common::FlatAllocator<u32, 0, 32>> allocator; //8
std::once_flag vic_first_init; Core::System& system; //8
// std::once_flag nvdec_first_init;
// std::once_flag vic_first_init;
}; };
} // namespace Tegra::Host1x } // namespace Tegra::Host1x