summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Liam2024-02-13 23:08:27 -0500
committerGravatar Liam2024-02-14 12:03:31 -0500
commitdb871677b04aa92dac9e6a15c08eae38e1dd48df (patch)
tree9b4d93bb1ea7d6374a39a35a83e5ea97736584ed /src
parentMerge pull request #12996 from german77/settings-ipc (diff)
downloadyuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.tar.gz
yuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.tar.xz
yuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.zip
vi: extract types
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt1
-rw-r--r--src/core/hle/service/am/service/common_state_getter.cpp1
-rw-r--r--src/core/hle/service/vi/vi.cpp44
-rw-r--r--src/core/hle/service/vi/vi.h21
-rw-r--r--src/core/hle/service/vi/vi_m.cpp5
-rw-r--r--src/core/hle/service/vi/vi_s.cpp5
-rw-r--r--src/core/hle/service/vi/vi_types.h66
-rw-r--r--src/core/hle/service/vi/vi_u.cpp5
8 files changed, 79 insertions, 69 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index bc7f95fea..188ca2097 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -965,6 +965,7 @@ add_library(core STATIC
965 hle/service/vi/vi_m.h 965 hle/service/vi/vi_m.h
966 hle/service/vi/vi_s.cpp 966 hle/service/vi/vi_s.cpp
967 hle/service/vi/vi_s.h 967 hle/service/vi/vi_s.h
968 hle/service/vi/vi_types.h
968 hle/service/vi/vi_u.cpp 969 hle/service/vi/vi_u.cpp
969 hle/service/vi/vi_u.h 970 hle/service/vi/vi_u.h
970 internal_network/network.cpp 971 internal_network/network.cpp
diff --git a/src/core/hle/service/am/service/common_state_getter.cpp b/src/core/hle/service/am/service/common_state_getter.cpp
index 12d7e8cb1..548498e83 100644
--- a/src/core/hle/service/am/service/common_state_getter.cpp
+++ b/src/core/hle/service/am/service/common_state_getter.cpp
@@ -11,6 +11,7 @@
11#include "core/hle/service/pm/pm.h" 11#include "core/hle/service/pm/pm.h"
12#include "core/hle/service/sm/sm.h" 12#include "core/hle/service/sm/sm.h"
13#include "core/hle/service/vi/vi.h" 13#include "core/hle/service/vi/vi.h"
14#include "core/hle/service/vi/vi_types.h"
14 15
15namespace Service::AM { 16namespace Service::AM {
16 17
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index d508ed28c..fc0880c17 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -1,28 +1,20 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2018 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 <algorithm>
5#include <array> 4#include <array>
6#include <cstring>
7#include <memory> 5#include <memory>
8#include <optional> 6#include <optional>
9#include <type_traits> 7#include <type_traits>
10#include <utility> 8#include <utility>
11 9
12#include "common/alignment.h"
13#include "common/assert.h" 10#include "common/assert.h"
14#include "common/common_funcs.h"
15#include "common/logging/log.h" 11#include "common/logging/log.h"
16#include "common/math_util.h" 12#include "common/math_util.h"
17#include "common/settings.h" 13#include "common/settings.h"
18#include "common/string_util.h" 14#include "common/string_util.h"
19#include "common/swap.h"
20#include "core/core_timing.h"
21#include "core/hle/kernel/k_readable_event.h" 15#include "core/hle/kernel/k_readable_event.h"
22#include "core/hle/kernel/k_thread.h" 16#include "core/hle/kernel/k_thread.h"
23#include "core/hle/service/ipc_helpers.h" 17#include "core/hle/service/ipc_helpers.h"
24#include "core/hle/service/nvdrv/devices/nvmap.h"
25#include "core/hle/service/nvdrv/nvdata.h"
26#include "core/hle/service/nvdrv/nvdrv.h" 18#include "core/hle/service/nvdrv/nvdrv.h"
27#include "core/hle/service/nvnflinger/binder.h" 19#include "core/hle/service/nvnflinger/binder.h"
28#include "core/hle/service/nvnflinger/buffer_queue_producer.h" 20#include "core/hle/service/nvnflinger/buffer_queue_producer.h"
@@ -36,45 +28,11 @@
36#include "core/hle/service/vi/vi_m.h" 28#include "core/hle/service/vi/vi_m.h"
37#include "core/hle/service/vi/vi_results.h" 29#include "core/hle/service/vi/vi_results.h"
38#include "core/hle/service/vi/vi_s.h" 30#include "core/hle/service/vi/vi_s.h"
31#include "core/hle/service/vi/vi_types.h"
39#include "core/hle/service/vi/vi_u.h" 32#include "core/hle/service/vi/vi_u.h"
40 33
41namespace Service::VI { 34namespace Service::VI {
42 35
43struct DisplayInfo {
44 /// The name of this particular display.
45 char display_name[0x40]{"Default"};
46
47 /// Whether or not the display has a limited number of layers.
48 u8 has_limited_layers{1};
49 INSERT_PADDING_BYTES(7);
50
51 /// Indicates the total amount of layers supported by the display.
52 /// @note This is only valid if has_limited_layers is set.
53 u64 max_layers{1};
54
55 /// Maximum width in pixels.
56 u64 width{1920};
57
58 /// Maximum height in pixels.
59 u64 height{1080};
60};
61static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size");
62
63class NativeWindow final {
64public:
65 constexpr explicit NativeWindow(u32 id_) : id{id_} {}
66 constexpr explicit NativeWindow(const NativeWindow& other) = default;
67
68private:
69 const u32 magic = 2;
70 const u32 process_id = 1;
71 const u64 id;
72 INSERT_PADDING_WORDS(2);
73 std::array<u8, 8> dispdrv = {'d', 'i', 's', 'p', 'd', 'r', 'v', '\0'};
74 INSERT_PADDING_WORDS(2);
75};
76static_assert(sizeof(NativeWindow) == 0x28, "NativeWindow has wrong size");
77
78class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> { 36class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
79public: 37public:
80 explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server_) 38 explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server_)
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index ee4bcbcfa..e7a38fdbd 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -20,26 +20,7 @@ class Nvnflinger;
20 20
21namespace Service::VI { 21namespace Service::VI {
22 22
23enum class DisplayResolution : u32 { 23enum class Permission;
24 DockedWidth = 1920,
25 DockedHeight = 1080,
26 UndockedWidth = 1280,
27 UndockedHeight = 720,
28};
29
30/// Permission level for a particular VI service instance
31enum class Permission {
32 User,
33 System,
34 Manager,
35};
36
37/// A policy type that may be requested via GetDisplayService and
38/// GetDisplayServiceWithProxyNameExchange
39enum class Policy {
40 User,
41 Compositor,
42};
43 24
44namespace detail { 25namespace detail {
45void GetDisplayServiceImpl(HLERequestContext& ctx, Core::System& system, 26void GetDisplayServiceImpl(HLERequestContext& ctx, Core::System& system,
diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp
index 0f06dc2f3..b1b98cf11 100644
--- a/src/core/hle/service/vi/vi_m.cpp
+++ b/src/core/hle/service/vi/vi_m.cpp
@@ -4,13 +4,14 @@
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/service/vi/vi.h" 5#include "core/hle/service/vi/vi.h"
6#include "core/hle/service/vi/vi_m.h" 6#include "core/hle/service/vi/vi_m.h"
7#include "core/hle/service/vi/vi_types.h"
7 8
8namespace Service::VI { 9namespace Service::VI {
9 10
10VI_M::VI_M(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_, 11VI_M::VI_M(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
11 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_) 12 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
12 : ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{ 13 : ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_},
13 hos_binder_driver_server_} { 14 hos_binder_driver_server{hos_binder_driver_server_} {
14 static const FunctionInfo functions[] = { 15 static const FunctionInfo functions[] = {
15 {2, &VI_M::GetDisplayService, "GetDisplayService"}, 16 {2, &VI_M::GetDisplayService, "GetDisplayService"},
16 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 17 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
diff --git a/src/core/hle/service/vi/vi_s.cpp b/src/core/hle/service/vi/vi_s.cpp
index 77f7a88ff..2400694b0 100644
--- a/src/core/hle/service/vi/vi_s.cpp
+++ b/src/core/hle/service/vi/vi_s.cpp
@@ -4,13 +4,14 @@
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/service/vi/vi.h" 5#include "core/hle/service/vi/vi.h"
6#include "core/hle/service/vi/vi_s.h" 6#include "core/hle/service/vi/vi_s.h"
7#include "core/hle/service/vi/vi_types.h"
7 8
8namespace Service::VI { 9namespace Service::VI {
9 10
10VI_S::VI_S(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_, 11VI_S::VI_S(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
11 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_) 12 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
12 : ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{ 13 : ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_},
13 hos_binder_driver_server_} { 14 hos_binder_driver_server{hos_binder_driver_server_} {
14 static const FunctionInfo functions[] = { 15 static const FunctionInfo functions[] = {
15 {1, &VI_S::GetDisplayService, "GetDisplayService"}, 16 {1, &VI_S::GetDisplayService, "GetDisplayService"},
16 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 17 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
diff --git a/src/core/hle/service/vi/vi_types.h b/src/core/hle/service/vi/vi_types.h
new file mode 100644
index 000000000..59976fc72
--- /dev/null
+++ b/src/core/hle/service/vi/vi_types.h
@@ -0,0 +1,66 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include "common/common_funcs.h"
7
8namespace Service::VI {
9
10enum class DisplayResolution : u32 {
11 DockedWidth = 1920,
12 DockedHeight = 1080,
13 UndockedWidth = 1280,
14 UndockedHeight = 720,
15};
16
17/// Permission level for a particular VI service instance
18enum class Permission {
19 User,
20 System,
21 Manager,
22};
23
24/// A policy type that may be requested via GetDisplayService and
25/// GetDisplayServiceWithProxyNameExchange
26enum class Policy {
27 User,
28 Compositor,
29};
30
31struct DisplayInfo {
32 /// The name of this particular display.
33 char display_name[0x40]{"Default"};
34
35 /// Whether or not the display has a limited number of layers.
36 u8 has_limited_layers{1};
37 INSERT_PADDING_BYTES(7);
38
39 /// Indicates the total amount of layers supported by the display.
40 /// @note This is only valid if has_limited_layers is set.
41 u64 max_layers{1};
42
43 /// Maximum width in pixels.
44 u64 width{1920};
45
46 /// Maximum height in pixels.
47 u64 height{1080};
48};
49static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size");
50
51class NativeWindow final {
52public:
53 constexpr explicit NativeWindow(u32 id_) : id{id_} {}
54 constexpr explicit NativeWindow(const NativeWindow& other) = default;
55
56private:
57 const u32 magic = 2;
58 const u32 process_id = 1;
59 const u64 id;
60 INSERT_PADDING_WORDS(2);
61 std::array<u8, 8> dispdrv = {'d', 'i', 's', 'p', 'd', 'r', 'v', '\0'};
62 INSERT_PADDING_WORDS(2);
63};
64static_assert(sizeof(NativeWindow) == 0x28, "NativeWindow has wrong size");
65
66} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_u.cpp b/src/core/hle/service/vi/vi_u.cpp
index 59e13c86b..9845e2c57 100644
--- a/src/core/hle/service/vi/vi_u.cpp
+++ b/src/core/hle/service/vi/vi_u.cpp
@@ -3,14 +3,15 @@
3 3
4#include "common/logging/log.h" 4#include "common/logging/log.h"
5#include "core/hle/service/vi/vi.h" 5#include "core/hle/service/vi/vi.h"
6#include "core/hle/service/vi/vi_types.h"
6#include "core/hle/service/vi/vi_u.h" 7#include "core/hle/service/vi/vi_u.h"
7 8
8namespace Service::VI { 9namespace Service::VI {
9 10
10VI_U::VI_U(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_, 11VI_U::VI_U(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
11 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_) 12 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
12 : ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{ 13 : ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_},
13 hos_binder_driver_server_} { 14 hos_binder_driver_server{hos_binder_driver_server_} {
14 static const FunctionInfo functions[] = { 15 static const FunctionInfo functions[] = {
15 {0, &VI_U::GetDisplayService, "GetDisplayService"}, 16 {0, &VI_U::GetDisplayService, "GetDisplayService"},
16 {1, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 17 {1, nullptr, "GetDisplayServiceWithProxyNameExchange"},