mirror of https://git.suyu.dev/suyu/suyu
Merge branch 'yuzu-emu:master' into import-firmware
commit
e2e0916100
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,319 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
||||||
|
#include "core/hle/service/nvnflinger/parcel.h"
|
||||||
|
#include "core/hle/service/vi/application_display_service.h"
|
||||||
|
#include "core/hle/service/vi/hos_binder_driver.h"
|
||||||
|
#include "core/hle/service/vi/manager_display_service.h"
|
||||||
|
#include "core/hle/service/vi/system_display_service.h"
|
||||||
|
#include "core/hle/service/vi/vi_results.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
IApplicationDisplayService::IApplicationDisplayService(
|
||||||
|
Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
||||||
|
: ServiceFramework{system_, "IApplicationDisplayService"}, m_nvnflinger{nvnflinger},
|
||||||
|
m_hos_binder_driver_server{hos_binder_driver_server} {
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{100, C<&IApplicationDisplayService::GetRelayService>, "GetRelayService"},
|
||||||
|
{101, C<&IApplicationDisplayService::GetSystemDisplayService>, "GetSystemDisplayService"},
|
||||||
|
{102, C<&IApplicationDisplayService::GetManagerDisplayService>, "GetManagerDisplayService"},
|
||||||
|
{103, C<&IApplicationDisplayService::GetIndirectDisplayTransactionService>, "GetIndirectDisplayTransactionService"},
|
||||||
|
{1000, C<&IApplicationDisplayService::ListDisplays>, "ListDisplays"},
|
||||||
|
{1010, C<&IApplicationDisplayService::OpenDisplay>, "OpenDisplay"},
|
||||||
|
{1011, C<&IApplicationDisplayService::OpenDefaultDisplay>, "OpenDefaultDisplay"},
|
||||||
|
{1020, C<&IApplicationDisplayService::CloseDisplay>, "CloseDisplay"},
|
||||||
|
{1101, C<&IApplicationDisplayService::SetDisplayEnabled>, "SetDisplayEnabled"},
|
||||||
|
{1102, C<&IApplicationDisplayService::GetDisplayResolution>, "GetDisplayResolution"},
|
||||||
|
{2020, C<&IApplicationDisplayService::OpenLayer>, "OpenLayer"},
|
||||||
|
{2021, C<&IApplicationDisplayService::CloseLayer>, "CloseLayer"},
|
||||||
|
{2030, C<&IApplicationDisplayService::CreateStrayLayer>, "CreateStrayLayer"},
|
||||||
|
{2031, C<&IApplicationDisplayService::DestroyStrayLayer>, "DestroyStrayLayer"},
|
||||||
|
{2101, C<&IApplicationDisplayService::SetLayerScalingMode>, "SetLayerScalingMode"},
|
||||||
|
{2102, C<&IApplicationDisplayService::ConvertScalingMode>, "ConvertScalingMode"},
|
||||||
|
{2450, C<&IApplicationDisplayService::GetIndirectLayerImageMap>, "GetIndirectLayerImageMap"},
|
||||||
|
{2451, nullptr, "GetIndirectLayerImageCropMap"},
|
||||||
|
{2460, C<&IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo>, "GetIndirectLayerImageRequiredMemoryInfo"},
|
||||||
|
{5202, C<&IApplicationDisplayService::GetDisplayVsyncEvent>, "GetDisplayVsyncEvent"},
|
||||||
|
{5203, nullptr, "GetDisplayVsyncEventForDebug"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
IApplicationDisplayService::~IApplicationDisplayService() {
|
||||||
|
for (const auto layer_id : m_stray_layer_ids) {
|
||||||
|
m_nvnflinger.DestroyLayer(layer_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::GetRelayService(
|
||||||
|
Out<SharedPointer<IHOSBinderDriver>> out_relay_service) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
|
*out_relay_service = std::make_shared<IHOSBinderDriver>(system, m_hos_binder_driver_server);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::GetSystemDisplayService(
|
||||||
|
Out<SharedPointer<ISystemDisplayService>> out_system_display_service) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
|
*out_system_display_service = std::make_shared<ISystemDisplayService>(system, m_nvnflinger);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::GetManagerDisplayService(
|
||||||
|
Out<SharedPointer<IManagerDisplayService>> out_manager_display_service) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
|
*out_manager_display_service = std::make_shared<IManagerDisplayService>(system, m_nvnflinger);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::GetIndirectDisplayTransactionService(
|
||||||
|
Out<SharedPointer<IHOSBinderDriver>> out_indirect_display_transaction_service) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
|
*out_indirect_display_transaction_service =
|
||||||
|
std::make_shared<IHOSBinderDriver>(system, m_hos_binder_driver_server);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::OpenDisplay(Out<u64> out_display_id, DisplayName display_name) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
|
|
||||||
|
display_name[display_name.size() - 1] = '\0';
|
||||||
|
ASSERT_MSG(strcmp(display_name.data(), "Default") == 0,
|
||||||
|
"Non-default displays aren't supported yet");
|
||||||
|
|
||||||
|
const auto display_id = m_nvnflinger.OpenDisplay(display_name.data());
|
||||||
|
if (!display_id) {
|
||||||
|
LOG_ERROR(Service_VI, "Display not found! display_name={}", display_name.data());
|
||||||
|
R_THROW(VI::ResultNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
*out_display_id = *display_id;
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::OpenDefaultDisplay(Out<u64> out_display_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called");
|
||||||
|
R_RETURN(this->OpenDisplay(out_display_id, DisplayName{"Default"}));
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::CloseDisplay(u64 display_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called");
|
||||||
|
R_SUCCEED_IF(m_nvnflinger.CloseDisplay(display_id));
|
||||||
|
R_THROW(ResultUnknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::SetDisplayEnabled(u32 state, u64 display_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called");
|
||||||
|
|
||||||
|
// This literally does nothing internally in the actual service itself,
|
||||||
|
// and just returns a successful result code regardless of the input.
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::GetDisplayResolution(Out<s64> out_width, Out<s64> out_height,
|
||||||
|
u64 display_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called. display_id={}", display_id);
|
||||||
|
|
||||||
|
// This only returns the fixed values of 1280x720 and makes no distinguishing
|
||||||
|
// between docked and undocked dimensions.
|
||||||
|
*out_width = static_cast<s64>(DisplayResolution::UndockedWidth);
|
||||||
|
*out_height = static_cast<s64>(DisplayResolution::UndockedHeight);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::SetLayerScalingMode(NintendoScaleMode scale_mode, u64 layer_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called. scale_mode={}, unknown=0x{:016X}", scale_mode, layer_id);
|
||||||
|
|
||||||
|
if (scale_mode > NintendoScaleMode::PreserveAspectRatio) {
|
||||||
|
LOG_ERROR(Service_VI, "Invalid scaling mode provided.");
|
||||||
|
R_THROW(VI::ResultOperationFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scale_mode != NintendoScaleMode::ScaleToWindow &&
|
||||||
|
scale_mode != NintendoScaleMode::PreserveAspectRatio) {
|
||||||
|
LOG_ERROR(Service_VI, "Unsupported scaling mode supplied.");
|
||||||
|
R_THROW(VI::ResultNotSupported);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::ListDisplays(
|
||||||
|
Out<u64> out_count, OutArray<DisplayInfo, BufferAttr_HipcMapAlias> out_displays) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
|
|
||||||
|
if (out_displays.size() > 0) {
|
||||||
|
out_displays[0] = DisplayInfo{};
|
||||||
|
*out_count = 1;
|
||||||
|
} else {
|
||||||
|
*out_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::OpenLayer(Out<u64> out_size,
|
||||||
|
OutBuffer<BufferAttr_HipcMapAlias> out_native_window,
|
||||||
|
DisplayName display_name, u64 layer_id,
|
||||||
|
ClientAppletResourceUserId aruid) {
|
||||||
|
display_name[display_name.size() - 1] = '\0';
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_VI, "called. layer_id={}, aruid={:#x}", layer_id, aruid.pid);
|
||||||
|
|
||||||
|
const auto display_id = m_nvnflinger.OpenDisplay(display_name.data());
|
||||||
|
if (!display_id) {
|
||||||
|
LOG_ERROR(Service_VI, "Layer not found! layer_id={}", layer_id);
|
||||||
|
R_THROW(VI::ResultNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto buffer_queue_id = m_nvnflinger.FindBufferQueueId(*display_id, layer_id);
|
||||||
|
if (!buffer_queue_id) {
|
||||||
|
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", *display_id);
|
||||||
|
R_THROW(VI::ResultNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_nvnflinger.OpenLayer(layer_id)) {
|
||||||
|
LOG_WARNING(Service_VI, "Tried to open layer which was already open");
|
||||||
|
R_THROW(VI::ResultOperationFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
android::OutputParcel parcel;
|
||||||
|
parcel.WriteInterface(NativeWindow{*buffer_queue_id});
|
||||||
|
|
||||||
|
const auto buffer = parcel.Serialize();
|
||||||
|
std::memcpy(out_native_window.data(), buffer.data(),
|
||||||
|
std::min(out_native_window.size(), buffer.size()));
|
||||||
|
*out_size = buffer.size();
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::CloseLayer(u64 layer_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called. layer_id={}", layer_id);
|
||||||
|
|
||||||
|
if (!m_nvnflinger.CloseLayer(layer_id)) {
|
||||||
|
LOG_WARNING(Service_VI, "Tried to close layer which was not open");
|
||||||
|
R_THROW(VI::ResultOperationFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::CreateStrayLayer(
|
||||||
|
Out<u64> out_layer_id, Out<u64> out_size, OutBuffer<BufferAttr_HipcMapAlias> out_native_window,
|
||||||
|
u32 flags, u64 display_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called. flags={}, display_id={}", flags, display_id);
|
||||||
|
|
||||||
|
const auto layer_id = m_nvnflinger.CreateLayer(display_id);
|
||||||
|
if (!layer_id) {
|
||||||
|
LOG_ERROR(Service_VI, "Layer not found! display_id={}", display_id);
|
||||||
|
R_THROW(VI::ResultNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_stray_layer_ids.push_back(*layer_id);
|
||||||
|
const auto buffer_queue_id = m_nvnflinger.FindBufferQueueId(display_id, *layer_id);
|
||||||
|
if (!buffer_queue_id) {
|
||||||
|
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", display_id);
|
||||||
|
R_THROW(VI::ResultNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
android::OutputParcel parcel;
|
||||||
|
parcel.WriteInterface(NativeWindow{*buffer_queue_id});
|
||||||
|
|
||||||
|
const auto buffer = parcel.Serialize();
|
||||||
|
std::memcpy(out_native_window.data(), buffer.data(),
|
||||||
|
std::min(out_native_window.size(), buffer.size()));
|
||||||
|
|
||||||
|
*out_layer_id = *layer_id;
|
||||||
|
*out_size = buffer.size();
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::DestroyStrayLayer(u64 layer_id) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called. layer_id={}", layer_id);
|
||||||
|
m_nvnflinger.DestroyLayer(layer_id);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::GetDisplayVsyncEvent(
|
||||||
|
OutCopyHandle<Kernel::KReadableEvent> out_vsync_event, u64 display_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called. display_id={}", display_id);
|
||||||
|
|
||||||
|
const auto result = m_nvnflinger.FindVsyncEvent(out_vsync_event, display_id);
|
||||||
|
if (result != ResultSuccess) {
|
||||||
|
if (result == ResultNotFound) {
|
||||||
|
LOG_ERROR(Service_VI, "Vsync event was not found for display_id={}", display_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_THROW(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_UNLESS(!m_vsync_event_fetched, VI::ResultPermissionDenied);
|
||||||
|
m_vsync_event_fetched = true;
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::ConvertScalingMode(Out<ConvertedScaleMode> out_scaling_mode,
|
||||||
|
NintendoScaleMode mode) {
|
||||||
|
LOG_DEBUG(Service_VI, "called mode={}", mode);
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case NintendoScaleMode::None:
|
||||||
|
*out_scaling_mode = ConvertedScaleMode::None;
|
||||||
|
R_SUCCEED();
|
||||||
|
case NintendoScaleMode::Freeze:
|
||||||
|
*out_scaling_mode = ConvertedScaleMode::Freeze;
|
||||||
|
R_SUCCEED();
|
||||||
|
case NintendoScaleMode::ScaleToWindow:
|
||||||
|
*out_scaling_mode = ConvertedScaleMode::ScaleToWindow;
|
||||||
|
R_SUCCEED();
|
||||||
|
case NintendoScaleMode::ScaleAndCrop:
|
||||||
|
*out_scaling_mode = ConvertedScaleMode::ScaleAndCrop;
|
||||||
|
R_SUCCEED();
|
||||||
|
case NintendoScaleMode::PreserveAspectRatio:
|
||||||
|
*out_scaling_mode = ConvertedScaleMode::PreserveAspectRatio;
|
||||||
|
R_SUCCEED();
|
||||||
|
default:
|
||||||
|
LOG_ERROR(Service_VI, "Invalid scaling mode specified, mode={}", mode);
|
||||||
|
R_THROW(VI::ResultOperationFailed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::GetIndirectLayerImageMap(
|
||||||
|
Out<u64> out_size, Out<u64> out_stride,
|
||||||
|
OutBuffer<BufferAttr_HipcMapTransferAllowsNonSecure | BufferAttr_HipcMapAlias> out_buffer,
|
||||||
|
s64 width, s64 height, u64 indirect_layer_consumer_handle, ClientAppletResourceUserId aruid) {
|
||||||
|
LOG_WARNING(
|
||||||
|
Service_VI,
|
||||||
|
"(STUBBED) called, width={}, height={}, indirect_layer_consumer_handle={}, aruid={:#x}",
|
||||||
|
width, height, indirect_layer_consumer_handle, aruid.pid);
|
||||||
|
*out_size = 0;
|
||||||
|
*out_stride = 0;
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo(Out<s64> out_size,
|
||||||
|
Out<s64> out_alignment,
|
||||||
|
s64 width, s64 height) {
|
||||||
|
LOG_DEBUG(Service_VI, "called width={}, height={}", width, height);
|
||||||
|
|
||||||
|
constexpr u64 base_size = 0x20000;
|
||||||
|
const auto texture_size = width * height * 4;
|
||||||
|
|
||||||
|
*out_alignment = 0x1000;
|
||||||
|
*out_size = (texture_size + base_size - 1) / base_size * base_size;
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,65 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
class KReadableEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
class IHOSBinderDriver;
|
||||||
|
class IManagerDisplayService;
|
||||||
|
class ISystemDisplayService;
|
||||||
|
|
||||||
|
class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
|
||||||
|
public:
|
||||||
|
IApplicationDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
||||||
|
~IApplicationDisplayService() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result GetRelayService(Out<SharedPointer<IHOSBinderDriver>> out_relay_service);
|
||||||
|
Result GetSystemDisplayService(
|
||||||
|
Out<SharedPointer<ISystemDisplayService>> out_system_display_service);
|
||||||
|
Result GetManagerDisplayService(
|
||||||
|
Out<SharedPointer<IManagerDisplayService>> out_manager_display_service);
|
||||||
|
Result GetIndirectDisplayTransactionService(
|
||||||
|
Out<SharedPointer<IHOSBinderDriver>> out_indirect_display_transaction_service);
|
||||||
|
Result OpenDisplay(Out<u64> out_display_id, DisplayName display_name);
|
||||||
|
Result OpenDefaultDisplay(Out<u64> out_display_id);
|
||||||
|
Result CloseDisplay(u64 display_id);
|
||||||
|
Result SetDisplayEnabled(u32 state, u64 display_id);
|
||||||
|
Result GetDisplayResolution(Out<s64> out_width, Out<s64> out_height, u64 display_id);
|
||||||
|
Result SetLayerScalingMode(NintendoScaleMode scale_mode, u64 layer_id);
|
||||||
|
Result ListDisplays(Out<u64> out_count,
|
||||||
|
OutArray<DisplayInfo, BufferAttr_HipcMapAlias> out_displays);
|
||||||
|
Result OpenLayer(Out<u64> out_size, OutBuffer<BufferAttr_HipcMapAlias> out_native_window,
|
||||||
|
DisplayName display_name, u64 layer_id, ClientAppletResourceUserId aruid);
|
||||||
|
Result CloseLayer(u64 layer_id);
|
||||||
|
Result CreateStrayLayer(Out<u64> out_layer_id, Out<u64> out_size,
|
||||||
|
OutBuffer<BufferAttr_HipcMapAlias> out_native_window, u32 flags,
|
||||||
|
u64 display_id);
|
||||||
|
Result DestroyStrayLayer(u64 layer_id);
|
||||||
|
Result GetDisplayVsyncEvent(OutCopyHandle<Kernel::KReadableEvent> out_vsync_event,
|
||||||
|
u64 display_id);
|
||||||
|
Result ConvertScalingMode(Out<ConvertedScaleMode> out_scaling_mode, NintendoScaleMode mode);
|
||||||
|
Result GetIndirectLayerImageMap(
|
||||||
|
Out<u64> out_size, Out<u64> out_stride,
|
||||||
|
OutBuffer<BufferAttr_HipcMapTransferAllowsNonSecure | BufferAttr_HipcMapAlias> out_buffer,
|
||||||
|
s64 width, s64 height, u64 indirect_layer_consumer_handle,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result GetIndirectLayerImageRequiredMemoryInfo(Out<s64> out_size, Out<s64> out_alignment,
|
||||||
|
s64 width, s64 height);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Nvnflinger::Nvnflinger& m_nvnflinger;
|
||||||
|
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
||||||
|
std::vector<u64> m_stray_layer_ids;
|
||||||
|
bool m_vsync_event_fetched{false};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,34 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/vi/application_display_service.h"
|
||||||
|
#include "core/hle/service/vi/application_root_service.h"
|
||||||
|
#include "core/hle/service/vi/service_creator.h"
|
||||||
|
#include "core/hle/service/vi/vi.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
IApplicationRootService::IApplicationRootService(
|
||||||
|
Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
||||||
|
: ServiceFramework{system_, "vi:u"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
|
||||||
|
hos_binder_driver_server} {
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"},
|
||||||
|
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
|
};
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
IApplicationRootService::~IApplicationRootService() = default;
|
||||||
|
|
||||||
|
Result IApplicationRootService::GetDisplayService(
|
||||||
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
||||||
|
LOG_DEBUG(Service_VI, "called");
|
||||||
|
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
|
||||||
|
m_hos_binder_driver_server, Permission::User, policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,39 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::Nvnflinger {
|
||||||
|
class HosBinderDriverServer;
|
||||||
|
class Nvnflinger;
|
||||||
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
class IApplicationDisplayService;
|
||||||
|
enum class Policy : u32;
|
||||||
|
|
||||||
|
class IApplicationRootService final : public ServiceFramework<IApplicationRootService> {
|
||||||
|
public:
|
||||||
|
explicit IApplicationRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
||||||
|
~IApplicationRootService() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result GetDisplayService(
|
||||||
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
|
||||||
|
Policy policy);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Nvnflinger::Nvnflinger& m_nvnflinger;
|
||||||
|
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,53 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/nvnflinger/binder.h"
|
||||||
|
#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
|
||||||
|
#include "core/hle/service/vi/hos_binder_driver.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
IHOSBinderDriver::IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server)
|
||||||
|
: ServiceFramework{system_, "IHOSBinderDriver"}, m_server(server) {
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"},
|
||||||
|
{1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"},
|
||||||
|
{2, C<&IHOSBinderDriver::GetNativeHandle>, "GetNativeHandle"},
|
||||||
|
{3, C<&IHOSBinderDriver::TransactParcelAuto>, "TransactParcelAuto"},
|
||||||
|
};
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
IHOSBinderDriver::~IHOSBinderDriver() = default;
|
||||||
|
|
||||||
|
Result IHOSBinderDriver::TransactParcel(s32 binder_id, android::TransactionId transaction_id,
|
||||||
|
InBuffer<BufferAttr_HipcMapAlias> parcel_data,
|
||||||
|
OutBuffer<BufferAttr_HipcMapAlias> parcel_reply,
|
||||||
|
u32 flags) {
|
||||||
|
LOG_DEBUG(Service_VI, "called. id={} transaction={}, flags={}", binder_id, transaction_id,
|
||||||
|
flags);
|
||||||
|
m_server.TryGetProducer(binder_id)->Transact(transaction_id, flags, parcel_data, parcel_reply);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IHOSBinderDriver::AdjustRefcount(s32 binder_id, s32 addval, s32 type) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={}, type={}", binder_id, addval, type);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IHOSBinderDriver::GetNativeHandle(s32 binder_id, u32 type_id,
|
||||||
|
OutCopyHandle<Kernel::KReadableEvent> out_handle) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called id={}, type_id={}", binder_id, type_id);
|
||||||
|
*out_handle = &m_server.TryGetProducer(binder_id)->GetNativeHandle();
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IHOSBinderDriver::TransactParcelAuto(s32 binder_id, android::TransactionId transaction_id,
|
||||||
|
InBuffer<BufferAttr_HipcAutoSelect> parcel_data,
|
||||||
|
OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply,
|
||||||
|
u32 flags) {
|
||||||
|
R_RETURN(this->TransactParcel(binder_id, transaction_id, parcel_data, parcel_reply, flags));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,30 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/nvnflinger/binder.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
|
||||||
|
public:
|
||||||
|
explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server);
|
||||||
|
~IHOSBinderDriver() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result TransactParcel(s32 binder_id, android::TransactionId transaction_id,
|
||||||
|
InBuffer<BufferAttr_HipcMapAlias> parcel_data,
|
||||||
|
OutBuffer<BufferAttr_HipcMapAlias> parcel_reply, u32 flags);
|
||||||
|
Result AdjustRefcount(s32 binder_id, s32 addval, s32 type);
|
||||||
|
Result GetNativeHandle(s32 binder_id, u32 type_id,
|
||||||
|
OutCopyHandle<Kernel::KReadableEvent> out_handle);
|
||||||
|
Result TransactParcelAuto(s32 binder_id, android::TransactionId transaction_id,
|
||||||
|
InBuffer<BufferAttr_HipcAutoSelect> parcel_data,
|
||||||
|
OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply, u32 flags);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Nvnflinger::HosBinderDriverServer& m_server;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,130 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
||||||
|
#include "core/hle/service/vi/manager_display_service.h"
|
||||||
|
#include "core/hle/service/vi/vi_results.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
IManagerDisplayService::IManagerDisplayService(Core::System& system_,
|
||||||
|
Nvnflinger::Nvnflinger& nvnflinger)
|
||||||
|
: ServiceFramework{system_, "IManagerDisplayService"}, m_nvnflinger{nvnflinger} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{200, nullptr, "AllocateProcessHeapBlock"},
|
||||||
|
{201, nullptr, "FreeProcessHeapBlock"},
|
||||||
|
{1102, nullptr, "GetDisplayResolution"},
|
||||||
|
{2010, C<&IManagerDisplayService::CreateManagedLayer>, "CreateManagedLayer"},
|
||||||
|
{2011, nullptr, "DestroyManagedLayer"},
|
||||||
|
{2012, nullptr, "CreateStrayLayer"},
|
||||||
|
{2050, nullptr, "CreateIndirectLayer"},
|
||||||
|
{2051, nullptr, "DestroyIndirectLayer"},
|
||||||
|
{2052, nullptr, "CreateIndirectProducerEndPoint"},
|
||||||
|
{2053, nullptr, "DestroyIndirectProducerEndPoint"},
|
||||||
|
{2054, nullptr, "CreateIndirectConsumerEndPoint"},
|
||||||
|
{2055, nullptr, "DestroyIndirectConsumerEndPoint"},
|
||||||
|
{2060, nullptr, "CreateWatermarkCompositor"},
|
||||||
|
{2062, nullptr, "SetWatermarkText"},
|
||||||
|
{2063, nullptr, "SetWatermarkLayerStacks"},
|
||||||
|
{2300, nullptr, "AcquireLayerTexturePresentingEvent"},
|
||||||
|
{2301, nullptr, "ReleaseLayerTexturePresentingEvent"},
|
||||||
|
{2302, nullptr, "GetDisplayHotplugEvent"},
|
||||||
|
{2303, nullptr, "GetDisplayModeChangedEvent"},
|
||||||
|
{2402, nullptr, "GetDisplayHotplugState"},
|
||||||
|
{2501, nullptr, "GetCompositorErrorInfo"},
|
||||||
|
{2601, nullptr, "GetDisplayErrorEvent"},
|
||||||
|
{2701, nullptr, "GetDisplayFatalErrorEvent"},
|
||||||
|
{4201, nullptr, "SetDisplayAlpha"},
|
||||||
|
{4203, nullptr, "SetDisplayLayerStack"},
|
||||||
|
{4205, nullptr, "SetDisplayPowerState"},
|
||||||
|
{4206, nullptr, "SetDefaultDisplay"},
|
||||||
|
{4207, nullptr, "ResetDisplayPanel"},
|
||||||
|
{4208, nullptr, "SetDisplayFatalErrorEnabled"},
|
||||||
|
{4209, nullptr, "IsDisplayPanelOn"},
|
||||||
|
{4300, nullptr, "GetInternalPanelId"},
|
||||||
|
{6000, C<&IManagerDisplayService::AddToLayerStack>, "AddToLayerStack"},
|
||||||
|
{6001, nullptr, "RemoveFromLayerStack"},
|
||||||
|
{6002, C<&IManagerDisplayService::SetLayerVisibility>, "SetLayerVisibility"},
|
||||||
|
{6003, nullptr, "SetLayerConfig"},
|
||||||
|
{6004, nullptr, "AttachLayerPresentationTracer"},
|
||||||
|
{6005, nullptr, "DetachLayerPresentationTracer"},
|
||||||
|
{6006, nullptr, "StartLayerPresentationRecording"},
|
||||||
|
{6007, nullptr, "StopLayerPresentationRecording"},
|
||||||
|
{6008, nullptr, "StartLayerPresentationFenceWait"},
|
||||||
|
{6009, nullptr, "StopLayerPresentationFenceWait"},
|
||||||
|
{6010, nullptr, "GetLayerPresentationAllFencesExpiredEvent"},
|
||||||
|
{6011, nullptr, "EnableLayerAutoClearTransitionBuffer"},
|
||||||
|
{6012, nullptr, "DisableLayerAutoClearTransitionBuffer"},
|
||||||
|
{6013, nullptr, "SetLayerOpacity"},
|
||||||
|
{6014, nullptr, "AttachLayerWatermarkCompositor"},
|
||||||
|
{6015, nullptr, "DetachLayerWatermarkCompositor"},
|
||||||
|
{7000, nullptr, "SetContentVisibility"},
|
||||||
|
{8000, nullptr, "SetConductorLayer"},
|
||||||
|
{8001, nullptr, "SetTimestampTracking"},
|
||||||
|
{8100, nullptr, "SetIndirectProducerFlipOffset"},
|
||||||
|
{8200, nullptr, "CreateSharedBufferStaticStorage"},
|
||||||
|
{8201, nullptr, "CreateSharedBufferTransferMemory"},
|
||||||
|
{8202, nullptr, "DestroySharedBuffer"},
|
||||||
|
{8203, nullptr, "BindSharedLowLevelLayerToManagedLayer"},
|
||||||
|
{8204, nullptr, "BindSharedLowLevelLayerToIndirectLayer"},
|
||||||
|
{8207, nullptr, "UnbindSharedLowLevelLayer"},
|
||||||
|
{8208, nullptr, "ConnectSharedLowLevelLayerToSharedBuffer"},
|
||||||
|
{8209, nullptr, "DisconnectSharedLowLevelLayerFromSharedBuffer"},
|
||||||
|
{8210, nullptr, "CreateSharedLayer"},
|
||||||
|
{8211, nullptr, "DestroySharedLayer"},
|
||||||
|
{8216, nullptr, "AttachSharedLayerToLowLevelLayer"},
|
||||||
|
{8217, nullptr, "ForceDetachSharedLayerFromLowLevelLayer"},
|
||||||
|
{8218, nullptr, "StartDetachSharedLayerFromLowLevelLayer"},
|
||||||
|
{8219, nullptr, "FinishDetachSharedLayerFromLowLevelLayer"},
|
||||||
|
{8220, nullptr, "GetSharedLayerDetachReadyEvent"},
|
||||||
|
{8221, nullptr, "GetSharedLowLevelLayerSynchronizedEvent"},
|
||||||
|
{8222, nullptr, "CheckSharedLowLevelLayerSynchronized"},
|
||||||
|
{8223, nullptr, "RegisterSharedBufferImporterAruid"},
|
||||||
|
{8224, nullptr, "UnregisterSharedBufferImporterAruid"},
|
||||||
|
{8227, nullptr, "CreateSharedBufferProcessHeap"},
|
||||||
|
{8228, nullptr, "GetSharedLayerLayerStacks"},
|
||||||
|
{8229, nullptr, "SetSharedLayerLayerStacks"},
|
||||||
|
{8291, nullptr, "PresentDetachedSharedFrameBufferToLowLevelLayer"},
|
||||||
|
{8292, nullptr, "FillDetachedSharedFrameBufferColor"},
|
||||||
|
{8293, nullptr, "GetDetachedSharedFrameBufferImage"},
|
||||||
|
{8294, nullptr, "SetDetachedSharedFrameBufferImage"},
|
||||||
|
{8295, nullptr, "CopyDetachedSharedFrameBufferImage"},
|
||||||
|
{8296, nullptr, "SetDetachedSharedFrameBufferSubImage"},
|
||||||
|
{8297, nullptr, "GetSharedFrameBufferContentParameter"},
|
||||||
|
{8298, nullptr, "ExpandStartupLogoOnSharedFrameBuffer"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
IManagerDisplayService::~IManagerDisplayService() = default;
|
||||||
|
|
||||||
|
Result IManagerDisplayService::CreateManagedLayer(Out<u64> out_layer_id, u32 unknown,
|
||||||
|
u64 display_id, AppletResourceUserId aruid) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called. unknown={}, display={}, aruid={}", unknown,
|
||||||
|
display_id, aruid.pid);
|
||||||
|
|
||||||
|
const auto layer_id = m_nvnflinger.CreateLayer(display_id);
|
||||||
|
if (!layer_id) {
|
||||||
|
LOG_ERROR(Service_VI, "Layer not found! display={}", display_id);
|
||||||
|
R_THROW(VI::ResultNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
*out_layer_id = *layer_id;
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IManagerDisplayService::AddToLayerStack(u32 stack_id, u64 layer_id) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called. stack_id={}, layer_id={}", stack_id, layer_id);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IManagerDisplayService::SetLayerVisibility(bool visible, u64 layer_id) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called, layer_id={}, visible={}", layer_id, visible);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,24 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {
|
||||||
|
public:
|
||||||
|
explicit IManagerDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger);
|
||||||
|
~IManagerDisplayService() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result CreateManagedLayer(Out<u64> out_layer_id, u32 unknown, u64 display_id,
|
||||||
|
AppletResourceUserId aruid);
|
||||||
|
Result AddToLayerStack(u32 stack_id, u64 layer_id);
|
||||||
|
Result SetLayerVisibility(bool visible, u64 layer_id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Nvnflinger::Nvnflinger& m_nvnflinger;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,38 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/vi/application_display_service.h"
|
||||||
|
#include "core/hle/service/vi/manager_root_service.h"
|
||||||
|
#include "core/hle/service/vi/service_creator.h"
|
||||||
|
#include "core/hle/service/vi/vi.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
IManagerRootService::IManagerRootService(
|
||||||
|
Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
||||||
|
: ServiceFramework{system_, "vi:m"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
|
||||||
|
hos_binder_driver_server} {
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"},
|
||||||
|
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
|
{100, nullptr, "PrepareFatal"},
|
||||||
|
{101, nullptr, "ShowFatal"},
|
||||||
|
{102, nullptr, "DrawFatalRectangle"},
|
||||||
|
{103, nullptr, "DrawFatalText32"},
|
||||||
|
};
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
IManagerRootService::~IManagerRootService() = default;
|
||||||
|
|
||||||
|
Result IManagerRootService::GetDisplayService(
|
||||||
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
||||||
|
LOG_DEBUG(Service_VI, "called");
|
||||||
|
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
|
||||||
|
m_hos_binder_driver_server, Permission::Manager, policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,38 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::Nvnflinger {
|
||||||
|
class HosBinderDriverServer;
|
||||||
|
class Nvnflinger;
|
||||||
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
class IApplicationDisplayService;
|
||||||
|
enum class Policy : u32;
|
||||||
|
|
||||||
|
class IManagerRootService final : public ServiceFramework<IManagerRootService> {
|
||||||
|
public:
|
||||||
|
explicit IManagerRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
||||||
|
~IManagerRootService() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result GetDisplayService(
|
||||||
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
|
||||||
|
Policy policy);
|
||||||
|
|
||||||
|
Nvnflinger::Nvnflinger& m_nvnflinger;
|
||||||
|
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,39 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/vi/application_display_service.h"
|
||||||
|
#include "core/hle/service/vi/service_creator.h"
|
||||||
|
#include "core/hle/service/vi/vi_results.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
static bool IsValidServiceAccess(Permission permission, Policy policy) {
|
||||||
|
if (permission == Permission::User) {
|
||||||
|
return policy == Policy::User;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (permission == Permission::System || permission == Permission::Manager) {
|
||||||
|
return policy == Policy::User || policy == Policy::Compositor;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GetApplicationDisplayService(
|
||||||
|
std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
|
||||||
|
Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server, Permission permission,
|
||||||
|
Policy policy) {
|
||||||
|
|
||||||
|
if (!IsValidServiceAccess(permission, policy)) {
|
||||||
|
LOG_ERROR(Service_VI, "Permission denied for policy {}", policy);
|
||||||
|
R_THROW(ResultPermissionDenied);
|
||||||
|
}
|
||||||
|
|
||||||
|
*out_application_display_service =
|
||||||
|
std::make_shared<IApplicationDisplayService>(system, nvnflinger, hos_binder_driver_server);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,33 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "common/common_types.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::Nvnflinger {
|
||||||
|
class HosBinderDriverServer;
|
||||||
|
class Nvnflinger;
|
||||||
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
|
union Result;
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
class IApplicationDisplayService;
|
||||||
|
enum class Permission;
|
||||||
|
enum class Policy : u32;
|
||||||
|
|
||||||
|
Result GetApplicationDisplayService(
|
||||||
|
std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
|
||||||
|
Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server, Permission permission,
|
||||||
|
Policy policy);
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,145 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "common/settings.h"
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/nvnflinger/fb_share_buffer_manager.h"
|
||||||
|
#include "core/hle/service/vi/system_display_service.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
ISystemDisplayService::ISystemDisplayService(Core::System& system_,
|
||||||
|
Nvnflinger::Nvnflinger& nvnflinger)
|
||||||
|
: ServiceFramework{system_, "ISystemDisplayService"}, m_nvnflinger{nvnflinger} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{1200, nullptr, "GetZOrderCountMin"},
|
||||||
|
{1202, nullptr, "GetZOrderCountMax"},
|
||||||
|
{1203, nullptr, "GetDisplayLogicalResolution"},
|
||||||
|
{1204, nullptr, "SetDisplayMagnification"},
|
||||||
|
{2201, nullptr, "SetLayerPosition"},
|
||||||
|
{2203, nullptr, "SetLayerSize"},
|
||||||
|
{2204, nullptr, "GetLayerZ"},
|
||||||
|
{2205, C<&ISystemDisplayService::SetLayerZ>, "SetLayerZ"},
|
||||||
|
{2207, C<&ISystemDisplayService::SetLayerVisibility>, "SetLayerVisibility"},
|
||||||
|
{2209, nullptr, "SetLayerAlpha"},
|
||||||
|
{2210, nullptr, "SetLayerPositionAndSize"},
|
||||||
|
{2312, nullptr, "CreateStrayLayer"},
|
||||||
|
{2400, nullptr, "OpenIndirectLayer"},
|
||||||
|
{2401, nullptr, "CloseIndirectLayer"},
|
||||||
|
{2402, nullptr, "FlipIndirectLayer"},
|
||||||
|
{3000, nullptr, "ListDisplayModes"},
|
||||||
|
{3001, nullptr, "ListDisplayRgbRanges"},
|
||||||
|
{3002, nullptr, "ListDisplayContentTypes"},
|
||||||
|
{3200, C<&ISystemDisplayService::GetDisplayMode>, "GetDisplayMode"},
|
||||||
|
{3201, nullptr, "SetDisplayMode"},
|
||||||
|
{3202, nullptr, "GetDisplayUnderscan"},
|
||||||
|
{3203, nullptr, "SetDisplayUnderscan"},
|
||||||
|
{3204, nullptr, "GetDisplayContentType"},
|
||||||
|
{3205, nullptr, "SetDisplayContentType"},
|
||||||
|
{3206, nullptr, "GetDisplayRgbRange"},
|
||||||
|
{3207, nullptr, "SetDisplayRgbRange"},
|
||||||
|
{3208, nullptr, "GetDisplayCmuMode"},
|
||||||
|
{3209, nullptr, "SetDisplayCmuMode"},
|
||||||
|
{3210, nullptr, "GetDisplayContrastRatio"},
|
||||||
|
{3211, nullptr, "SetDisplayContrastRatio"},
|
||||||
|
{3214, nullptr, "GetDisplayGamma"},
|
||||||
|
{3215, nullptr, "SetDisplayGamma"},
|
||||||
|
{3216, nullptr, "GetDisplayCmuLuma"},
|
||||||
|
{3217, nullptr, "SetDisplayCmuLuma"},
|
||||||
|
{3218, nullptr, "SetDisplayCrcMode"},
|
||||||
|
{6013, nullptr, "GetLayerPresentationSubmissionTimestamps"},
|
||||||
|
{8225, C<&ISystemDisplayService::GetSharedBufferMemoryHandleId>, "GetSharedBufferMemoryHandleId"},
|
||||||
|
{8250, C<&ISystemDisplayService::OpenSharedLayer>, "OpenSharedLayer"},
|
||||||
|
{8251, nullptr, "CloseSharedLayer"},
|
||||||
|
{8252, C<&ISystemDisplayService::ConnectSharedLayer>, "ConnectSharedLayer"},
|
||||||
|
{8253, nullptr, "DisconnectSharedLayer"},
|
||||||
|
{8254, C<&ISystemDisplayService::AcquireSharedFrameBuffer>, "AcquireSharedFrameBuffer"},
|
||||||
|
{8255, C<&ISystemDisplayService::PresentSharedFrameBuffer>, "PresentSharedFrameBuffer"},
|
||||||
|
{8256, C<&ISystemDisplayService::GetSharedFrameBufferAcquirableEvent>, "GetSharedFrameBufferAcquirableEvent"},
|
||||||
|
{8257, nullptr, "FillSharedFrameBufferColor"},
|
||||||
|
{8258, nullptr, "CancelSharedFrameBuffer"},
|
||||||
|
{9000, nullptr, "GetDp2hdmiController"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
ISystemDisplayService::~ISystemDisplayService() = default;
|
||||||
|
|
||||||
|
Result ISystemDisplayService::SetLayerZ(u32 z_value, u64 layer_id) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called. layer_id={}, z_value={}", layer_id, z_value);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function currently does nothing but return a success error code in
|
||||||
|
// the vi library itself, so do the same thing, but log out the passed in values.
|
||||||
|
Result ISystemDisplayService::SetLayerVisibility(bool visible, u64 layer_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called, layer_id={}, visible={}", layer_id, visible);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ISystemDisplayService::GetDisplayMode(Out<u32> out_width, Out<u32> out_height,
|
||||||
|
Out<f32> out_refresh_rate, Out<u32> out_unknown) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
|
|
||||||
|
if (Settings::IsDockedMode()) {
|
||||||
|
*out_width = static_cast<u32>(DisplayResolution::DockedWidth);
|
||||||
|
*out_height = static_cast<u32>(DisplayResolution::DockedHeight);
|
||||||
|
} else {
|
||||||
|
*out_width = static_cast<u32>(DisplayResolution::UndockedWidth);
|
||||||
|
*out_height = static_cast<u32>(DisplayResolution::UndockedHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
*out_refresh_rate = 60.f; // This wouldn't seem to be correct for 30 fps games.
|
||||||
|
*out_unknown = 0;
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ISystemDisplayService::GetSharedBufferMemoryHandleId(
|
||||||
|
Out<s32> out_nvmap_handle, Out<u64> out_size,
|
||||||
|
OutLargeData<Nvnflinger::SharedMemoryPoolLayout, BufferAttr_HipcMapAlias> out_pool_layout,
|
||||||
|
u64 buffer_id, ClientAppletResourceUserId aruid) {
|
||||||
|
LOG_INFO(Service_VI, "called. buffer_id={}, aruid={:#x}", buffer_id, aruid.pid);
|
||||||
|
|
||||||
|
R_RETURN(m_nvnflinger.GetSystemBufferManager().GetSharedBufferMemoryHandleId(
|
||||||
|
out_size, out_nvmap_handle, out_pool_layout, buffer_id, aruid.pid));
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ISystemDisplayService::OpenSharedLayer(u64 layer_id) {
|
||||||
|
LOG_INFO(Service_VI, "(STUBBED) called. layer_id={}", layer_id);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ISystemDisplayService::ConnectSharedLayer(u64 layer_id) {
|
||||||
|
LOG_INFO(Service_VI, "(STUBBED) called. layer_id={}", layer_id);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ISystemDisplayService::AcquireSharedFrameBuffer(Out<android::Fence> out_fence,
|
||||||
|
Out<std::array<s32, 4>> out_slots,
|
||||||
|
Out<s64> out_target_slot, u64 layer_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called");
|
||||||
|
R_RETURN(m_nvnflinger.GetSystemBufferManager().AcquireSharedFrameBuffer(
|
||||||
|
out_fence, *out_slots, out_target_slot, layer_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ISystemDisplayService::PresentSharedFrameBuffer(android::Fence fence,
|
||||||
|
Common::Rectangle<s32> crop_region,
|
||||||
|
u32 window_transform, s32 swap_interval,
|
||||||
|
u64 layer_id, s64 surface_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called");
|
||||||
|
R_RETURN(m_nvnflinger.GetSystemBufferManager().PresentSharedFrameBuffer(
|
||||||
|
fence, crop_region, window_transform, swap_interval, layer_id, surface_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ISystemDisplayService::GetSharedFrameBufferAcquirableEvent(
|
||||||
|
OutCopyHandle<Kernel::KReadableEvent> out_event, u64 layer_id) {
|
||||||
|
LOG_DEBUG(Service_VI, "called");
|
||||||
|
R_RETURN(m_nvnflinger.GetSystemBufferManager().GetSharedFrameBufferAcquirableEvent(out_event,
|
||||||
|
layer_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,45 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "common/math_util.h"
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/nvnflinger/ui/fence.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Service::Nvnflinger {
|
||||||
|
struct SharedMemoryPoolLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
|
||||||
|
public:
|
||||||
|
explicit ISystemDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger);
|
||||||
|
~ISystemDisplayService() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result SetLayerZ(u32 z_value, u64 layer_id);
|
||||||
|
Result SetLayerVisibility(bool visible, u64 layer_id);
|
||||||
|
Result GetDisplayMode(Out<u32> out_width, Out<u32> out_height, Out<f32> out_refresh_rate,
|
||||||
|
Out<u32> out_unknown);
|
||||||
|
|
||||||
|
Result GetSharedBufferMemoryHandleId(
|
||||||
|
Out<s32> out_nvmap_handle, Out<u64> out_size,
|
||||||
|
OutLargeData<Nvnflinger::SharedMemoryPoolLayout, BufferAttr_HipcMapAlias> out_pool_layout,
|
||||||
|
u64 buffer_id, ClientAppletResourceUserId aruid);
|
||||||
|
Result OpenSharedLayer(u64 layer_id);
|
||||||
|
Result ConnectSharedLayer(u64 layer_id);
|
||||||
|
Result GetSharedFrameBufferAcquirableEvent(OutCopyHandle<Kernel::KReadableEvent> out_event,
|
||||||
|
u64 layer_id);
|
||||||
|
Result AcquireSharedFrameBuffer(Out<android::Fence> out_fence,
|
||||||
|
Out<std::array<s32, 4>> out_slots, Out<s64> out_target_slot,
|
||||||
|
u64 layer_id);
|
||||||
|
Result PresentSharedFrameBuffer(android::Fence fence, Common::Rectangle<s32> crop_region,
|
||||||
|
u32 window_transform, s32 swap_interval, u64 layer_id,
|
||||||
|
s64 surface_id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Nvnflinger::Nvnflinger& m_nvnflinger;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,33 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/vi/application_display_service.h"
|
||||||
|
#include "core/hle/service/vi/service_creator.h"
|
||||||
|
#include "core/hle/service/vi/system_root_service.h"
|
||||||
|
#include "core/hle/service/vi/vi.h"
|
||||||
|
#include "core/hle/service/vi/vi_types.h"
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
ISystemRootService::ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
||||||
|
: ServiceFramework{system_, "vi:s"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
|
||||||
|
hos_binder_driver_server} {
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"},
|
||||||
|
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
|
};
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
ISystemRootService::~ISystemRootService() = default;
|
||||||
|
|
||||||
|
Result ISystemRootService::GetDisplayService(
|
||||||
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
||||||
|
LOG_DEBUG(Service_VI, "called");
|
||||||
|
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
|
||||||
|
m_hos_binder_driver_server, Permission::System, policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -0,0 +1,38 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::Nvnflinger {
|
||||||
|
class HosBinderDriverServer;
|
||||||
|
class Nvnflinger;
|
||||||
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
|
namespace Service::VI {
|
||||||
|
|
||||||
|
class IApplicationDisplayService;
|
||||||
|
enum class Policy : u32;
|
||||||
|
|
||||||
|
class ISystemRootService final : public ServiceFramework<ISystemRootService> {
|
||||||
|
public:
|
||||||
|
explicit ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
||||||
|
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
||||||
|
~ISystemRootService() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result GetDisplayService(
|
||||||
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
|
||||||
|
Policy policy);
|
||||||
|
|
||||||
|
Nvnflinger::Nvnflinger& m_nvnflinger;
|
||||||
|
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::VI
|
@ -1,34 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "core/hle/service/vi/vi.h"
|
|
||||||
#include "core/hle/service/vi/vi_m.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_} {
|
|
||||||
static const FunctionInfo functions[] = {
|
|
||||||
{2, &VI_M::GetDisplayService, "GetDisplayService"},
|
|
||||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
|
||||||
{100, nullptr, "PrepareFatal"},
|
|
||||||
{101, nullptr, "ShowFatal"},
|
|
||||||
{102, nullptr, "DrawFatalRectangle"},
|
|
||||||
{103, nullptr, "DrawFatalText32"},
|
|
||||||
};
|
|
||||||
RegisterHandlers(functions);
|
|
||||||
}
|
|
||||||
|
|
||||||
VI_M::~VI_M() = default;
|
|
||||||
|
|
||||||
void VI_M::GetDisplayService(HLERequestContext& ctx) {
|
|
||||||
LOG_DEBUG(Service_VI, "called");
|
|
||||||
|
|
||||||
detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server,
|
|
||||||
Permission::Manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Service::VI
|
|
@ -1,32 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "core/hle/service/service.h"
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class System;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
|
||||||
class HosBinderDriverServer;
|
|
||||||
class Nvnflinger;
|
|
||||||
} // namespace Service::Nvnflinger
|
|
||||||
|
|
||||||
namespace Service::VI {
|
|
||||||
|
|
||||||
class VI_M final : public ServiceFramework<VI_M> {
|
|
||||||
public:
|
|
||||||
explicit VI_M(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
|
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_);
|
|
||||||
~VI_M() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GetDisplayService(HLERequestContext& ctx);
|
|
||||||
|
|
||||||
Nvnflinger::Nvnflinger& nv_flinger;
|
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Service::VI
|
|
@ -1,30 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "core/hle/service/vi/vi.h"
|
|
||||||
#include "core/hle/service/vi/vi_s.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_} {
|
|
||||||
static const FunctionInfo functions[] = {
|
|
||||||
{1, &VI_S::GetDisplayService, "GetDisplayService"},
|
|
||||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
|
||||||
};
|
|
||||||
RegisterHandlers(functions);
|
|
||||||
}
|
|
||||||
|
|
||||||
VI_S::~VI_S() = default;
|
|
||||||
|
|
||||||
void VI_S::GetDisplayService(HLERequestContext& ctx) {
|
|
||||||
LOG_DEBUG(Service_VI, "called");
|
|
||||||
|
|
||||||
detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server,
|
|
||||||
Permission::System);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Service::VI
|
|
@ -1,32 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "core/hle/service/service.h"
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class System;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
|
||||||
class HosBinderDriverServer;
|
|
||||||
class Nvnflinger;
|
|
||||||
} // namespace Service::Nvnflinger
|
|
||||||
|
|
||||||
namespace Service::VI {
|
|
||||||
|
|
||||||
class VI_S final : public ServiceFramework<VI_S> {
|
|
||||||
public:
|
|
||||||
explicit VI_S(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
|
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_);
|
|
||||||
~VI_S() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GetDisplayService(HLERequestContext& ctx);
|
|
||||||
|
|
||||||
Nvnflinger::Nvnflinger& nv_flinger;
|
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Service::VI
|
|
@ -0,0 +1,84 @@
|
|||||||
|
// 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 : u32 {
|
||||||
|
User,
|
||||||
|
Compositor,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class ConvertedScaleMode : u64 {
|
||||||
|
Freeze = 0,
|
||||||
|
ScaleToWindow = 1,
|
||||||
|
ScaleAndCrop = 2,
|
||||||
|
None = 3,
|
||||||
|
PreserveAspectRatio = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class NintendoScaleMode : u32 {
|
||||||
|
None = 0,
|
||||||
|
Freeze = 1,
|
||||||
|
ScaleToWindow = 2,
|
||||||
|
ScaleAndCrop = 3,
|
||||||
|
PreserveAspectRatio = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
using DisplayName = std::array<char, 0x40>;
|
||||||
|
|
||||||
|
struct DisplayInfo {
|
||||||
|
/// The name of this particular display.
|
||||||
|
DisplayName display_name{"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
|
@ -1,30 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "core/hle/service/vi/vi.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_} {
|
|
||||||
static const FunctionInfo functions[] = {
|
|
||||||
{0, &VI_U::GetDisplayService, "GetDisplayService"},
|
|
||||||
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
|
||||||
};
|
|
||||||
RegisterHandlers(functions);
|
|
||||||
}
|
|
||||||
|
|
||||||
VI_U::~VI_U() = default;
|
|
||||||
|
|
||||||
void VI_U::GetDisplayService(HLERequestContext& ctx) {
|
|
||||||
LOG_DEBUG(Service_VI, "called");
|
|
||||||
|
|
||||||
detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server,
|
|
||||||
Permission::User);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Service::VI
|
|
@ -1,32 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "core/hle/service/service.h"
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class System;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
|
||||||
class HosBinderDriverServer;
|
|
||||||
class Nvnflinger;
|
|
||||||
} // namespace Service::Nvnflinger
|
|
||||||
|
|
||||||
namespace Service::VI {
|
|
||||||
|
|
||||||
class VI_U final : public ServiceFramework<VI_U> {
|
|
||||||
public:
|
|
||||||
explicit VI_U(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
|
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_);
|
|
||||||
~VI_U() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GetDisplayService(HLERequestContext& ctx);
|
|
||||||
|
|
||||||
Nvnflinger::Nvnflinger& nv_flinger;
|
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Service::VI
|
|
Loading…
Reference in New Issue