diff options
author | Liam <byteslice@airmail.cc> | 2024-02-14 05:08:27 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-14 18:03:31 +0100 |
commit | db871677b04aa92dac9e6a15c08eae38e1dd48df (patch) | |
tree | 9b4d93bb1ea7d6374a39a35a83e5ea97736584ed /src/core/hle/service/vi | |
parent | Merge pull request #12996 from german77/settings-ipc (diff) | |
download | yuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.tar yuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.tar.gz yuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.tar.bz2 yuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.tar.lz yuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.tar.xz yuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.tar.zst yuzu-db871677b04aa92dac9e6a15c08eae38e1dd48df.zip |
Diffstat (limited to 'src/core/hle/service/vi')
-rw-r--r-- | src/core/hle/service/vi/vi.cpp | 44 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi.h | 21 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi_m.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi_s.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi_types.h | 66 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi_u.cpp | 5 |
6 files changed, 77 insertions, 69 deletions
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 @@ // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include <algorithm> #include <array> -#include <cstring> #include <memory> #include <optional> #include <type_traits> #include <utility> -#include "common/alignment.h" #include "common/assert.h" -#include "common/common_funcs.h" #include "common/logging/log.h" #include "common/math_util.h" #include "common/settings.h" #include "common/string_util.h" -#include "common/swap.h" -#include "core/core_timing.h" #include "core/hle/kernel/k_readable_event.h" #include "core/hle/kernel/k_thread.h" #include "core/hle/service/ipc_helpers.h" -#include "core/hle/service/nvdrv/devices/nvmap.h" -#include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/nvdrv/nvdrv.h" #include "core/hle/service/nvnflinger/binder.h" #include "core/hle/service/nvnflinger/buffer_queue_producer.h" @@ -36,45 +28,11 @@ #include "core/hle/service/vi/vi_m.h" #include "core/hle/service/vi/vi_results.h" #include "core/hle/service/vi/vi_s.h" +#include "core/hle/service/vi/vi_types.h" #include "core/hle/service/vi/vi_u.h" namespace Service::VI { -struct DisplayInfo { - /// The name of this particular display. - char display_name[0x40]{"Default"}; - - /// Whether or not the display has a limited number of layers. - u8 has_limited_layers{1}; - INSERT_PADDING_BYTES(7); - - /// Indicates the total amount of layers supported by the display. - /// @note This is only valid if has_limited_layers is set. - u64 max_layers{1}; - - /// Maximum width in pixels. - u64 width{1920}; - - /// Maximum height in pixels. - u64 height{1080}; -}; -static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size"); - -class NativeWindow final { -public: - constexpr explicit NativeWindow(u32 id_) : id{id_} {} - constexpr explicit NativeWindow(const NativeWindow& other) = default; - -private: - const u32 magic = 2; - const u32 process_id = 1; - const u64 id; - INSERT_PADDING_WORDS(2); - std::array<u8, 8> dispdrv = {'d', 'i', 's', 'p', 'd', 'r', 'v', '\0'}; - INSERT_PADDING_WORDS(2); -}; -static_assert(sizeof(NativeWindow) == 0x28, "NativeWindow has wrong size"); - class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> { public: 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; namespace Service::VI { -enum class DisplayResolution : u32 { - DockedWidth = 1920, - DockedHeight = 1080, - UndockedWidth = 1280, - UndockedHeight = 720, -}; - -/// Permission level for a particular VI service instance -enum class Permission { - User, - System, - Manager, -}; - -/// A policy type that may be requested via GetDisplayService and -/// GetDisplayServiceWithProxyNameExchange -enum class Policy { - User, - Compositor, -}; +enum class Permission; namespace detail { void 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 @@ #include "common/logging/log.h" #include "core/hle/service/vi/vi.h" #include "core/hle/service/vi/vi_m.h" +#include "core/hle/service/vi/vi_types.h" namespace Service::VI { VI_M::VI_M(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_, Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_) - : ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{ - hos_binder_driver_server_} { + : ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_}, + hos_binder_driver_server{hos_binder_driver_server_} { static const FunctionInfo functions[] = { {2, &VI_M::GetDisplayService, "GetDisplayService"}, {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 @@ #include "common/logging/log.h" #include "core/hle/service/vi/vi.h" #include "core/hle/service/vi/vi_s.h" +#include "core/hle/service/vi/vi_types.h" namespace Service::VI { VI_S::VI_S(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_, Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_) - : ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{ - hos_binder_driver_server_} { + : ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_}, + hos_binder_driver_server{hos_binder_driver_server_} { static const FunctionInfo functions[] = { {1, &VI_S::GetDisplayService, "GetDisplayService"}, {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 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/common_funcs.h" + +namespace Service::VI { + +enum class DisplayResolution : u32 { + DockedWidth = 1920, + DockedHeight = 1080, + UndockedWidth = 1280, + UndockedHeight = 720, +}; + +/// Permission level for a particular VI service instance +enum class Permission { + User, + System, + Manager, +}; + +/// A policy type that may be requested via GetDisplayService and +/// GetDisplayServiceWithProxyNameExchange +enum class Policy { + User, + Compositor, +}; + +struct DisplayInfo { + /// The name of this particular display. + char display_name[0x40]{"Default"}; + + /// Whether or not the display has a limited number of layers. + u8 has_limited_layers{1}; + INSERT_PADDING_BYTES(7); + + /// Indicates the total amount of layers supported by the display. + /// @note This is only valid if has_limited_layers is set. + u64 max_layers{1}; + + /// Maximum width in pixels. + u64 width{1920}; + + /// Maximum height in pixels. + u64 height{1080}; +}; +static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size"); + +class NativeWindow final { +public: + constexpr explicit NativeWindow(u32 id_) : id{id_} {} + constexpr explicit NativeWindow(const NativeWindow& other) = default; + +private: + const u32 magic = 2; + const u32 process_id = 1; + const u64 id; + INSERT_PADDING_WORDS(2); + std::array<u8, 8> dispdrv = {'d', 'i', 's', 'p', 'd', 'r', 'v', '\0'}; + INSERT_PADDING_WORDS(2); +}; +static_assert(sizeof(NativeWindow) == 0x28, "NativeWindow has wrong size"); + +} // 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 @@ #include "common/logging/log.h" #include "core/hle/service/vi/vi.h" +#include "core/hle/service/vi/vi_types.h" #include "core/hle/service/vi/vi_u.h" namespace Service::VI { VI_U::VI_U(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_, Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_) - : ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{ - hos_binder_driver_server_} { + : ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_}, + hos_binder_driver_server{hos_binder_driver_server_} { static const FunctionInfo functions[] = { {0, &VI_U::GetDisplayService, "GetDisplayService"}, {1, nullptr, "GetDisplayServiceWithProxyNameExchange"}, |