Serialize GSP service

This commit is contained in:
Hamish Milne 2019-12-30 12:45:22 +00:00 committed by zhupengfei
parent 754f63af1a
commit 30494c06a4
6 changed files with 37 additions and 2 deletions

3
TODO
View File

@ -81,7 +81,8 @@
✔ ERR @done(19-12-26 18:14) ✔ ERR @done(19-12-26 18:14)
✔ FRD @done(19-12-26 19:09) ✔ FRD @done(19-12-26 19:09)
✔ FS @done(19-12-27 11:46) ✔ FS @done(19-12-27 11:46)
☐ GSP ✔ GSP @done(19-12-30 12:45)
☐ Fix the global weak_ptr to gsp
☐ HID ☐ HID
☐ HTTP ☐ HTTP
☐ IR ☐ IR

View File

@ -10,7 +10,7 @@
namespace Service::GSP { namespace Service::GSP {
static std::weak_ptr<GSP_GPU> gsp_gpu; static std::weak_ptr<GSP_GPU> gsp_gpu; // TODO: Fix this for the love of god
void SignalInterrupt(InterruptId interrupt_id) { void SignalInterrupt(InterruptId interrupt_id) {
auto gpu = gsp_gpu.lock(); auto gpu = gsp_gpu.lock();

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <vector> #include <vector>
#include "common/archives.h"
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/microprofile.h" #include "common/microprofile.h"
#include "common/swap.h" #include "common/swap.h"
@ -21,6 +22,10 @@
#include "video_core/debug_utils/debug_utils.h" #include "video_core/debug_utils/debug_utils.h"
#include "video_core/gpu_debugger.h" #include "video_core/gpu_debugger.h"
SERIALIZE_EXPORT_IMPL(Service::GSP::SessionData)
SERIALIZE_EXPORT_IMPL(Service::GSP::GSP_GPU)
SERVICE_CONSTRUCT_IMPL(Service::GSP::GSP_GPU)
// Main graphics debugger object - TODO: Here is probably not the best place for this // Main graphics debugger object - TODO: Here is probably not the best place for this
GraphicsDebugger g_debugger; GraphicsDebugger g_debugger;

View File

@ -199,6 +199,16 @@ public:
u32 thread_id; u32 thread_id;
/// Whether RegisterInterruptRelayQueue was called for this session /// Whether RegisterInterruptRelayQueue was called for this session
bool registered = false; bool registered = false;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& gsp;
ar& interrupt_event;
ar& thread_id;
ar& registered;
}
friend class boost::serialization::access;
}; };
class GSP_GPU final : public ServiceFramework<GSP_GPU, SessionData> { class GSP_GPU final : public ServiceFramework<GSP_GPU, SessionData> {
@ -431,8 +441,22 @@ private:
std::array<bool, MaxGSPThreads> used_thread_ids = {false, false, false, false}; std::array<bool, MaxGSPThreads> used_thread_ids = {false, false, false, false};
friend class SessionData; friend class SessionData;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& shared_memory;
ar& active_thread_id;
ar& first_initialization;
ar& used_thread_ids;
}
friend class boost::serialization::access;
}; };
ResultCode SetBufferSwap(u32 screen_id, const FrameBufferInfo& info); ResultCode SetBufferSwap(u32 screen_id, const FrameBufferInfo& info);
} // namespace Service::GSP } // namespace Service::GSP
BOOST_CLASS_EXPORT_KEY(Service::GSP::SessionData)
BOOST_CLASS_EXPORT_KEY(Service::GSP::GSP_GPU)
SERVICE_CONSTRUCT(Service::GSP::GSP_GPU)

View File

@ -2,9 +2,12 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/service/gsp/gsp_lcd.h" #include "core/hle/service/gsp/gsp_lcd.h"
SERIALIZE_EXPORT_IMPL(Service::GSP::GSP_LCD)
namespace Service::GSP { namespace Service::GSP {
GSP_LCD::GSP_LCD() : ServiceFramework("gsp::Lcd") { GSP_LCD::GSP_LCD() : ServiceFramework("gsp::Lcd") {

View File

@ -15,3 +15,5 @@ public:
}; };
} // namespace Service::GSP } // namespace Service::GSP
BOOST_CLASS_EXPORT_KEY(Service::GSP::GSP_LCD)