diff options
| author | 2024-02-17 16:08:22 -0600 | |
|---|---|---|
| committer | 2024-02-17 18:08:41 -0500 | |
| commit | a07f0883b91daaee37fd995b2c78d5714c95b05f (patch) | |
| tree | 705b323dc43b6d27065a997540ce9689bb7568e0 | |
| parent | vi: manage resources independently of nvnflinger and refactor (diff) | |
| download | yuzu-a07f0883b91daaee37fd995b2c78d5714c95b05f.tar.gz yuzu-a07f0883b91daaee37fd995b2c78d5714c95b05f.tar.xz yuzu-a07f0883b91daaee37fd995b2c78d5714c95b05f.zip | |
service: vi: Implement ListDisplayMode
| -rw-r--r-- | src/core/hle/service/vi/system_display_service.cpp | 39 | ||||
| -rw-r--r-- | src/core/hle/service/vi/system_display_service.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi_types.h | 8 |
3 files changed, 41 insertions, 12 deletions
diff --git a/src/core/hle/service/vi/system_display_service.cpp b/src/core/hle/service/vi/system_display_service.cpp index 9e28fdda3..c3c50b07b 100644 --- a/src/core/hle/service/vi/system_display_service.cpp +++ b/src/core/hle/service/vi/system_display_service.cpp | |||
| @@ -29,7 +29,7 @@ ISystemDisplayService::ISystemDisplayService(Core::System& system_, | |||
| 29 | {2400, nullptr, "OpenIndirectLayer"}, | 29 | {2400, nullptr, "OpenIndirectLayer"}, |
| 30 | {2401, nullptr, "CloseIndirectLayer"}, | 30 | {2401, nullptr, "CloseIndirectLayer"}, |
| 31 | {2402, nullptr, "FlipIndirectLayer"}, | 31 | {2402, nullptr, "FlipIndirectLayer"}, |
| 32 | {3000, nullptr, "ListDisplayModes"}, | 32 | {3000, C<&ISystemDisplayService::ListDisplayModes>, "ListDisplayModes"}, |
| 33 | {3001, nullptr, "ListDisplayRgbRanges"}, | 33 | {3001, nullptr, "ListDisplayRgbRanges"}, |
| 34 | {3002, nullptr, "ListDisplayContentTypes"}, | 34 | {3002, nullptr, "ListDisplayContentTypes"}, |
| 35 | {3200, C<&ISystemDisplayService::GetDisplayMode>, "GetDisplayMode"}, | 35 | {3200, C<&ISystemDisplayService::GetDisplayMode>, "GetDisplayMode"}, |
| @@ -80,20 +80,39 @@ Result ISystemDisplayService::SetLayerVisibility(bool visible, u64 layer_id) { | |||
| 80 | R_SUCCEED(); | 80 | R_SUCCEED(); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | Result ISystemDisplayService::GetDisplayMode(Out<u32> out_width, Out<u32> out_height, | 83 | Result ISystemDisplayService::ListDisplayModes( |
| 84 | Out<f32> out_refresh_rate, Out<u32> out_unknown) { | 84 | Out<u64> out_count, u64 display_id, |
| 85 | LOG_WARNING(Service_VI, "(STUBBED) called"); | 85 | OutArray<DisplayMode, BufferAttr_HipcMapAlias> out_display_modes) { |
| 86 | LOG_WARNING(Service_VI, "(STUBBED) called, display_id={}", display_id); | ||
| 87 | |||
| 88 | if (!out_display_modes.empty()) { | ||
| 89 | out_display_modes[0] = { | ||
| 90 | .width = 1920, | ||
| 91 | .height = 1080, | ||
| 92 | .refresh_rate = 60.f, | ||
| 93 | .unknown = {}, | ||
| 94 | }; | ||
| 95 | *out_count = 1; | ||
| 96 | } else { | ||
| 97 | *out_count = 0; | ||
| 98 | } | ||
| 99 | |||
| 100 | R_SUCCEED(); | ||
| 101 | } | ||
| 102 | |||
| 103 | Result ISystemDisplayService::GetDisplayMode(Out<DisplayMode> out_display_mode, u64 display_id) { | ||
| 104 | LOG_WARNING(Service_VI, "(STUBBED) called, display_id={}", display_id); | ||
| 86 | 105 | ||
| 87 | if (Settings::IsDockedMode()) { | 106 | if (Settings::IsDockedMode()) { |
| 88 | *out_width = static_cast<u32>(DisplayResolution::DockedWidth); | 107 | out_display_mode->width = static_cast<u32>(DisplayResolution::DockedWidth); |
| 89 | *out_height = static_cast<u32>(DisplayResolution::DockedHeight); | 108 | out_display_mode->height = static_cast<u32>(DisplayResolution::DockedHeight); |
| 90 | } else { | 109 | } else { |
| 91 | *out_width = static_cast<u32>(DisplayResolution::UndockedWidth); | 110 | out_display_mode->width = static_cast<u32>(DisplayResolution::UndockedWidth); |
| 92 | *out_height = static_cast<u32>(DisplayResolution::UndockedHeight); | 111 | out_display_mode->height = static_cast<u32>(DisplayResolution::UndockedHeight); |
| 93 | } | 112 | } |
| 94 | 113 | ||
| 95 | *out_refresh_rate = 60.f; // This wouldn't seem to be correct for 30 fps games. | 114 | out_display_mode->refresh_rate = 60.f; // This wouldn't seem to be correct for 30 fps games. |
| 96 | *out_unknown = 0; | 115 | out_display_mode->unknown = 0; |
| 97 | 116 | ||
| 98 | R_SUCCEED(); | 117 | R_SUCCEED(); |
| 99 | } | 118 | } |
diff --git a/src/core/hle/service/vi/system_display_service.h b/src/core/hle/service/vi/system_display_service.h index 63c1a4dc5..7228d826e 100644 --- a/src/core/hle/service/vi/system_display_service.h +++ b/src/core/hle/service/vi/system_display_service.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "core/hle/service/vi/shared_buffer_manager.h" | 8 | #include "core/hle/service/vi/shared_buffer_manager.h" |
| 9 | 9 | ||
| 10 | namespace Service::VI { | 10 | namespace Service::VI { |
| 11 | struct DisplayMode; | ||
| 11 | 12 | ||
| 12 | class Container; | 13 | class Container; |
| 13 | 14 | ||
| @@ -19,8 +20,9 @@ public: | |||
| 19 | private: | 20 | private: |
| 20 | Result SetLayerZ(u32 z_value, u64 layer_id); | 21 | Result SetLayerZ(u32 z_value, u64 layer_id); |
| 21 | Result SetLayerVisibility(bool visible, u64 layer_id); | 22 | Result SetLayerVisibility(bool visible, u64 layer_id); |
| 22 | Result GetDisplayMode(Out<u32> out_width, Out<u32> out_height, Out<f32> out_refresh_rate, | 23 | Result ListDisplayModes(Out<u64> out_count, u64 display_id, |
| 23 | Out<u32> out_unknown); | 24 | OutArray<DisplayMode, BufferAttr_HipcMapAlias> out_display_modes); |
| 25 | Result GetDisplayMode(Out<DisplayMode> out_display_mode, u64 display_id); | ||
| 24 | 26 | ||
| 25 | Result GetSharedBufferMemoryHandleId( | 27 | Result GetSharedBufferMemoryHandleId( |
| 26 | Out<s32> out_nvmap_handle, Out<u64> out_size, | 28 | Out<s32> out_nvmap_handle, Out<u64> out_size, |
diff --git a/src/core/hle/service/vi/vi_types.h b/src/core/hle/service/vi/vi_types.h index 7f2c70aef..95ff66358 100644 --- a/src/core/hle/service/vi/vi_types.h +++ b/src/core/hle/service/vi/vi_types.h | |||
| @@ -66,6 +66,14 @@ struct DisplayInfo { | |||
| 66 | }; | 66 | }; |
| 67 | static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size"); | 67 | static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size"); |
| 68 | 68 | ||
| 69 | struct DisplayMode { | ||
| 70 | u32 width; | ||
| 71 | u32 height; | ||
| 72 | f32 refresh_rate; | ||
| 73 | u32 unknown; | ||
| 74 | }; | ||
| 75 | static_assert(sizeof(DisplayMode) == 0x10, "DisplayMode has wrong size"); | ||
| 76 | |||
| 69 | class NativeWindow final { | 77 | class NativeWindow final { |
| 70 | public: | 78 | public: |
| 71 | constexpr explicit NativeWindow(s32 id_) : id{static_cast<u64>(id_)} {} | 79 | constexpr explicit NativeWindow(s32 id_) : id{static_cast<u64>(id_)} {} |