summaryrefslogtreecommitdiff
path: root/src/core/hle/service/vi
diff options
context:
space:
mode:
authorGravatar Liam2024-02-14 00:09:29 -0500
committerGravatar Liam2024-02-14 12:03:32 -0500
commit59011a04a10d20804eb1eb4c8164b64d0f0ca824 (patch)
tree23d4943c7c49b7d16434231d441d2934fe06193f /src/core/hle/service/vi
parentvi: rewrite IApplicationRootService, IManagerRootService, ISystemRootService (diff)
downloadyuzu-59011a04a10d20804eb1eb4c8164b64d0f0ca824.tar.gz
yuzu-59011a04a10d20804eb1eb4c8164b64d0f0ca824.tar.xz
yuzu-59011a04a10d20804eb1eb4c8164b64d0f0ca824.zip
vi: rewrite IHOSBinderDriver
Diffstat (limited to 'src/core/hle/service/vi')
-rw-r--r--src/core/hle/service/vi/hos_binder_driver.cpp67
-rw-r--r--src/core/hle/service/vi/hos_binder_driver.h18
2 files changed, 41 insertions, 44 deletions
diff --git a/src/core/hle/service/vi/hos_binder_driver.cpp b/src/core/hle/service/vi/hos_binder_driver.cpp
index e04acc297..ba0317245 100644
--- a/src/core/hle/service/vi/hos_binder_driver.cpp
+++ b/src/core/hle/service/vi/hos_binder_driver.cpp
@@ -1,64 +1,53 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/ipc_helpers.h" 4#include "core/hle/service/cmif_serialization.h"
5#include "core/hle/service/nvnflinger/binder.h" 5#include "core/hle/service/nvnflinger/binder.h"
6#include "core/hle/service/nvnflinger/hos_binder_driver_server.h" 6#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
7#include "core/hle/service/vi/hos_binder_driver.h" 7#include "core/hle/service/vi/hos_binder_driver.h"
8 8
9namespace Service::VI { 9namespace Service::VI {
10 10
11IHOSBinderDriver::IHOSBinderDriver(Core::System& system_, 11IHOSBinderDriver::IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server)
12 Nvnflinger::HosBinderDriverServer& server_) 12 : ServiceFramework{system_, "IHOSBinderDriver"}, m_server(server) {
13 : ServiceFramework{system_, "IHOSBinderDriver"}, server(server_) {
14 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
15 {0, &IHOSBinderDriver::TransactParcel, "TransactParcel"}, 14 {0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"},
16 {1, &IHOSBinderDriver::AdjustRefcount, "AdjustRefcount"}, 15 {1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"},
17 {2, &IHOSBinderDriver::GetNativeHandle, "GetNativeHandle"}, 16 {2, C<&IHOSBinderDriver::GetNativeHandle>, "GetNativeHandle"},
18 {3, &IHOSBinderDriver::TransactParcel, "TransactParcelAuto"}, 17 {3, C<&IHOSBinderDriver::TransactParcelAuto>, "TransactParcelAuto"},
19 }; 18 };
20 RegisterHandlers(functions); 19 RegisterHandlers(functions);
21} 20}
22 21
23IHOSBinderDriver::~IHOSBinderDriver() = default; 22IHOSBinderDriver::~IHOSBinderDriver() = default;
24 23
25void IHOSBinderDriver::TransactParcel(HLERequestContext& ctx) { 24Result IHOSBinderDriver::TransactParcel(s32 binder_id, android::TransactionId transaction_id,
26 IPC::RequestParser rp{ctx}; 25 InBuffer<BufferAttr_HipcMapAlias> parcel_data,
27 const u32 id = rp.Pop<u32>(); 26 OutBuffer<BufferAttr_HipcMapAlias> parcel_reply,
28 const auto transaction = static_cast<android::TransactionId>(rp.Pop<u32>()); 27 u32 flags) {
29 const u32 flags = rp.Pop<u32>(); 28 LOG_DEBUG(Service_VI, "called. id={} transaction={}, flags={}", binder_id, transaction_id,
30
31 LOG_DEBUG(Service_VI, "called. id=0x{:08X} transaction={:X}, flags=0x{:08X}", id, transaction,
32 flags); 29 flags);
33 30 m_server.TryGetProducer(binder_id)->Transact(transaction_id, flags, parcel_data, parcel_reply);
34 server.TryGetProducer(id)->Transact(ctx, transaction, flags); 31 R_SUCCEED();
35
36 IPC::ResponseBuilder rb{ctx, 2};
37 rb.Push(ResultSuccess);
38} 32}
39 33
40void IHOSBinderDriver::AdjustRefcount(HLERequestContext& ctx) { 34Result IHOSBinderDriver::AdjustRefcount(s32 binder_id, s32 addval, s32 type) {
41 IPC::RequestParser rp{ctx}; 35 LOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={}, type={}", binder_id, addval, type);
42 const u32 id = rp.Pop<u32>(); 36 R_SUCCEED();
43 const s32 addval = rp.PopRaw<s32>();
44 const u32 type = rp.Pop<u32>();
45
46 LOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={:08X}, type={:08X}", id, addval, type);
47
48 IPC::ResponseBuilder rb{ctx, 2};
49 rb.Push(ResultSuccess);
50} 37}
51 38
52void IHOSBinderDriver::GetNativeHandle(HLERequestContext& ctx) { 39Result IHOSBinderDriver::GetNativeHandle(s32 binder_id, u32 type_id,
53 IPC::RequestParser rp{ctx}; 40 OutCopyHandle<Kernel::KReadableEvent> out_handle) {
54 const u32 id = rp.Pop<u32>(); 41 LOG_WARNING(Service_VI, "(STUBBED) called id={}, type_id={}", binder_id, type_id);
55 const u32 unknown = rp.Pop<u32>(); 42 *out_handle = &m_server.TryGetProducer(binder_id)->GetNativeHandle();
56 43 R_SUCCEED();
57 LOG_WARNING(Service_VI, "(STUBBED) called id={}, unknown={:08X}", id, unknown); 44}
58 45
59 IPC::ResponseBuilder rb{ctx, 2, 1}; 46Result IHOSBinderDriver::TransactParcelAuto(s32 binder_id, android::TransactionId transaction_id,
60 rb.Push(ResultSuccess); 47 InBuffer<BufferAttr_HipcAutoSelect> parcel_data,
61 rb.PushCopyObjects(server.TryGetProducer(id)->GetNativeHandle()); 48 OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply,
49 u32 flags) {
50 R_RETURN(this->TransactParcel(binder_id, transaction_id, parcel_data, parcel_reply, flags));
62} 51}
63 52
64} // namespace Service::VI 53} // namespace Service::VI
diff --git a/src/core/hle/service/vi/hos_binder_driver.h b/src/core/hle/service/vi/hos_binder_driver.h
index 24780c7d8..ed6e8cdbe 100644
--- a/src/core/hle/service/vi/hos_binder_driver.h
+++ b/src/core/hle/service/vi/hos_binder_driver.h
@@ -1,22 +1,30 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/cmif_types.h"
5#include "core/hle/service/nvnflinger/binder.h"
4#include "core/hle/service/service.h" 6#include "core/hle/service/service.h"
5 7
6namespace Service::VI { 8namespace Service::VI {
7 9
8class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> { 10class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
9public: 11public:
10 explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server_); 12 explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server);
11 ~IHOSBinderDriver() override; 13 ~IHOSBinderDriver() override;
12 14
13private: 15private:
14 void TransactParcel(HLERequestContext& ctx); 16 Result TransactParcel(s32 binder_id, android::TransactionId transaction_id,
15 void AdjustRefcount(HLERequestContext& ctx); 17 InBuffer<BufferAttr_HipcMapAlias> parcel_data,
16 void GetNativeHandle(HLERequestContext& ctx); 18 OutBuffer<BufferAttr_HipcMapAlias> parcel_reply, u32 flags);
19 Result AdjustRefcount(s32 binder_id, s32 addval, s32 type);
20 Result GetNativeHandle(s32 binder_id, u32 type_id,
21 OutCopyHandle<Kernel::KReadableEvent> out_handle);
22 Result TransactParcelAuto(s32 binder_id, android::TransactionId transaction_id,
23 InBuffer<BufferAttr_HipcAutoSelect> parcel_data,
24 OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply, u32 flags);
17 25
18private: 26private:
19 Nvnflinger::HosBinderDriverServer& server; 27 Nvnflinger::HosBinderDriverServer& m_server;
20}; 28};
21 29
22} // namespace Service::VI 30} // namespace Service::VI