// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include #include #include "core/hle/service/cmif_types.h" #include "core/hle/service/kernel_helpers.h" #include "core/hle/service/os/event.h" #include "core/hle/service/service.h" #include "core/hle/service/vi/vi_types.h" namespace Kernel { class KReadableEvent; } namespace Service::Nvnflinger { class IHOSBinderDriver; } namespace Service::VI { class Container; class IManagerDisplayService; class ISystemDisplayService; class IApplicationDisplayService final : public ServiceFramework { public: IApplicationDisplayService(Core::System& system_, std::shared_ptr container); ~IApplicationDisplayService() override; std::shared_ptr GetContainer() const { return m_container; } public: Result GetRelayService(Out> out_relay_service); Result GetSystemDisplayService( Out> out_system_display_service); Result GetManagerDisplayService( Out> out_manager_display_service); Result GetIndirectDisplayTransactionService( Out> out_indirect_display_transaction_service); Result OpenDisplay(Out out_display_id, DisplayName display_name); Result OpenDefaultDisplay(Out out_display_id); Result CloseDisplay(u64 display_id); Result SetDisplayEnabled(u32 state, u64 display_id); Result GetDisplayResolution(Out out_width, Out out_height, u64 display_id); Result SetLayerScalingMode(NintendoScaleMode scale_mode, u64 layer_id); Result ListDisplays(Out out_count, OutArray out_displays); Result OpenLayer(Out out_size, OutBuffer out_native_window, DisplayName display_name, u64 layer_id, ClientAppletResourceUserId aruid); Result CloseLayer(u64 layer_id); Result CreateStrayLayer(Out out_layer_id, Out out_size, OutBuffer out_native_window, u32 flags, u64 display_id); Result DestroyStrayLayer(u64 layer_id); Result GetDisplayVsyncEvent(OutCopyHandle out_vsync_event, u64 display_id); Result ConvertScalingMode(Out out_scaling_mode, NintendoScaleMode mode); Result GetIndirectLayerImageMap( Out out_size, Out out_stride, OutBuffer out_buffer, s64 width, s64 height, u64 indirect_layer_consumer_handle, ClientAppletResourceUserId aruid); Result GetIndirectLayerImageRequiredMemoryInfo(Out out_size, Out out_alignment, s64 width, s64 height); private: const std::shared_ptr m_container; KernelHelpers::ServiceContext m_context; std::mutex m_lock{}; std::set m_open_layer_ids{}; std::set m_stray_layer_ids{}; std::map m_display_vsync_events{}; bool m_vsync_event_fetched{false}; }; } // namespace Service::VI