vi: extract types
This commit is contained in:
parent
a40adbc142
commit
db871677b0
8 changed files with 79 additions and 69 deletions
|
@ -965,6 +965,7 @@ add_library(core STATIC
|
||||||
hle/service/vi/vi_m.h
|
hle/service/vi/vi_m.h
|
||||||
hle/service/vi/vi_s.cpp
|
hle/service/vi/vi_s.cpp
|
||||||
hle/service/vi/vi_s.h
|
hle/service/vi/vi_s.h
|
||||||
|
hle/service/vi/vi_types.h
|
||||||
hle/service/vi/vi_u.cpp
|
hle/service/vi/vi_u.cpp
|
||||||
hle/service/vi/vi_u.h
|
hle/service/vi/vi_u.h
|
||||||
internal_network/network.cpp
|
internal_network/network.cpp
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "core/hle/service/pm/pm.h"
|
#include "core/hle/service/pm/pm.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
#include "core/hle/service/vi/vi.h"
|
#include "core/hle/service/vi/vi.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,20 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstring>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "common/alignment.h"
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common_funcs.h"
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/math_util.h"
|
#include "common/math_util.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "common/string_util.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_readable_event.h"
|
||||||
#include "core/hle/kernel/k_thread.h"
|
#include "core/hle/kernel/k_thread.h"
|
||||||
#include "core/hle/service/ipc_helpers.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/nvdrv/nvdrv.h"
|
||||||
#include "core/hle/service/nvnflinger/binder.h"
|
#include "core/hle/service/nvnflinger/binder.h"
|
||||||
#include "core/hle/service/nvnflinger/buffer_queue_producer.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_m.h"
|
||||||
#include "core/hle/service/vi/vi_results.h"
|
#include "core/hle/service/vi/vi_results.h"
|
||||||
#include "core/hle/service/vi/vi_s.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"
|
#include "core/hle/service/vi/vi_u.h"
|
||||||
|
|
||||||
namespace Service::VI {
|
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> {
|
class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
|
||||||
public:
|
public:
|
||||||
explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server_)
|
explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server_)
|
||||||
|
|
|
@ -20,26 +20,7 @@ class Nvnflinger;
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
enum class DisplayResolution : u32 {
|
enum class Permission;
|
||||||
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,
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
void GetDisplayServiceImpl(HLERequestContext& ctx, Core::System& system,
|
void GetDisplayServiceImpl(HLERequestContext& ctx, Core::System& system,
|
||||||
|
|
|
@ -4,13 +4,14 @@
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/hle/service/vi/vi.h"
|
#include "core/hle/service/vi/vi.h"
|
||||||
#include "core/hle/service/vi/vi_m.h"
|
#include "core/hle/service/vi/vi_m.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
VI_M::VI_M(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
|
VI_M::VI_M(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
|
||||||
: ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{
|
: ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_},
|
||||||
hos_binder_driver_server_} {
|
hos_binder_driver_server{hos_binder_driver_server_} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{2, &VI_M::GetDisplayService, "GetDisplayService"},
|
{2, &VI_M::GetDisplayService, "GetDisplayService"},
|
||||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
|
|
|
@ -4,13 +4,14 @@
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/hle/service/vi/vi.h"
|
#include "core/hle/service/vi/vi.h"
|
||||||
#include "core/hle/service/vi/vi_s.h"
|
#include "core/hle/service/vi/vi_s.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
VI_S::VI_S(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
|
VI_S::VI_S(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
|
||||||
: ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{
|
: ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_},
|
||||||
hos_binder_driver_server_} {
|
hos_binder_driver_server{hos_binder_driver_server_} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{1, &VI_S::GetDisplayService, "GetDisplayService"},
|
{1, &VI_S::GetDisplayService, "GetDisplayService"},
|
||||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
|
|
66
src/core/hle/service/vi/vi_types.h
Normal file
66
src/core/hle/service/vi/vi_types.h
Normal file
|
@ -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
|
|
@ -3,14 +3,15 @@
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/hle/service/vi/vi.h"
|
#include "core/hle/service/vi/vi.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
#include "core/hle/service/vi/vi_u.h"
|
#include "core/hle/service/vi/vi_u.h"
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
VI_U::VI_U(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
|
VI_U::VI_U(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
|
||||||
: ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_}, hos_binder_driver_server{
|
: ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_},
|
||||||
hos_binder_driver_server_} {
|
hos_binder_driver_server{hos_binder_driver_server_} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &VI_U::GetDisplayService, "GetDisplayService"},
|
{0, &VI_U::GetDisplayService, "GetDisplayService"},
|
||||||
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
|
|
Loading…
Reference in a new issue