CAM service serialization
This commit is contained in:
parent
1185d62792
commit
17b9cbefef
11 changed files with 129 additions and 3 deletions
3
TODO
3
TODO
|
@ -66,7 +66,8 @@
|
||||||
✔ AM @started(19-12-24 23:17) @done(19-12-24 23:53) @lasted(36m8s)
|
✔ AM @started(19-12-24 23:17) @done(19-12-24 23:53) @lasted(36m8s)
|
||||||
✔ APT @done(19-12-25 21:41)
|
✔ APT @done(19-12-25 21:41)
|
||||||
✔ BOSS @started(19-12-25 21:48) @done(19-12-25 23:18) @lasted(1h30m14s)
|
✔ BOSS @started(19-12-25 21:48) @done(19-12-25 23:18) @lasted(1h30m14s)
|
||||||
☐ CAM
|
☐ CAM @started(19-12-26 10:37)
|
||||||
|
Need to check capture_result
|
||||||
☐ CECD
|
☐ CECD
|
||||||
☐ CGF
|
☐ CGF
|
||||||
☐ CSND
|
☐ CSND
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "common/archives.h"
|
||||||
#include "common/bit_set.h"
|
#include "common/bit_set.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
@ -22,6 +23,16 @@
|
||||||
|
|
||||||
namespace Service::CAM {
|
namespace Service::CAM {
|
||||||
|
|
||||||
|
template <class Archive>
|
||||||
|
void Module::serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & cameras;
|
||||||
|
ar & ports;
|
||||||
|
ar & is_camera_reload_pending;
|
||||||
|
}
|
||||||
|
|
||||||
|
SERIALIZE_IMPL(Module)
|
||||||
|
|
||||||
// built-in resolution parameters
|
// built-in resolution parameters
|
||||||
constexpr std::array<Resolution, 8> PRESET_RESOLUTION{{
|
constexpr std::array<Resolution, 8> PRESET_RESOLUTION{{
|
||||||
{640, 480, 0, 0, 639, 479}, // VGA
|
{640, 480, 0, 0, 639, 479}, // VGA
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "common/swap.h"
|
#include "common/swap.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
#include "core/global.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class System;
|
class System;
|
||||||
|
@ -179,6 +180,19 @@ struct Resolution {
|
||||||
u16 crop_y0;
|
u16 crop_y0;
|
||||||
u16 crop_x1;
|
u16 crop_x1;
|
||||||
u16 crop_y1;
|
u16 crop_y1;
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & width;
|
||||||
|
ar & height;
|
||||||
|
ar & crop_x0;
|
||||||
|
ar & crop_y0;
|
||||||
|
ar & crop_x1;
|
||||||
|
ar & crop_y1;
|
||||||
|
}
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PackageParameterWithoutContext {
|
struct PackageParameterWithoutContext {
|
||||||
|
@ -710,7 +724,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void DriverFinalize(Kernel::HLERequestContext& ctx);
|
void DriverFinalize(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
std::shared_ptr<Module> cam;
|
std::shared_ptr<Module> cam;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -738,6 +752,17 @@ private:
|
||||||
Effect effect{Effect::None};
|
Effect effect{Effect::None};
|
||||||
OutputFormat format{OutputFormat::YUV422};
|
OutputFormat format{OutputFormat::YUV422};
|
||||||
Resolution resolution = {0, 0, 0, 0, 0, 0};
|
Resolution resolution = {0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & flip;
|
||||||
|
ar & effect;
|
||||||
|
ar & format;
|
||||||
|
ar & resolution;
|
||||||
|
}
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CameraConfig {
|
struct CameraConfig {
|
||||||
|
@ -745,6 +770,17 @@ private:
|
||||||
std::array<ContextConfig, 2> contexts;
|
std::array<ContextConfig, 2> contexts;
|
||||||
int current_context{0};
|
int current_context{0};
|
||||||
FrameRate frame_rate{FrameRate::Rate_5};
|
FrameRate frame_rate{FrameRate::Rate_5};
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & impl;
|
||||||
|
ar & contexts;
|
||||||
|
ar & current_context;
|
||||||
|
ar & frame_rate;
|
||||||
|
}
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PortConfig {
|
struct PortConfig {
|
||||||
|
@ -779,6 +815,32 @@ private:
|
||||||
u32 dest_size{0}; // the destination size of the receiving process
|
u32 dest_size{0}; // the destination size of the receiving process
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & camera_id;
|
||||||
|
ar & is_active;
|
||||||
|
ar & is_pending_receiving;
|
||||||
|
ar & is_busy;
|
||||||
|
ar & is_receiving;
|
||||||
|
ar & is_trimming;
|
||||||
|
ar & x0;
|
||||||
|
ar & y0;
|
||||||
|
ar & x1;
|
||||||
|
ar & y1;
|
||||||
|
ar & transfer_bytes;
|
||||||
|
ar & completion_event;
|
||||||
|
ar & buffer_error_interrupt_event;
|
||||||
|
ar & vsync_interrupt_event;
|
||||||
|
// TODO: Check if this is ever needed:
|
||||||
|
//ar & capture_result;
|
||||||
|
ar & dest_process;
|
||||||
|
ar & dest;
|
||||||
|
ar & dest_size;
|
||||||
|
}
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
void LoadCameraImplementation(CameraConfig& camera, int camera_id);
|
void LoadCameraImplementation(CameraConfig& camera, int camera_id);
|
||||||
|
@ -786,8 +848,13 @@ private:
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
std::array<CameraConfig, NumCameras> cameras;
|
std::array<CameraConfig, NumCameras> cameras;
|
||||||
std::array<PortConfig, 2> ports;
|
std::array<PortConfig, 2> ports;
|
||||||
Core::TimingEventType* completion_event_callback;
|
// TODO: Make this *const
|
||||||
|
const Core::TimingEventType* completion_event_callback;
|
||||||
std::atomic<bool> is_camera_reload_pending{false};
|
std::atomic<bool> is_camera_reload_pending{false};
|
||||||
|
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int);
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<Module> GetModule(Core::System& system);
|
std::shared_ptr<Module> GetModule(Core::System& system);
|
||||||
|
@ -795,3 +862,11 @@ std::shared_ptr<Module> GetModule(Core::System& system);
|
||||||
void InstallInterfaces(Core::System& system);
|
void InstallInterfaces(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::CAM
|
} // namespace Service::CAM
|
||||||
|
|
||||||
|
namespace boost::serialization {
|
||||||
|
template <class Archive>
|
||||||
|
inline void load_construct_data(Archive& ar, Service::CAM::Module* t, const unsigned int)
|
||||||
|
{
|
||||||
|
::new(t)Service::CAM::Module(Core::Global<Core::System>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "core/hle/service/cam/cam.h"
|
#include "core/hle/service/cam/cam.h"
|
||||||
#include "core/hle/service/cam/cam_c.h"
|
#include "core/hle/service/cam/cam_c.h"
|
||||||
|
#include "common/archives.h"
|
||||||
|
|
||||||
namespace Service::CAM {
|
namespace Service::CAM {
|
||||||
|
|
||||||
|
@ -79,3 +80,5 @@ CAM_C::CAM_C(std::shared_ptr<Module> cam) : Module::Interface(std::move(cam), "c
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::CAM
|
} // namespace Service::CAM
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Service::CAM::CAM_C)
|
||||||
|
|
|
@ -11,6 +11,12 @@ namespace Service::CAM {
|
||||||
class CAM_C final : public Module::Interface {
|
class CAM_C final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
explicit CAM_C(std::shared_ptr<Module> cam);
|
explicit CAM_C(std::shared_ptr<Module> cam);
|
||||||
|
|
||||||
|
private:
|
||||||
|
SERVICE_SERIALIZATION(CAM_C, cam, Module)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::CAM
|
} // namespace Service::CAM
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Service::CAM::CAM_C)
|
||||||
|
BOOST_SERIALIZATION_CONSTRUCT(Service::CAM::CAM_C)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "core/hle/service/cam/cam_q.h"
|
#include "core/hle/service/cam/cam_q.h"
|
||||||
|
#include "common/archives.h"
|
||||||
|
|
||||||
namespace Service::CAM {
|
namespace Service::CAM {
|
||||||
|
|
||||||
|
@ -13,3 +14,5 @@ CAM_Q::CAM_Q() : ServiceFramework("cam:q", 1 /*TODO: find the true value*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::CAM
|
} // namespace Service::CAM
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Service::CAM::CAM_Q)
|
||||||
|
|
|
@ -11,6 +11,15 @@ namespace Service::CAM {
|
||||||
class CAM_Q : public ServiceFramework<CAM_Q> {
|
class CAM_Q : public ServiceFramework<CAM_Q> {
|
||||||
public:
|
public:
|
||||||
CAM_Q();
|
CAM_Q();
|
||||||
|
private:
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
|
||||||
|
}
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::CAM
|
} // namespace Service::CAM
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Service::CAM::CAM_Q)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "core/hle/service/cam/cam.h"
|
#include "core/hle/service/cam/cam.h"
|
||||||
#include "core/hle/service/cam/cam_s.h"
|
#include "core/hle/service/cam/cam_s.h"
|
||||||
|
#include "common/archives.h"
|
||||||
|
|
||||||
namespace Service::CAM {
|
namespace Service::CAM {
|
||||||
|
|
||||||
|
@ -79,3 +80,5 @@ CAM_S::CAM_S(std::shared_ptr<Module> cam) : Module::Interface(std::move(cam), "c
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::CAM
|
} // namespace Service::CAM
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Service::CAM::CAM_S)
|
||||||
|
|
|
@ -11,6 +11,12 @@ namespace Service::CAM {
|
||||||
class CAM_S final : public Module::Interface {
|
class CAM_S final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
explicit CAM_S(std::shared_ptr<Module> cam);
|
explicit CAM_S(std::shared_ptr<Module> cam);
|
||||||
|
|
||||||
|
private:
|
||||||
|
SERVICE_SERIALIZATION(CAM_S, cam, Module)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::CAM
|
} // namespace Service::CAM
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Service::CAM::CAM_S)
|
||||||
|
BOOST_SERIALIZATION_CONSTRUCT(Service::CAM::CAM_S)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "core/hle/service/cam/cam.h"
|
#include "core/hle/service/cam/cam.h"
|
||||||
#include "core/hle/service/cam/cam_u.h"
|
#include "core/hle/service/cam/cam_u.h"
|
||||||
|
#include "common/archives.h"
|
||||||
|
|
||||||
namespace Service::CAM {
|
namespace Service::CAM {
|
||||||
|
|
||||||
|
@ -79,3 +80,5 @@ CAM_U::CAM_U(std::shared_ptr<Module> cam) : Module::Interface(std::move(cam), "c
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::CAM
|
} // namespace Service::CAM
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Service::CAM::CAM_U)
|
||||||
|
|
|
@ -11,6 +11,12 @@ namespace Service::CAM {
|
||||||
class CAM_U final : public Module::Interface {
|
class CAM_U final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
explicit CAM_U(std::shared_ptr<Module> cam);
|
explicit CAM_U(std::shared_ptr<Module> cam);
|
||||||
|
|
||||||
|
private:
|
||||||
|
SERVICE_SERIALIZATION(CAM_U, cam, Module)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::CAM
|
} // namespace Service::CAM
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Service::CAM::CAM_U)
|
||||||
|
BOOST_SERIALIZATION_CONSTRUCT(Service::CAM::CAM_U)
|
||||||
|
|
Loading…
Reference in a new issue