diff options
Diffstat (limited to 'src')
24 files changed, 173 insertions, 97 deletions
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index 769065b6f..70b36f170 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp | |||
| @@ -82,9 +82,9 @@ std::string GetFutureSaveDataPath(SaveDataSpaceId space_id, SaveDataType type, u | |||
| 82 | // Only detect account/device saves from the future location. | 82 | // Only detect account/device saves from the future location. |
| 83 | switch (type) { | 83 | switch (type) { |
| 84 | case SaveDataType::SaveData: | 84 | case SaveDataType::SaveData: |
| 85 | return fmt::format("{}/account/{}/{:016X}/1", space_id_path, uuid.RawString(), title_id); | 85 | return fmt::format("{}/account/{}/{:016X}/0", space_id_path, uuid.RawString(), title_id); |
| 86 | case SaveDataType::DeviceSaveData: | 86 | case SaveDataType::DeviceSaveData: |
| 87 | return fmt::format("{}/device/{:016X}/1", space_id_path, title_id); | 87 | return fmt::format("{}/device/{:016X}/0", space_id_path, title_id); |
| 88 | default: | 88 | default: |
| 89 | return ""; | 89 | return ""; |
| 90 | } | 90 | } |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index e59de844c..a2375508a 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "core/file_sys/savedata_factory.h" | 13 | #include "core/file_sys/savedata_factory.h" |
| 14 | #include "core/hle/kernel/k_event.h" | 14 | #include "core/hle/kernel/k_event.h" |
| 15 | #include "core/hle/kernel/k_transfer_memory.h" | 15 | #include "core/hle/kernel/k_transfer_memory.h" |
| 16 | #include "core/hle/result.h" | ||
| 16 | #include "core/hle/service/acc/profile_manager.h" | 17 | #include "core/hle/service/acc/profile_manager.h" |
| 17 | #include "core/hle/service/am/am.h" | 18 | #include "core/hle/service/am/am.h" |
| 18 | #include "core/hle/service/am/applet_ae.h" | 19 | #include "core/hle/service/am/applet_ae.h" |
| @@ -1335,7 +1336,7 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_) | |||
| 1335 | {24, nullptr, "GetLaunchStorageInfoForDebug"}, | 1336 | {24, nullptr, "GetLaunchStorageInfoForDebug"}, |
| 1336 | {25, &IApplicationFunctions::ExtendSaveData, "ExtendSaveData"}, | 1337 | {25, &IApplicationFunctions::ExtendSaveData, "ExtendSaveData"}, |
| 1337 | {26, &IApplicationFunctions::GetSaveDataSize, "GetSaveDataSize"}, | 1338 | {26, &IApplicationFunctions::GetSaveDataSize, "GetSaveDataSize"}, |
| 1338 | {27, nullptr, "CreateCacheStorage"}, | 1339 | {27, &IApplicationFunctions::CreateCacheStorage, "CreateCacheStorage"}, |
| 1339 | {28, nullptr, "GetSaveDataSizeMax"}, | 1340 | {28, nullptr, "GetSaveDataSizeMax"}, |
| 1340 | {29, nullptr, "GetCacheStorageMax"}, | 1341 | {29, nullptr, "GetCacheStorageMax"}, |
| 1341 | {30, &IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed, "BeginBlockingHomeButtonShortAndLongPressed"}, | 1342 | {30, &IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed, "BeginBlockingHomeButtonShortAndLongPressed"}, |
| @@ -1738,6 +1739,36 @@ void IApplicationFunctions::GetSaveDataSize(HLERequestContext& ctx) { | |||
| 1738 | rb.Push(size.journal); | 1739 | rb.Push(size.journal); |
| 1739 | } | 1740 | } |
| 1740 | 1741 | ||
| 1742 | void IApplicationFunctions::CreateCacheStorage(HLERequestContext& ctx) { | ||
| 1743 | struct InputParameters { | ||
| 1744 | u16 index; | ||
| 1745 | s64 size; | ||
| 1746 | s64 journal_size; | ||
| 1747 | }; | ||
| 1748 | static_assert(sizeof(InputParameters) == 24); | ||
| 1749 | |||
| 1750 | struct OutputParameters { | ||
| 1751 | u32 storage_target; | ||
| 1752 | u64 required_size; | ||
| 1753 | }; | ||
| 1754 | static_assert(sizeof(OutputParameters) == 16); | ||
| 1755 | |||
| 1756 | IPC::RequestParser rp{ctx}; | ||
| 1757 | const auto params = rp.PopRaw<InputParameters>(); | ||
| 1758 | |||
| 1759 | LOG_WARNING(Service_AM, "(STUBBED) called with index={}, size={:#x}, journal_size={:#x}", | ||
| 1760 | params.index, params.size, params.journal_size); | ||
| 1761 | |||
| 1762 | const OutputParameters resp{ | ||
| 1763 | .storage_target = 1, | ||
| 1764 | .required_size = 0, | ||
| 1765 | }; | ||
| 1766 | |||
| 1767 | IPC::ResponseBuilder rb{ctx, 6}; | ||
| 1768 | rb.Push(ResultSuccess); | ||
| 1769 | rb.PushRaw(resp); | ||
| 1770 | } | ||
| 1771 | |||
| 1741 | void IApplicationFunctions::QueryApplicationPlayStatistics(HLERequestContext& ctx) { | 1772 | void IApplicationFunctions::QueryApplicationPlayStatistics(HLERequestContext& ctx) { |
| 1742 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 1773 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 1743 | 1774 | ||
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 0dbc6485e..d4fd163da 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -333,6 +333,7 @@ private: | |||
| 333 | void GetPseudoDeviceId(HLERequestContext& ctx); | 333 | void GetPseudoDeviceId(HLERequestContext& ctx); |
| 334 | void ExtendSaveData(HLERequestContext& ctx); | 334 | void ExtendSaveData(HLERequestContext& ctx); |
| 335 | void GetSaveDataSize(HLERequestContext& ctx); | 335 | void GetSaveDataSize(HLERequestContext& ctx); |
| 336 | void CreateCacheStorage(HLERequestContext& ctx); | ||
| 336 | void BeginBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx); | 337 | void BeginBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx); |
| 337 | void EndBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx); | 338 | void EndBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx); |
| 338 | void BeginBlockingHomeButton(HLERequestContext& ctx); | 339 | void BeginBlockingHomeButton(HLERequestContext& ctx); |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 9e559d97e..f73a864c3 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -24,8 +24,10 @@ | |||
| 24 | #include "core/file_sys/savedata_factory.h" | 24 | #include "core/file_sys/savedata_factory.h" |
| 25 | #include "core/file_sys/system_archive/system_archive.h" | 25 | #include "core/file_sys/system_archive/system_archive.h" |
| 26 | #include "core/file_sys/vfs.h" | 26 | #include "core/file_sys/vfs.h" |
| 27 | #include "core/hle/result.h" | ||
| 27 | #include "core/hle/service/filesystem/filesystem.h" | 28 | #include "core/hle/service/filesystem/filesystem.h" |
| 28 | #include "core/hle/service/filesystem/fsp_srv.h" | 29 | #include "core/hle/service/filesystem/fsp_srv.h" |
| 30 | #include "core/hle/service/hle_ipc.h" | ||
| 29 | #include "core/hle/service/ipc_helpers.h" | 31 | #include "core/hle/service/ipc_helpers.h" |
| 30 | #include "core/reporter.h" | 32 | #include "core/reporter.h" |
| 31 | 33 | ||
| @@ -552,9 +554,9 @@ public: | |||
| 552 | // Write the data to memory | 554 | // Write the data to memory |
| 553 | ctx.WriteBuffer(begin, range_size); | 555 | ctx.WriteBuffer(begin, range_size); |
| 554 | 556 | ||
| 555 | IPC::ResponseBuilder rb{ctx, 3}; | 557 | IPC::ResponseBuilder rb{ctx, 4}; |
| 556 | rb.Push(ResultSuccess); | 558 | rb.Push(ResultSuccess); |
| 557 | rb.Push<u32>(static_cast<u32>(actual_entries)); | 559 | rb.Push<u64>(actual_entries); |
| 558 | } | 560 | } |
| 559 | 561 | ||
| 560 | private: | 562 | private: |
| @@ -712,7 +714,7 @@ FSP_SRV::FSP_SRV(Core::System& system_) | |||
| 712 | {59, nullptr, "WriteSaveDataFileSystemExtraData"}, | 714 | {59, nullptr, "WriteSaveDataFileSystemExtraData"}, |
| 713 | {60, nullptr, "OpenSaveDataInfoReader"}, | 715 | {60, nullptr, "OpenSaveDataInfoReader"}, |
| 714 | {61, &FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, | 716 | {61, &FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, |
| 715 | {62, nullptr, "OpenCacheStorageList"}, | 717 | {62, &FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage, "OpenSaveDataInfoReaderOnlyCacheStorage"}, |
| 716 | {64, nullptr, "OpenSaveDataInternalStorageFileSystem"}, | 718 | {64, nullptr, "OpenSaveDataInternalStorageFileSystem"}, |
| 717 | {65, nullptr, "UpdateSaveDataMacForDebug"}, | 719 | {65, nullptr, "UpdateSaveDataMacForDebug"}, |
| 718 | {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, | 720 | {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, |
| @@ -921,6 +923,15 @@ void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx) { | |||
| 921 | std::make_shared<ISaveDataInfoReader>(system, space, fsc)); | 923 | std::make_shared<ISaveDataInfoReader>(system, space, fsc)); |
| 922 | } | 924 | } |
| 923 | 925 | ||
| 926 | void FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage(HLERequestContext& ctx) { | ||
| 927 | LOG_WARNING(Service_FS, "(STUBBED) called"); | ||
| 928 | |||
| 929 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 930 | rb.Push(ResultSuccess); | ||
| 931 | rb.PushIpcInterface<ISaveDataInfoReader>(system, FileSys::SaveDataSpaceId::TemporaryStorage, | ||
| 932 | fsc); | ||
| 933 | } | ||
| 934 | |||
| 924 | void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx) { | 935 | void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx) { |
| 925 | LOG_WARNING(Service_FS, "(STUBBED) called."); | 936 | LOG_WARNING(Service_FS, "(STUBBED) called."); |
| 926 | 937 | ||
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h index 49f17c7c3..4f3c2f6de 100644 --- a/src/core/hle/service/filesystem/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp_srv.h | |||
| @@ -42,6 +42,7 @@ private: | |||
| 42 | void OpenSaveDataFileSystem(HLERequestContext& ctx); | 42 | void OpenSaveDataFileSystem(HLERequestContext& ctx); |
| 43 | void OpenReadOnlySaveDataFileSystem(HLERequestContext& ctx); | 43 | void OpenReadOnlySaveDataFileSystem(HLERequestContext& ctx); |
| 44 | void OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx); | 44 | void OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx); |
| 45 | void OpenSaveDataInfoReaderOnlyCacheStorage(HLERequestContext& ctx); | ||
| 45 | void WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx); | 46 | void WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx); |
| 46 | void ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(HLERequestContext& ctx); | 47 | void ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(HLERequestContext& ctx); |
| 47 | void OpenDataStorageByCurrentProcess(HLERequestContext& ctx); | 48 | void OpenDataStorageByCurrentProcess(HLERequestContext& ctx); |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index ef4aec4ea..28818c813 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -979,8 +979,8 @@ void Controller_NPad::VibrateController( | |||
| 979 | } | 979 | } |
| 980 | 980 | ||
| 981 | void Controller_NPad::VibrateControllers( | 981 | void Controller_NPad::VibrateControllers( |
| 982 | const std::vector<Core::HID::VibrationDeviceHandle>& vibration_device_handles, | 982 | std::span<const Core::HID::VibrationDeviceHandle> vibration_device_handles, |
| 983 | const std::vector<Core::HID::VibrationValue>& vibration_values) { | 983 | std::span<const Core::HID::VibrationValue> vibration_values) { |
| 984 | if (!Settings::values.vibration_enabled.GetValue() && !permit_vibration_session_enabled) { | 984 | if (!Settings::values.vibration_enabled.GetValue() && !permit_vibration_session_enabled) { |
| 985 | return; | 985 | return; |
| 986 | } | 986 | } |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 9cfe298f1..776411261 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -112,8 +112,8 @@ public: | |||
| 112 | const Core::HID::VibrationValue& vibration_value); | 112 | const Core::HID::VibrationValue& vibration_value); |
| 113 | 113 | ||
| 114 | void VibrateControllers( | 114 | void VibrateControllers( |
| 115 | const std::vector<Core::HID::VibrationDeviceHandle>& vibration_device_handles, | 115 | std::span<const Core::HID::VibrationDeviceHandle> vibration_device_handles, |
| 116 | const std::vector<Core::HID::VibrationValue>& vibration_values); | 116 | std::span<const Core::HID::VibrationValue> vibration_values); |
| 117 | 117 | ||
| 118 | Core::HID::VibrationValue GetLastVibration( | 118 | Core::HID::VibrationValue GetLastVibration( |
| 119 | const Core::HID::VibrationDeviceHandle& vibration_device_handle) const; | 119 | const Core::HID::VibrationDeviceHandle& vibration_device_handle) const; |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 87e7b864a..2bf1d8a27 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -1601,16 +1601,16 @@ void Hid::SendVibrationValues(HLERequestContext& ctx) { | |||
| 1601 | IPC::RequestParser rp{ctx}; | 1601 | IPC::RequestParser rp{ctx}; |
| 1602 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 1602 | const auto applet_resource_user_id{rp.Pop<u64>()}; |
| 1603 | 1603 | ||
| 1604 | const auto handles = ctx.ReadBuffer(0); | 1604 | const auto handle_data = ctx.ReadBuffer(0); |
| 1605 | const auto vibrations = ctx.ReadBuffer(1); | 1605 | const auto handle_count = ctx.GetReadBufferNumElements<Core::HID::VibrationDeviceHandle>(0); |
| 1606 | 1606 | const auto vibration_data = ctx.ReadBuffer(1); | |
| 1607 | std::vector<Core::HID::VibrationDeviceHandle> vibration_device_handles( | 1607 | const auto vibration_count = ctx.GetReadBufferNumElements<Core::HID::VibrationValue>(1); |
| 1608 | handles.size() / sizeof(Core::HID::VibrationDeviceHandle)); | 1608 | |
| 1609 | std::vector<Core::HID::VibrationValue> vibration_values(vibrations.size() / | 1609 | auto vibration_device_handles = |
| 1610 | sizeof(Core::HID::VibrationValue)); | 1610 | std::span(reinterpret_cast<const Core::HID::VibrationDeviceHandle*>(handle_data.data()), |
| 1611 | 1611 | handle_count); | |
| 1612 | std::memcpy(vibration_device_handles.data(), handles.data(), handles.size()); | 1612 | auto vibration_values = std::span( |
| 1613 | std::memcpy(vibration_values.data(), vibrations.data(), vibrations.size()); | 1613 | reinterpret_cast<const Core::HID::VibrationValue*>(vibration_data.data()), vibration_count); |
| 1614 | 1614 | ||
| 1615 | applet_resource->GetController<Controller_NPad>(HidController::NPad) | 1615 | applet_resource->GetController<Controller_NPad>(HidController::NPad) |
| 1616 | .VibrateControllers(vibration_device_handles, vibration_values); | 1616 | .VibrateControllers(vibration_device_handles, vibration_values); |
diff --git a/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp b/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp index cd0a13094..b16f9933f 100644 --- a/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp +++ b/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp | |||
| @@ -793,6 +793,7 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot, | |||
| 793 | std::scoped_lock lock{core->mutex}; | 793 | std::scoped_lock lock{core->mutex}; |
| 794 | 794 | ||
| 795 | slots[slot] = {}; | 795 | slots[slot] = {}; |
| 796 | slots[slot].fence = Fence::NoFence(); | ||
| 796 | slots[slot].graphic_buffer = buffer; | 797 | slots[slot].graphic_buffer = buffer; |
| 797 | slots[slot].frame_number = 0; | 798 | slots[slot].frame_number = 0; |
| 798 | 799 | ||
| @@ -854,7 +855,7 @@ void BufferQueueProducer::Transact(HLERequestContext& ctx, TransactionId code, u | |||
| 854 | status = DequeueBuffer(&slot, &fence, is_async, width, height, pixel_format, usage); | 855 | status = DequeueBuffer(&slot, &fence, is_async, width, height, pixel_format, usage); |
| 855 | 856 | ||
| 856 | parcel_out.Write(slot); | 857 | parcel_out.Write(slot); |
| 857 | parcel_out.WriteObject(&fence); | 858 | parcel_out.WriteFlattenedObject(&fence); |
| 858 | break; | 859 | break; |
| 859 | } | 860 | } |
| 860 | case TransactionId::RequestBuffer: { | 861 | case TransactionId::RequestBuffer: { |
| @@ -864,7 +865,7 @@ void BufferQueueProducer::Transact(HLERequestContext& ctx, TransactionId code, u | |||
| 864 | 865 | ||
| 865 | status = RequestBuffer(slot, &buf); | 866 | status = RequestBuffer(slot, &buf); |
| 866 | 867 | ||
| 867 | parcel_out.WriteObject(buf); | 868 | parcel_out.WriteFlattenedObject(buf); |
| 868 | break; | 869 | break; |
| 869 | } | 870 | } |
| 870 | case TransactionId::QueueBuffer: { | 871 | case TransactionId::QueueBuffer: { |
diff --git a/src/core/hle/service/nvnflinger/parcel.h b/src/core/hle/service/nvnflinger/parcel.h index d1b6201e0..fb56d75d7 100644 --- a/src/core/hle/service/nvnflinger/parcel.h +++ b/src/core/hle/service/nvnflinger/parcel.h | |||
| @@ -117,61 +117,67 @@ private: | |||
| 117 | 117 | ||
| 118 | class OutputParcel final { | 118 | class OutputParcel final { |
| 119 | public: | 119 | public: |
| 120 | static constexpr std::size_t DefaultBufferSize = 0x40; | 120 | OutputParcel() = default; |
| 121 | |||
| 122 | OutputParcel() : buffer(DefaultBufferSize) {} | ||
| 123 | |||
| 124 | template <typename T> | ||
| 125 | explicit OutputParcel(const T& out_data) : buffer(DefaultBufferSize) { | ||
| 126 | Write(out_data); | ||
| 127 | } | ||
| 128 | 121 | ||
| 129 | template <typename T> | 122 | template <typename T> |
| 130 | void Write(const T& val) { | 123 | void Write(const T& val) { |
| 131 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable."); | 124 | this->WriteImpl(val, m_data_buffer); |
| 132 | |||
| 133 | if (buffer.size() < write_index + sizeof(T)) { | ||
| 134 | buffer.resize(buffer.size() + sizeof(T) + DefaultBufferSize); | ||
| 135 | } | ||
| 136 | |||
| 137 | std::memcpy(buffer.data() + write_index, &val, sizeof(T)); | ||
| 138 | write_index += sizeof(T); | ||
| 139 | write_index = Common::AlignUp(write_index, 4); | ||
| 140 | } | 125 | } |
| 141 | 126 | ||
| 142 | template <typename T> | 127 | template <typename T> |
| 143 | void WriteObject(const T* ptr) { | 128 | void WriteFlattenedObject(const T* ptr) { |
| 144 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable."); | ||
| 145 | |||
| 146 | if (!ptr) { | 129 | if (!ptr) { |
| 147 | Write<u32>(0); | 130 | this->Write<u32>(0); |
| 148 | return; | 131 | return; |
| 149 | } | 132 | } |
| 150 | 133 | ||
| 151 | Write<u32>(1); | 134 | this->Write<u32>(1); |
| 152 | Write<s64>(sizeof(T)); | 135 | this->Write<s64>(sizeof(T)); |
| 153 | Write(*ptr); | 136 | this->Write(*ptr); |
| 154 | } | 137 | } |
| 155 | 138 | ||
| 156 | template <typename T> | 139 | template <typename T> |
| 157 | void WriteObject(const std::shared_ptr<T> ptr) { | 140 | void WriteFlattenedObject(const std::shared_ptr<T> ptr) { |
| 158 | WriteObject(ptr.get()); | 141 | this->WriteFlattenedObject(ptr.get()); |
| 142 | } | ||
| 143 | |||
| 144 | template <typename T> | ||
| 145 | void WriteInterface(const T& val) { | ||
| 146 | this->WriteImpl(val, m_data_buffer); | ||
| 147 | this->WriteImpl(0U, m_object_buffer); | ||
| 159 | } | 148 | } |
| 160 | 149 | ||
| 161 | std::vector<u8> Serialize() const { | 150 | std::vector<u8> Serialize() const { |
| 151 | std::vector<u8> output_buffer(sizeof(ParcelHeader) + m_data_buffer.size() + | ||
| 152 | m_object_buffer.size()); | ||
| 153 | |||
| 162 | ParcelHeader header{}; | 154 | ParcelHeader header{}; |
| 163 | header.data_size = static_cast<u32>(write_index - sizeof(ParcelHeader)); | 155 | header.data_size = static_cast<u32>(m_data_buffer.size()); |
| 164 | header.data_offset = sizeof(ParcelHeader); | 156 | header.data_offset = sizeof(ParcelHeader); |
| 165 | header.objects_size = 4; | 157 | header.objects_size = static_cast<u32>(m_object_buffer.size()); |
| 166 | header.objects_offset = static_cast<u32>(sizeof(ParcelHeader) + header.data_size); | 158 | header.objects_offset = header.data_offset + header.data_size; |
| 167 | std::memcpy(buffer.data(), &header, sizeof(ParcelHeader)); | 159 | |
| 160 | std::memcpy(output_buffer.data(), &header, sizeof(header)); | ||
| 161 | std::ranges::copy(m_data_buffer, output_buffer.data() + header.data_offset); | ||
| 162 | std::ranges::copy(m_object_buffer, output_buffer.data() + header.objects_offset); | ||
| 163 | |||
| 164 | return output_buffer; | ||
| 165 | } | ||
| 166 | |||
| 167 | private: | ||
| 168 | template <typename T> | ||
| 169 | requires(std::is_trivially_copyable_v<T>) | ||
| 170 | void WriteImpl(const T& val, std::vector<u8>& buffer) { | ||
| 171 | const size_t aligned_size = Common::AlignUp(sizeof(T), 4); | ||
| 172 | const size_t old_size = buffer.size(); | ||
| 173 | buffer.resize(old_size + aligned_size); | ||
| 168 | 174 | ||
| 169 | return buffer; | 175 | std::memcpy(buffer.data() + old_size, &val, sizeof(T)); |
| 170 | } | 176 | } |
| 171 | 177 | ||
| 172 | private: | 178 | private: |
| 173 | mutable std::vector<u8> buffer; | 179 | std::vector<u8> m_data_buffer; |
| 174 | std::size_t write_index = sizeof(ParcelHeader); | 180 | std::vector<u8> m_object_buffer; |
| 175 | }; | 181 | }; |
| 176 | 182 | ||
| 177 | } // namespace Service::android | 183 | } // namespace Service::android |
diff --git a/src/core/hle/service/time/clock_types.h b/src/core/hle/service/time/clock_types.h index ed1eb5b2d..e6293ffb9 100644 --- a/src/core/hle/service/time/clock_types.h +++ b/src/core/hle/service/time/clock_types.h | |||
| @@ -59,6 +59,18 @@ static_assert(sizeof(SystemClockContext) == 0x20, "SystemClockContext is incorre | |||
| 59 | static_assert(std::is_trivially_copyable_v<SystemClockContext>, | 59 | static_assert(std::is_trivially_copyable_v<SystemClockContext>, |
| 60 | "SystemClockContext must be trivially copyable"); | 60 | "SystemClockContext must be trivially copyable"); |
| 61 | 61 | ||
| 62 | struct ContinuousAdjustmentTimePoint { | ||
| 63 | s64 measurement_offset; | ||
| 64 | s64 diff_scale; | ||
| 65 | u32 shift_amount; | ||
| 66 | s64 lower; | ||
| 67 | s64 upper; | ||
| 68 | Common::UUID clock_source_id; | ||
| 69 | }; | ||
| 70 | static_assert(sizeof(ContinuousAdjustmentTimePoint) == 0x38); | ||
| 71 | static_assert(std::is_trivially_copyable_v<ContinuousAdjustmentTimePoint>, | ||
| 72 | "ContinuousAdjustmentTimePoint must be trivially copyable"); | ||
| 73 | |||
| 62 | /// https://switchbrew.org/wiki/Glue_services#TimeSpanType | 74 | /// https://switchbrew.org/wiki/Glue_services#TimeSpanType |
| 63 | struct TimeSpanType { | 75 | struct TimeSpanType { |
| 64 | s64 nanoseconds{}; | 76 | s64 nanoseconds{}; |
diff --git a/src/core/hle/service/time/time_sharedmemory.cpp b/src/core/hle/service/time/time_sharedmemory.cpp index ff53a7d6f..ce1c85bcc 100644 --- a/src/core/hle/service/time/time_sharedmemory.cpp +++ b/src/core/hle/service/time/time_sharedmemory.cpp | |||
| @@ -30,6 +30,25 @@ void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id, | |||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | void SharedMemory::UpdateLocalSystemClockContext(const Clock::SystemClockContext& context) { | 32 | void SharedMemory::UpdateLocalSystemClockContext(const Clock::SystemClockContext& context) { |
| 33 | // lower and upper are related to the measurement point for the steady time point, | ||
| 34 | // and compare equal on boot | ||
| 35 | const s64 time_point_ns = context.steady_time_point.time_point * 1'000'000'000LL; | ||
| 36 | |||
| 37 | // This adjusts for some sort of time skew | ||
| 38 | // Both 0 on boot | ||
| 39 | const s64 diff_scale = 0; | ||
| 40 | const u32 shift_amount = 0; | ||
| 41 | |||
| 42 | const Clock::ContinuousAdjustmentTimePoint adjustment{ | ||
| 43 | .measurement_offset = system.CoreTiming().GetGlobalTimeNs().count(), | ||
| 44 | .diff_scale = diff_scale, | ||
| 45 | .shift_amount = shift_amount, | ||
| 46 | .lower = time_point_ns, | ||
| 47 | .upper = time_point_ns, | ||
| 48 | .clock_source_id = context.steady_time_point.clock_source_id, | ||
| 49 | }; | ||
| 50 | |||
| 51 | StoreToLockFreeAtomicType(&GetFormat()->continuous_adjustment_timepoint, adjustment); | ||
| 33 | StoreToLockFreeAtomicType(&GetFormat()->standard_local_system_clock_context, context); | 52 | StoreToLockFreeAtomicType(&GetFormat()->standard_local_system_clock_context, context); |
| 34 | } | 53 | } |
| 35 | 54 | ||
diff --git a/src/core/hle/service/time/time_sharedmemory.h b/src/core/hle/service/time/time_sharedmemory.h index 044a4d24e..c89be9765 100644 --- a/src/core/hle/service/time/time_sharedmemory.h +++ b/src/core/hle/service/time/time_sharedmemory.h | |||
| @@ -65,14 +65,15 @@ public: | |||
| 65 | LockFreeAtomicType<Clock::SystemClockContext> standard_local_system_clock_context; | 65 | LockFreeAtomicType<Clock::SystemClockContext> standard_local_system_clock_context; |
| 66 | LockFreeAtomicType<Clock::SystemClockContext> standard_network_system_clock_context; | 66 | LockFreeAtomicType<Clock::SystemClockContext> standard_network_system_clock_context; |
| 67 | LockFreeAtomicType<bool> is_standard_user_system_clock_automatic_correction_enabled; | 67 | LockFreeAtomicType<bool> is_standard_user_system_clock_automatic_correction_enabled; |
| 68 | u32 format_version; | 68 | LockFreeAtomicType<Clock::ContinuousAdjustmentTimePoint> continuous_adjustment_timepoint; |
| 69 | }; | 69 | }; |
| 70 | static_assert(offsetof(Format, standard_steady_clock_timepoint) == 0x0); | 70 | static_assert(offsetof(Format, standard_steady_clock_timepoint) == 0x0); |
| 71 | static_assert(offsetof(Format, standard_local_system_clock_context) == 0x38); | 71 | static_assert(offsetof(Format, standard_local_system_clock_context) == 0x38); |
| 72 | static_assert(offsetof(Format, standard_network_system_clock_context) == 0x80); | 72 | static_assert(offsetof(Format, standard_network_system_clock_context) == 0x80); |
| 73 | static_assert(offsetof(Format, is_standard_user_system_clock_automatic_correction_enabled) == | 73 | static_assert(offsetof(Format, is_standard_user_system_clock_automatic_correction_enabled) == |
| 74 | 0xc8); | 74 | 0xc8); |
| 75 | static_assert(sizeof(Format) == 0xd8, "Format is an invalid size"); | 75 | static_assert(offsetof(Format, continuous_adjustment_timepoint) == 0xd0); |
| 76 | static_assert(sizeof(Format) == 0x148, "Format is an invalid size"); | ||
| 76 | 77 | ||
| 77 | void SetupStandardSteadyClock(const Common::UUID& clock_source_id, | 78 | void SetupStandardSteadyClock(const Common::UUID& clock_source_id, |
| 78 | Clock::TimeSpanType current_time_point); | 79 | Clock::TimeSpanType current_time_point); |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 68eab5133..1b193f00c 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -64,8 +64,8 @@ public: | |||
| 64 | private: | 64 | private: |
| 65 | const u32 magic = 2; | 65 | const u32 magic = 2; |
| 66 | const u32 process_id = 1; | 66 | const u32 process_id = 1; |
| 67 | const u32 id; | 67 | const u64 id; |
| 68 | INSERT_PADDING_WORDS(3); | 68 | INSERT_PADDING_WORDS(2); |
| 69 | std::array<u8, 8> dispdrv = {'d', 'i', 's', 'p', 'd', 'r', 'v', '\0'}; | 69 | std::array<u8, 8> dispdrv = {'d', 'i', 's', 'p', 'd', 'r', 'v', '\0'}; |
| 70 | INSERT_PADDING_WORDS(2); | 70 | INSERT_PADDING_WORDS(2); |
| 71 | }; | 71 | }; |
| @@ -608,7 +608,9 @@ private: | |||
| 608 | return; | 608 | return; |
| 609 | } | 609 | } |
| 610 | 610 | ||
| 611 | const auto parcel = android::OutputParcel{NativeWindow{*buffer_queue_id}}; | 611 | android::OutputParcel parcel; |
| 612 | parcel.WriteInterface(NativeWindow{*buffer_queue_id}); | ||
| 613 | |||
| 612 | const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); | 614 | const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); |
| 613 | 615 | ||
| 614 | IPC::ResponseBuilder rb{ctx, 4}; | 616 | IPC::ResponseBuilder rb{ctx, 4}; |
| @@ -654,7 +656,9 @@ private: | |||
| 654 | return; | 656 | return; |
| 655 | } | 657 | } |
| 656 | 658 | ||
| 657 | const auto parcel = android::OutputParcel{NativeWindow{*buffer_queue_id}}; | 659 | android::OutputParcel parcel; |
| 660 | parcel.WriteInterface(NativeWindow{*buffer_queue_id}); | ||
| 661 | |||
| 658 | const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); | 662 | const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); |
| 659 | 663 | ||
| 660 | IPC::ResponseBuilder rb{ctx, 6}; | 664 | IPC::ResponseBuilder rb{ctx, 6}; |
diff --git a/src/input_common/helpers/joycon_protocol/joycon_types.h b/src/input_common/helpers/joycon_protocol/joycon_types.h index b03143e04..1c8d294b0 100644 --- a/src/input_common/helpers/joycon_protocol/joycon_types.h +++ b/src/input_common/helpers/joycon_protocol/joycon_types.h | |||
| @@ -394,6 +394,7 @@ enum class DriverResult { | |||
| 394 | InvalidHandle, | 394 | InvalidHandle, |
| 395 | NotSupported, | 395 | NotSupported, |
| 396 | Disabled, | 396 | Disabled, |
| 397 | Delayed, | ||
| 397 | Unknown, | 398 | Unknown, |
| 398 | }; | 399 | }; |
| 399 | 400 | ||
diff --git a/src/input_common/helpers/joycon_protocol/nfc.cpp b/src/input_common/helpers/joycon_protocol/nfc.cpp index 77ea6d5cf..14818ae33 100644 --- a/src/input_common/helpers/joycon_protocol/nfc.cpp +++ b/src/input_common/helpers/joycon_protocol/nfc.cpp | |||
| @@ -72,6 +72,11 @@ DriverResult NfcProtocol::StartNFCPollingMode() { | |||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | DriverResult NfcProtocol::ScanAmiibo(std::vector<u8>& data) { | 74 | DriverResult NfcProtocol::ScanAmiibo(std::vector<u8>& data) { |
| 75 | if (update_counter++ < AMIIBO_UPDATE_DELAY) { | ||
| 76 | return DriverResult::Delayed; | ||
| 77 | } | ||
| 78 | update_counter = 0; | ||
| 79 | |||
| 75 | LOG_DEBUG(Input, "Start NFC pooling Mode"); | 80 | LOG_DEBUG(Input, "Start NFC pooling Mode"); |
| 76 | ScopedSetBlocking sb(this); | 81 | ScopedSetBlocking sb(this); |
| 77 | DriverResult result{DriverResult::Success}; | 82 | DriverResult result{DriverResult::Success}; |
| @@ -87,7 +92,7 @@ DriverResult NfcProtocol::ScanAmiibo(std::vector<u8>& data) { | |||
| 87 | result = WaitUntilNfcIsReady(); | 92 | result = WaitUntilNfcIsReady(); |
| 88 | } | 93 | } |
| 89 | if (result == DriverResult::Success) { | 94 | if (result == DriverResult::Success) { |
| 90 | result = StartPolling(tag_data); | 95 | result = StartPolling(tag_data, 7); |
| 91 | } | 96 | } |
| 92 | if (result == DriverResult::Success) { | 97 | if (result == DriverResult::Success) { |
| 93 | result = GetAmiiboData(data); | 98 | result = GetAmiiboData(data); |
| @@ -129,9 +134,8 @@ DriverResult NfcProtocol::WaitUntilNfcIsReady() { | |||
| 129 | return DriverResult::Success; | 134 | return DriverResult::Success; |
| 130 | } | 135 | } |
| 131 | 136 | ||
| 132 | DriverResult NfcProtocol::StartPolling(TagFoundData& data) { | 137 | DriverResult NfcProtocol::StartPolling(TagFoundData& data, std::size_t timeout_limit) { |
| 133 | LOG_DEBUG(Input, "Start Polling for tag"); | 138 | LOG_DEBUG(Input, "Start Polling for tag"); |
| 134 | constexpr std::size_t timeout_limit = 7; | ||
| 135 | MCUCommandResponse output{}; | 139 | MCUCommandResponse output{}; |
| 136 | std::size_t tries = 0; | 140 | std::size_t tries = 0; |
| 137 | 141 | ||
diff --git a/src/input_common/helpers/joycon_protocol/nfc.h b/src/input_common/helpers/joycon_protocol/nfc.h index 11e263e07..4cb992d1d 100644 --- a/src/input_common/helpers/joycon_protocol/nfc.h +++ b/src/input_common/helpers/joycon_protocol/nfc.h | |||
| @@ -32,6 +32,9 @@ public: | |||
| 32 | bool IsEnabled() const; | 32 | bool IsEnabled() const; |
| 33 | 33 | ||
| 34 | private: | 34 | private: |
| 35 | // Number of times the function will be delayed until it outputs valid data | ||
| 36 | static constexpr std::size_t AMIIBO_UPDATE_DELAY = 15; | ||
| 37 | |||
| 35 | struct TagFoundData { | 38 | struct TagFoundData { |
| 36 | u8 type; | 39 | u8 type; |
| 37 | std::vector<u8> uuid; | 40 | std::vector<u8> uuid; |
| @@ -39,7 +42,7 @@ private: | |||
| 39 | 42 | ||
| 40 | DriverResult WaitUntilNfcIsReady(); | 43 | DriverResult WaitUntilNfcIsReady(); |
| 41 | 44 | ||
| 42 | DriverResult StartPolling(TagFoundData& data); | 45 | DriverResult StartPolling(TagFoundData& data, std::size_t timeout_limit = 1); |
| 43 | 46 | ||
| 44 | DriverResult ReadTag(const TagFoundData& data); | 47 | DriverResult ReadTag(const TagFoundData& data); |
| 45 | 48 | ||
| @@ -56,6 +59,7 @@ private: | |||
| 56 | NFCReadBlockCommand GetReadBlockCommand(NFCPages pages) const; | 59 | NFCReadBlockCommand GetReadBlockCommand(NFCPages pages) const; |
| 57 | 60 | ||
| 58 | bool is_enabled{}; | 61 | bool is_enabled{}; |
| 62 | std::size_t update_counter{}; | ||
| 59 | }; | 63 | }; |
| 60 | 64 | ||
| 61 | } // namespace InputCommon::Joycon | 65 | } // namespace InputCommon::Joycon |
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index fff57ffa9..98756e4da 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -131,33 +131,15 @@ std::optional<VideoCore::RasterizerDownloadArea> BufferCache<P>::GetFlushArea(VA | |||
| 131 | 131 | ||
| 132 | template <class P> | 132 | template <class P> |
| 133 | void BufferCache<P>::DownloadMemory(VAddr cpu_addr, u64 size) { | 133 | void BufferCache<P>::DownloadMemory(VAddr cpu_addr, u64 size) { |
| 134 | WaitOnAsyncFlushes(cpu_addr, size); | ||
| 135 | ForEachBufferInRange(cpu_addr, size, [&](BufferId, Buffer& buffer) { | 134 | ForEachBufferInRange(cpu_addr, size, [&](BufferId, Buffer& buffer) { |
| 136 | DownloadBufferMemory(buffer, cpu_addr, size); | 135 | DownloadBufferMemory(buffer, cpu_addr, size); |
| 137 | }); | 136 | }); |
| 138 | } | 137 | } |
| 139 | 138 | ||
| 140 | template <class P> | 139 | template <class P> |
| 141 | void BufferCache<P>::WaitOnAsyncFlushes(VAddr cpu_addr, u64 size) { | ||
| 142 | bool must_wait = false; | ||
| 143 | ForEachInOverlapCounter(async_downloads, cpu_addr, size, | ||
| 144 | [&](VAddr, VAddr, int) { must_wait = true; }); | ||
| 145 | bool must_release = false; | ||
| 146 | ForEachInRangeSet(pending_ranges, cpu_addr, size, [&](VAddr, VAddr) { must_release = true; }); | ||
| 147 | if (must_release) { | ||
| 148 | std::function<void()> tmp([]() {}); | ||
| 149 | rasterizer.SignalFence(std::move(tmp)); | ||
| 150 | } | ||
| 151 | if (must_wait || must_release) { | ||
| 152 | rasterizer.ReleaseFences(); | ||
| 153 | } | ||
| 154 | } | ||
| 155 | |||
| 156 | template <class P> | ||
| 157 | void BufferCache<P>::ClearDownload(IntervalType subtract_interval) { | 140 | void BufferCache<P>::ClearDownload(IntervalType subtract_interval) { |
| 158 | RemoveEachInOverlapCounter(async_downloads, subtract_interval, -1024); | 141 | RemoveEachInOverlapCounter(async_downloads, subtract_interval, -1024); |
| 159 | uncommitted_ranges.subtract(subtract_interval); | 142 | uncommitted_ranges.subtract(subtract_interval); |
| 160 | pending_ranges.subtract(subtract_interval); | ||
| 161 | for (auto& interval_set : committed_ranges) { | 143 | for (auto& interval_set : committed_ranges) { |
| 162 | interval_set.subtract(subtract_interval); | 144 | interval_set.subtract(subtract_interval); |
| 163 | } | 145 | } |
| @@ -177,7 +159,6 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am | |||
| 177 | } | 159 | } |
| 178 | 160 | ||
| 179 | const IntervalType subtract_interval{*cpu_dest_address, *cpu_dest_address + amount}; | 161 | const IntervalType subtract_interval{*cpu_dest_address, *cpu_dest_address + amount}; |
| 180 | WaitOnAsyncFlushes(*cpu_src_address, static_cast<u32>(amount)); | ||
| 181 | ClearDownload(subtract_interval); | 162 | ClearDownload(subtract_interval); |
| 182 | 163 | ||
| 183 | BufferId buffer_a; | 164 | BufferId buffer_a; |
| @@ -205,7 +186,6 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am | |||
| 205 | const IntervalType add_interval{new_base_address, new_base_address + size}; | 186 | const IntervalType add_interval{new_base_address, new_base_address + size}; |
| 206 | tmp_intervals.push_back(add_interval); | 187 | tmp_intervals.push_back(add_interval); |
| 207 | uncommitted_ranges.add(add_interval); | 188 | uncommitted_ranges.add(add_interval); |
| 208 | pending_ranges.add(add_interval); | ||
| 209 | }; | 189 | }; |
| 210 | ForEachInRangeSet(common_ranges, *cpu_src_address, amount, mirror); | 190 | ForEachInRangeSet(common_ranges, *cpu_src_address, amount, mirror); |
| 211 | // This subtraction in this order is important for overlapping copies. | 191 | // This subtraction in this order is important for overlapping copies. |
| @@ -492,7 +472,6 @@ void BufferCache<P>::CommitAsyncFlushesHigh() { | |||
| 492 | } | 472 | } |
| 493 | MICROPROFILE_SCOPE(GPU_DownloadMemory); | 473 | MICROPROFILE_SCOPE(GPU_DownloadMemory); |
| 494 | 474 | ||
| 495 | pending_ranges.clear(); | ||
| 496 | auto it = committed_ranges.begin(); | 475 | auto it = committed_ranges.begin(); |
| 497 | while (it != committed_ranges.end()) { | 476 | while (it != committed_ranges.end()) { |
| 498 | auto& current_intervals = *it; | 477 | auto& current_intervals = *it; |
| @@ -1232,7 +1211,6 @@ void BufferCache<P>::MarkWrittenBuffer(BufferId buffer_id, VAddr cpu_addr, u32 s | |||
| 1232 | const IntervalType base_interval{cpu_addr, cpu_addr + size}; | 1211 | const IntervalType base_interval{cpu_addr, cpu_addr + size}; |
| 1233 | common_ranges.add(base_interval); | 1212 | common_ranges.add(base_interval); |
| 1234 | uncommitted_ranges.add(base_interval); | 1213 | uncommitted_ranges.add(base_interval); |
| 1235 | pending_ranges.add(base_interval); | ||
| 1236 | } | 1214 | } |
| 1237 | 1215 | ||
| 1238 | template <class P> | 1216 | template <class P> |
| @@ -1677,14 +1655,15 @@ typename BufferCache<P>::Binding BufferCache<P>::StorageBufferBinding(GPUVAddr s | |||
| 1677 | const bool is_nvn_cbuf = cbuf_index == 0; | 1655 | const bool is_nvn_cbuf = cbuf_index == 0; |
| 1678 | // The NVN driver buffer (index 0) is known to pack the SSBO address followed by its size. | 1656 | // The NVN driver buffer (index 0) is known to pack the SSBO address followed by its size. |
| 1679 | if (is_nvn_cbuf) { | 1657 | if (is_nvn_cbuf) { |
| 1680 | return gpu_memory->Read<u32>(ssbo_addr + 8); | 1658 | const u32 ssbo_size = gpu_memory->Read<u32>(ssbo_addr + 8); |
| 1659 | if (ssbo_size != 0) { | ||
| 1660 | return ssbo_size; | ||
| 1661 | } | ||
| 1681 | } | 1662 | } |
| 1682 | // Other titles (notably Doom Eternal) may use STG/LDG on buffer addresses in custom defined | 1663 | // Other titles (notably Doom Eternal) may use STG/LDG on buffer addresses in custom defined |
| 1683 | // cbufs, which do not store the sizes adjacent to the addresses, so use the fully | 1664 | // cbufs, which do not store the sizes adjacent to the addresses, so use the fully |
| 1684 | // mapped buffer size for now. | 1665 | // mapped buffer size for now. |
| 1685 | const u32 memory_layout_size = static_cast<u32>(gpu_memory->GetMemoryLayoutSize(gpu_addr)); | 1666 | const u32 memory_layout_size = static_cast<u32>(gpu_memory->GetMemoryLayoutSize(gpu_addr)); |
| 1686 | LOG_INFO(HW_GPU, "Binding storage buffer for cbuf index {}, MemoryLayoutSize 0x{:X}", | ||
| 1687 | cbuf_index, memory_layout_size); | ||
| 1688 | return memory_layout_size; | 1667 | return memory_layout_size; |
| 1689 | }(); | 1668 | }(); |
| 1690 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr); | 1669 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr); |
diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index 0445ec47f..ac00d4d9d 100644 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h | |||
| @@ -381,8 +381,6 @@ private: | |||
| 381 | 381 | ||
| 382 | void RunGarbageCollector(); | 382 | void RunGarbageCollector(); |
| 383 | 383 | ||
| 384 | void WaitOnAsyncFlushes(VAddr cpu_addr, u64 size); | ||
| 385 | |||
| 386 | void BindHostIndexBuffer(); | 384 | void BindHostIndexBuffer(); |
| 387 | 385 | ||
| 388 | void BindHostVertexBuffers(); | 386 | void BindHostVertexBuffers(); |
| @@ -547,7 +545,6 @@ private: | |||
| 547 | IntervalSet uncommitted_ranges; | 545 | IntervalSet uncommitted_ranges; |
| 548 | IntervalSet common_ranges; | 546 | IntervalSet common_ranges; |
| 549 | IntervalSet cached_ranges; | 547 | IntervalSet cached_ranges; |
| 550 | IntervalSet pending_ranges; | ||
| 551 | std::deque<IntervalSet> committed_ranges; | 548 | std::deque<IntervalSet> committed_ranges; |
| 552 | 549 | ||
| 553 | // Async Buffers | 550 | // Async Buffers |
diff --git a/src/video_core/host1x/codecs/h264.cpp b/src/video_core/host1x/codecs/h264.cpp index e87bd65fa..6ce179167 100644 --- a/src/video_core/host1x/codecs/h264.cpp +++ b/src/video_core/host1x/codecs/h264.cpp | |||
| @@ -111,7 +111,7 @@ const std::vector<u8>& H264::ComposeFrame(const Host1x::NvdecCommon::NvdecRegist | |||
| 111 | writer.WriteUe(0); | 111 | writer.WriteUe(0); |
| 112 | 112 | ||
| 113 | writer.WriteBit(context.h264_parameter_set.entropy_coding_mode_flag != 0); | 113 | writer.WriteBit(context.h264_parameter_set.entropy_coding_mode_flag != 0); |
| 114 | writer.WriteBit(false); | 114 | writer.WriteBit(context.h264_parameter_set.pic_order_present_flag != 0); |
| 115 | writer.WriteUe(0); | 115 | writer.WriteUe(0); |
| 116 | writer.WriteUe(context.h264_parameter_set.num_refidx_l0_default_active); | 116 | writer.WriteUe(context.h264_parameter_set.num_refidx_l0_default_active); |
| 117 | writer.WriteUe(context.h264_parameter_set.num_refidx_l1_default_active); | 117 | writer.WriteUe(context.h264_parameter_set.num_refidx_l1_default_active); |
| @@ -129,7 +129,7 @@ const std::vector<u8>& H264::ComposeFrame(const Host1x::NvdecCommon::NvdecRegist | |||
| 129 | writer.WriteBit(context.h264_parameter_set.redundant_pic_cnt_present_flag != 0); | 129 | writer.WriteBit(context.h264_parameter_set.redundant_pic_cnt_present_flag != 0); |
| 130 | writer.WriteBit(context.h264_parameter_set.transform_8x8_mode_flag != 0); | 130 | writer.WriteBit(context.h264_parameter_set.transform_8x8_mode_flag != 0); |
| 131 | 131 | ||
| 132 | writer.WriteBit(true); | 132 | writer.WriteBit(true); // pic_scaling_matrix_present_flag |
| 133 | 133 | ||
| 134 | for (s32 index = 0; index < 6; index++) { | 134 | for (s32 index = 0; index < 6; index++) { |
| 135 | writer.WriteBit(true); | 135 | writer.WriteBit(true); |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 012d6fa73..4d0481f2a 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -1864,6 +1864,7 @@ void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime, | |||
| 1864 | num_layers = std::max(num_layers, color_buffer->range.extent.layers); | 1864 | num_layers = std::max(num_layers, color_buffer->range.extent.layers); |
| 1865 | images[num_images] = color_buffer->ImageHandle(); | 1865 | images[num_images] = color_buffer->ImageHandle(); |
| 1866 | image_ranges[num_images] = MakeSubresourceRange(color_buffer); | 1866 | image_ranges[num_images] = MakeSubresourceRange(color_buffer); |
| 1867 | rt_map[index] = num_images; | ||
| 1867 | samples = color_buffer->Samples(); | 1868 | samples = color_buffer->Samples(); |
| 1868 | ++num_images; | 1869 | ++num_images; |
| 1869 | } | 1870 | } |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 23473bf9c..4166b3d20 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -334,7 +334,7 @@ public: | |||
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | [[nodiscard]] bool HasAspectColorBit(size_t index) const noexcept { | 336 | [[nodiscard]] bool HasAspectColorBit(size_t index) const noexcept { |
| 337 | return (image_ranges.at(index).aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != 0; | 337 | return (image_ranges.at(rt_map[index]).aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != 0; |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | [[nodiscard]] bool HasAspectDepthBit() const noexcept { | 340 | [[nodiscard]] bool HasAspectDepthBit() const noexcept { |
| @@ -354,6 +354,7 @@ private: | |||
| 354 | u32 num_images = 0; | 354 | u32 num_images = 0; |
| 355 | std::array<VkImage, 9> images{}; | 355 | std::array<VkImage, 9> images{}; |
| 356 | std::array<VkImageSubresourceRange, 9> image_ranges{}; | 356 | std::array<VkImageSubresourceRange, 9> image_ranges{}; |
| 357 | std::array<size_t, NUM_RT> rt_map{}; | ||
| 357 | bool has_depth{}; | 358 | bool has_depth{}; |
| 358 | bool has_stencil{}; | 359 | bool has_stencil{}; |
| 359 | }; | 360 | }; |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 6ffca2af2..161f050b8 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -1009,6 +1009,8 @@ void Device::CollectPhysicalMemoryInfo() { | |||
| 1009 | device_access_memory += mem_properties.memoryHeaps[element].size; | 1009 | device_access_memory += mem_properties.memoryHeaps[element].size; |
| 1010 | } | 1010 | } |
| 1011 | if (!is_integrated) { | 1011 | if (!is_integrated) { |
| 1012 | const u64 reserve_memory = std::min<u64>(device_access_memory / 8, 1_GiB); | ||
| 1013 | device_access_memory -= reserve_memory; | ||
| 1012 | return; | 1014 | return; |
| 1013 | } | 1015 | } |
| 1014 | const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage); | 1016 | const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage); |
diff --git a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp index 1732866e0..e28a556f8 100644 --- a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp +++ b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp | |||
| @@ -147,7 +147,7 @@ public: | |||
| 147 | 147 | ||
| 148 | /// Returns whether this allocation is compatible with the arguments. | 148 | /// Returns whether this allocation is compatible with the arguments. |
| 149 | [[nodiscard]] bool IsCompatible(VkMemoryPropertyFlags flags, u32 type_mask) const { | 149 | [[nodiscard]] bool IsCompatible(VkMemoryPropertyFlags flags, u32 type_mask) const { |
| 150 | return (flags & property_flags) == property_flags && (type_mask & shifted_memory_type) != 0; | 150 | return (flags & property_flags) == flags && (type_mask & shifted_memory_type) != 0; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | private: | 153 | private: |