mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
nvnflinger: convert to process
This commit is contained in:
parent
7b79cddacd
commit
ee8eccc5fa
@ -804,6 +804,8 @@ add_library(core STATIC
|
|||||||
hle/service/nvnflinger/graphic_buffer_producer.h
|
hle/service/nvnflinger/graphic_buffer_producer.h
|
||||||
hle/service/nvnflinger/hos_binder_driver_server.cpp
|
hle/service/nvnflinger/hos_binder_driver_server.cpp
|
||||||
hle/service/nvnflinger/hos_binder_driver_server.h
|
hle/service/nvnflinger/hos_binder_driver_server.h
|
||||||
|
hle/service/nvnflinger/hos_binder_driver.cpp
|
||||||
|
hle/service/nvnflinger/hos_binder_driver.h
|
||||||
hle/service/nvnflinger/hardware_composer.cpp
|
hle/service/nvnflinger/hardware_composer.cpp
|
||||||
hle/service/nvnflinger/hardware_composer.h
|
hle/service/nvnflinger/hardware_composer.h
|
||||||
hle/service/nvnflinger/hwc_layer.h
|
hle/service/nvnflinger/hwc_layer.h
|
||||||
@ -961,8 +963,6 @@ add_library(core STATIC
|
|||||||
hle/service/vi/application_display_service.h
|
hle/service/vi/application_display_service.h
|
||||||
hle/service/vi/application_root_service.cpp
|
hle/service/vi/application_root_service.cpp
|
||||||
hle/service/vi/application_root_service.h
|
hle/service/vi/application_root_service.h
|
||||||
hle/service/vi/hos_binder_driver.cpp
|
|
||||||
hle/service/vi/hos_binder_driver.h
|
|
||||||
hle/service/vi/manager_display_service.cpp
|
hle/service/vi/manager_display_service.cpp
|
||||||
hle/service/vi/manager_display_service.h
|
hle/service/vi/manager_display_service.h
|
||||||
hle/service/vi/manager_root_service.cpp
|
hle/service/vi/manager_root_service.cpp
|
||||||
|
@ -458,11 +458,9 @@ struct System::Impl {
|
|||||||
gpu_core->NotifyShutdown();
|
gpu_core->NotifyShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core_timing.SyncPause(false);
|
||||||
Network::CancelPendingSocketOperations();
|
Network::CancelPendingSocketOperations();
|
||||||
kernel.SuspendEmulation(true);
|
kernel.SuspendEmulation(true);
|
||||||
if (services) {
|
|
||||||
services->KillNVNFlinger();
|
|
||||||
}
|
|
||||||
kernel.CloseServices();
|
kernel.CloseServices();
|
||||||
kernel.ShutdownCores();
|
kernel.ShutdownCores();
|
||||||
applet_manager.Reset();
|
applet_manager.Reset();
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
auto server_manager = std::make_unique<ServerManager>(system);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
server_manager->RegisterNamedService(
|
server_manager->RegisterNamedService("appletAE",
|
||||||
"appletAE", std::make_shared<IAllSystemAppletProxiesService>(system, nvnflinger));
|
std::make_shared<IAllSystemAppletProxiesService>(system));
|
||||||
server_manager->RegisterNamedService(
|
server_manager->RegisterNamedService("appletOE",
|
||||||
"appletOE", std::make_shared<IApplicationProxyService>(system, nvnflinger));
|
std::make_shared<IApplicationProxyService>(system));
|
||||||
ServerManager::RunServer(std::move(server_manager));
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,12 +7,8 @@ namespace Core {
|
|||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
|
||||||
class Nvnflinger;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::AM
|
} // namespace Service::AM
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/core.h"
|
||||||
#include "core/hle/service/am/display_layer_manager.h"
|
#include "core/hle/service/am/display_layer_manager.h"
|
||||||
#include "core/hle/service/nvnflinger/fb_share_buffer_manager.h"
|
#include "core/hle/service/nvnflinger/fb_share_buffer_manager.h"
|
||||||
|
#include "core/hle/service/nvnflinger/hos_binder_driver.h"
|
||||||
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
||||||
|
#include "core/hle/service/sm/sm.h"
|
||||||
#include "core/hle/service/vi/vi_results.h"
|
#include "core/hle/service/vi/vi_results.h"
|
||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
@ -13,10 +16,12 @@ DisplayLayerManager::~DisplayLayerManager() {
|
|||||||
this->Finalize();
|
this->Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLayerManager::Initialize(Nvnflinger::Nvnflinger* nvnflinger, Kernel::KProcess* process,
|
void DisplayLayerManager::Initialize(Core::System& system, Kernel::KProcess* process,
|
||||||
AppletId applet_id, LibraryAppletMode mode) {
|
AppletId applet_id, LibraryAppletMode mode) {
|
||||||
m_process = process;
|
m_process = process;
|
||||||
m_nvnflinger = nvnflinger;
|
m_surface_flinger = system.ServiceManager()
|
||||||
|
.GetService<Nvnflinger::IHOSBinderDriver>("dispdrv", true)
|
||||||
|
->GetSurfaceFlinger();
|
||||||
m_system_shared_buffer_id = 0;
|
m_system_shared_buffer_id = 0;
|
||||||
m_system_shared_layer_id = 0;
|
m_system_shared_layer_id = 0;
|
||||||
m_applet_id = applet_id;
|
m_applet_id = applet_id;
|
||||||
@ -26,36 +31,36 @@ void DisplayLayerManager::Initialize(Nvnflinger::Nvnflinger* nvnflinger, Kernel:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLayerManager::Finalize() {
|
void DisplayLayerManager::Finalize() {
|
||||||
if (!m_nvnflinger) {
|
if (!m_surface_flinger) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up managed layers.
|
// Clean up managed layers.
|
||||||
for (const auto& layer : m_managed_display_layers) {
|
for (const auto& layer : m_managed_display_layers) {
|
||||||
m_nvnflinger->DestroyLayer(layer);
|
m_surface_flinger->DestroyLayer(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& layer : m_managed_display_recording_layers) {
|
for (const auto& layer : m_managed_display_recording_layers) {
|
||||||
m_nvnflinger->DestroyLayer(layer);
|
m_surface_flinger->DestroyLayer(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up shared layers.
|
// Clean up shared layers.
|
||||||
if (m_buffer_sharing_enabled) {
|
if (m_buffer_sharing_enabled) {
|
||||||
m_nvnflinger->GetSystemBufferManager().Finalize(m_process);
|
m_surface_flinger->GetSystemBufferManager().Finalize(m_process);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_nvnflinger = nullptr;
|
m_surface_flinger = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DisplayLayerManager::CreateManagedDisplayLayer(u64* out_layer) {
|
Result DisplayLayerManager::CreateManagedDisplayLayer(u64* out_layer) {
|
||||||
R_UNLESS(m_nvnflinger != nullptr, VI::ResultOperationFailed);
|
R_UNLESS(m_surface_flinger != nullptr, VI::ResultOperationFailed);
|
||||||
|
|
||||||
// TODO(Subv): Find out how AM determines the display to use, for now just
|
// TODO(Subv): Find out how AM determines the display to use, for now just
|
||||||
// create the layer in the Default display.
|
// create the layer in the Default display.
|
||||||
const auto display_id = m_nvnflinger->OpenDisplay("Default");
|
const auto display_id = m_surface_flinger->OpenDisplay("Default");
|
||||||
const auto layer_id = m_nvnflinger->CreateLayer(*display_id);
|
const auto layer_id = m_surface_flinger->CreateLayer(*display_id);
|
||||||
|
|
||||||
m_nvnflinger->SetLayerVisibility(*layer_id, m_visible);
|
m_surface_flinger->SetLayerVisibility(*layer_id, m_visible);
|
||||||
m_managed_display_layers.emplace(*layer_id);
|
m_managed_display_layers.emplace(*layer_id);
|
||||||
|
|
||||||
*out_layer = *layer_id;
|
*out_layer = *layer_id;
|
||||||
@ -65,7 +70,7 @@ Result DisplayLayerManager::CreateManagedDisplayLayer(u64* out_layer) {
|
|||||||
|
|
||||||
Result DisplayLayerManager::CreateManagedDisplaySeparableLayer(u64* out_layer,
|
Result DisplayLayerManager::CreateManagedDisplaySeparableLayer(u64* out_layer,
|
||||||
u64* out_recording_layer) {
|
u64* out_recording_layer) {
|
||||||
R_UNLESS(m_nvnflinger != nullptr, VI::ResultOperationFailed);
|
R_UNLESS(m_surface_flinger != nullptr, VI::ResultOperationFailed);
|
||||||
|
|
||||||
// TODO(Subv): Find out how AM determines the display to use, for now just
|
// TODO(Subv): Find out how AM determines the display to use, for now just
|
||||||
// create the layer in the Default display.
|
// create the layer in the Default display.
|
||||||
@ -74,10 +79,10 @@ Result DisplayLayerManager::CreateManagedDisplaySeparableLayer(u64* out_layer,
|
|||||||
// Outputting 1 layer id instead of the expected 2 has not been observed to cause any adverse
|
// Outputting 1 layer id instead of the expected 2 has not been observed to cause any adverse
|
||||||
// side effects.
|
// side effects.
|
||||||
// TODO: Support multiple layers
|
// TODO: Support multiple layers
|
||||||
const auto display_id = m_nvnflinger->OpenDisplay("Default");
|
const auto display_id = m_surface_flinger->OpenDisplay("Default");
|
||||||
const auto layer_id = m_nvnflinger->CreateLayer(*display_id);
|
const auto layer_id = m_surface_flinger->CreateLayer(*display_id);
|
||||||
|
|
||||||
m_nvnflinger->SetLayerVisibility(*layer_id, m_visible);
|
m_surface_flinger->SetLayerVisibility(*layer_id, m_visible);
|
||||||
m_managed_display_layers.emplace(*layer_id);
|
m_managed_display_layers.emplace(*layer_id);
|
||||||
|
|
||||||
*out_layer = *layer_id;
|
*out_layer = *layer_id;
|
||||||
@ -91,19 +96,19 @@ Result DisplayLayerManager::IsSystemBufferSharingEnabled() {
|
|||||||
R_SUCCEED_IF(m_buffer_sharing_enabled);
|
R_SUCCEED_IF(m_buffer_sharing_enabled);
|
||||||
|
|
||||||
// Ensure we can access shared layers.
|
// Ensure we can access shared layers.
|
||||||
R_UNLESS(m_nvnflinger != nullptr, VI::ResultOperationFailed);
|
R_UNLESS(m_surface_flinger != nullptr, VI::ResultOperationFailed);
|
||||||
R_UNLESS(m_applet_id != AppletId::Application, VI::ResultPermissionDenied);
|
R_UNLESS(m_applet_id != AppletId::Application, VI::ResultPermissionDenied);
|
||||||
|
|
||||||
// Create the shared layer.
|
// Create the shared layer.
|
||||||
const auto blend =
|
const auto blend =
|
||||||
m_blending_enabled ? Nvnflinger::LayerBlending::Coverage : Nvnflinger::LayerBlending::None;
|
m_blending_enabled ? Nvnflinger::LayerBlending::Coverage : Nvnflinger::LayerBlending::None;
|
||||||
const auto display_id = m_nvnflinger->OpenDisplay("Default").value();
|
const auto display_id = m_surface_flinger->OpenDisplay("Default").value();
|
||||||
R_TRY(m_nvnflinger->GetSystemBufferManager().Initialize(
|
R_TRY(m_surface_flinger->GetSystemBufferManager().Initialize(
|
||||||
m_process, &m_system_shared_buffer_id, &m_system_shared_layer_id, display_id, blend));
|
m_process, &m_system_shared_buffer_id, &m_system_shared_layer_id, display_id, blend));
|
||||||
|
|
||||||
// We succeeded, so set up remaining state.
|
// We succeeded, so set up remaining state.
|
||||||
m_buffer_sharing_enabled = true;
|
m_buffer_sharing_enabled = true;
|
||||||
m_nvnflinger->SetLayerVisibility(m_system_shared_layer_id, m_visible);
|
m_surface_flinger->SetLayerVisibility(m_system_shared_layer_id, m_visible);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,13 +129,13 @@ void DisplayLayerManager::SetWindowVisibility(bool visible) {
|
|||||||
|
|
||||||
m_visible = visible;
|
m_visible = visible;
|
||||||
|
|
||||||
if (m_nvnflinger) {
|
if (m_surface_flinger) {
|
||||||
if (m_system_shared_layer_id) {
|
if (m_system_shared_layer_id) {
|
||||||
m_nvnflinger->SetLayerVisibility(m_system_shared_layer_id, m_visible);
|
m_surface_flinger->SetLayerVisibility(m_system_shared_layer_id, m_visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto layer_id : m_managed_display_layers) {
|
for (const auto layer_id : m_managed_display_layers) {
|
||||||
m_nvnflinger->SetLayerVisibility(layer_id, m_visible);
|
m_surface_flinger->SetLayerVisibility(layer_id, m_visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +147,7 @@ bool DisplayLayerManager::GetWindowVisibility() const {
|
|||||||
Result DisplayLayerManager::WriteAppletCaptureBuffer(bool* out_was_written,
|
Result DisplayLayerManager::WriteAppletCaptureBuffer(bool* out_was_written,
|
||||||
s32* out_fbshare_layer_index) {
|
s32* out_fbshare_layer_index) {
|
||||||
R_UNLESS(m_buffer_sharing_enabled, VI::ResultPermissionDenied);
|
R_UNLESS(m_buffer_sharing_enabled, VI::ResultPermissionDenied);
|
||||||
R_RETURN(m_nvnflinger->GetSystemBufferManager().WriteAppletCaptureBuffer(
|
R_RETURN(m_surface_flinger->GetSystemBufferManager().WriteAppletCaptureBuffer(
|
||||||
out_was_written, out_fbshare_layer_index));
|
out_was_written, out_fbshare_layer_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "core/hle/service/am/am_types.h"
|
#include "core/hle/service/am/am_types.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
class KProcess;
|
class KProcess;
|
||||||
}
|
}
|
||||||
@ -24,8 +28,8 @@ public:
|
|||||||
explicit DisplayLayerManager();
|
explicit DisplayLayerManager();
|
||||||
~DisplayLayerManager();
|
~DisplayLayerManager();
|
||||||
|
|
||||||
void Initialize(Nvnflinger::Nvnflinger* nvnflinger, Kernel::KProcess* process,
|
void Initialize(Core::System& system, Kernel::KProcess* process, AppletId applet_id,
|
||||||
AppletId applet_id, LibraryAppletMode mode);
|
LibraryAppletMode mode);
|
||||||
void Finalize();
|
void Finalize();
|
||||||
|
|
||||||
Result CreateManagedDisplayLayer(u64* out_layer);
|
Result CreateManagedDisplayLayer(u64* out_layer);
|
||||||
@ -42,7 +46,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Kernel::KProcess* m_process{};
|
Kernel::KProcess* m_process{};
|
||||||
Nvnflinger::Nvnflinger* m_nvnflinger{};
|
std::shared_ptr<Nvnflinger::Nvnflinger> m_surface_flinger{};
|
||||||
std::set<u64> m_managed_display_layers{};
|
std::set<u64> m_managed_display_layers{};
|
||||||
std::set<u64> m_managed_display_recording_layers{};
|
std::set<u64> m_managed_display_recording_layers{};
|
||||||
u64 m_system_shared_buffer_id{};
|
u64 m_system_shared_buffer_id{};
|
||||||
|
@ -10,9 +10,8 @@
|
|||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& system_,
|
IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& system_)
|
||||||
Nvnflinger::Nvnflinger& nvnflinger)
|
: ServiceFramework{system_, "appletAE"} {
|
||||||
: ServiceFramework{system_, "appletAE"}, m_nvnflinger{nvnflinger} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"},
|
{100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"},
|
||||||
@ -37,8 +36,8 @@ Result IAllSystemAppletProxiesService::OpenSystemAppletProxy(
|
|||||||
LOG_DEBUG(Service_AM, "called");
|
LOG_DEBUG(Service_AM, "called");
|
||||||
|
|
||||||
if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
|
if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
|
||||||
*out_system_applet_proxy = std::make_shared<ISystemAppletProxy>(
|
*out_system_applet_proxy =
|
||||||
system, applet, process_handle.Get(), m_nvnflinger);
|
std::make_shared<ISystemAppletProxy>(system, applet, process_handle.Get());
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
} else {
|
} else {
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
@ -53,8 +52,8 @@ Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy(
|
|||||||
LOG_DEBUG(Service_AM, "called");
|
LOG_DEBUG(Service_AM, "called");
|
||||||
|
|
||||||
if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
|
if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
|
||||||
*out_library_applet_proxy = std::make_shared<ILibraryAppletProxy>(
|
*out_library_applet_proxy =
|
||||||
system, applet, process_handle.Get(), m_nvnflinger);
|
std::make_shared<ILibraryAppletProxy>(system, applet, process_handle.Get());
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
} else {
|
} else {
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
|
@ -8,10 +8,6 @@
|
|||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
|
|
||||||
namespace Nvnflinger {
|
|
||||||
class Nvnflinger;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace AM {
|
namespace AM {
|
||||||
|
|
||||||
struct Applet;
|
struct Applet;
|
||||||
@ -22,8 +18,7 @@ class ISystemAppletProxy;
|
|||||||
class IAllSystemAppletProxiesService final
|
class IAllSystemAppletProxiesService final
|
||||||
: public ServiceFramework<IAllSystemAppletProxiesService> {
|
: public ServiceFramework<IAllSystemAppletProxiesService> {
|
||||||
public:
|
public:
|
||||||
explicit IAllSystemAppletProxiesService(Core::System& system_,
|
explicit IAllSystemAppletProxiesService(Core::System& system_);
|
||||||
Nvnflinger::Nvnflinger& nvnflinger);
|
|
||||||
~IAllSystemAppletProxiesService() override;
|
~IAllSystemAppletProxiesService() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -40,7 +35,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid);
|
std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid);
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace AM
|
} // namespace AM
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger)
|
Kernel::KProcess* process)
|
||||||
: ServiceFramework{system_, "IApplicationProxy"},
|
: ServiceFramework{system_, "IApplicationProxy"}, m_process{process}, m_applet{
|
||||||
m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} {
|
std::move(applet)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
{0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
||||||
@ -77,8 +77,7 @@ Result IApplicationProxy::GetWindowController(
|
|||||||
Result IApplicationProxy::GetSelfController(
|
Result IApplicationProxy::GetSelfController(
|
||||||
Out<SharedPointer<ISelfController>> out_self_controller) {
|
Out<SharedPointer<ISelfController>> out_self_controller) {
|
||||||
LOG_DEBUG(Service_AM, "called");
|
LOG_DEBUG(Service_AM, "called");
|
||||||
*out_self_controller =
|
*out_self_controller = std::make_shared<ISelfController>(system, m_applet, m_process);
|
||||||
std::make_shared<ISelfController>(system, m_applet, m_process, m_nvnflinger);
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class IWindowController;
|
|||||||
class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
|
class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
|
||||||
public:
|
public:
|
||||||
explicit IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
explicit IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger);
|
Kernel::KProcess* process);
|
||||||
~IApplicationProxy();
|
~IApplicationProxy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -40,7 +40,6 @@ private:
|
|||||||
Out<SharedPointer<IApplicationFunctions>> out_application_functions);
|
Out<SharedPointer<IApplicationFunctions>> out_application_functions);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
|
||||||
Kernel::KProcess* const m_process;
|
Kernel::KProcess* const m_process;
|
||||||
const std::shared_ptr<Applet> m_applet;
|
const std::shared_ptr<Applet> m_applet;
|
||||||
};
|
};
|
||||||
|
@ -10,9 +10,8 @@
|
|||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
IApplicationProxyService::IApplicationProxyService(Core::System& system_,
|
IApplicationProxyService::IApplicationProxyService(Core::System& system_)
|
||||||
Nvnflinger::Nvnflinger& nvnflinger)
|
: ServiceFramework{system_, "appletOE"} {
|
||||||
: ServiceFramework{system_, "appletOE"}, m_nvnflinger{nvnflinger} {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"},
|
{0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"},
|
||||||
};
|
};
|
||||||
@ -28,7 +27,7 @@ Result IApplicationProxyService::OpenApplicationProxy(
|
|||||||
|
|
||||||
if (const auto applet = this->GetAppletFromProcessId(pid)) {
|
if (const auto applet = this->GetAppletFromProcessId(pid)) {
|
||||||
*out_application_proxy =
|
*out_application_proxy =
|
||||||
std::make_shared<IApplicationProxy>(system, applet, process_handle.Get(), m_nvnflinger);
|
std::make_shared<IApplicationProxy>(system, applet, process_handle.Get());
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
} else {
|
} else {
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
|
@ -8,10 +8,6 @@
|
|||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
|
|
||||||
namespace Nvnflinger {
|
|
||||||
class Nvnflinger;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace AM {
|
namespace AM {
|
||||||
|
|
||||||
struct Applet;
|
struct Applet;
|
||||||
@ -19,7 +15,7 @@ class IApplicationProxy;
|
|||||||
|
|
||||||
class IApplicationProxyService final : public ServiceFramework<IApplicationProxyService> {
|
class IApplicationProxyService final : public ServiceFramework<IApplicationProxyService> {
|
||||||
public:
|
public:
|
||||||
explicit IApplicationProxyService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger);
|
explicit IApplicationProxyService(Core::System& system_);
|
||||||
~IApplicationProxyService() override;
|
~IApplicationProxyService() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -28,7 +24,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid);
|
std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid);
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace AM
|
} // namespace AM
|
||||||
|
@ -19,10 +19,9 @@
|
|||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process,
|
Kernel::KProcess* process)
|
||||||
Nvnflinger::Nvnflinger& nvnflinger)
|
: ServiceFramework{system_, "ILibraryAppletProxy"}, m_process{process}, m_applet{
|
||||||
: ServiceFramework{system_, "ILibraryAppletProxy"},
|
std::move(applet)} {
|
||||||
m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
{0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
||||||
@ -83,8 +82,7 @@ Result ILibraryAppletProxy::GetWindowController(
|
|||||||
Result ILibraryAppletProxy::GetSelfController(
|
Result ILibraryAppletProxy::GetSelfController(
|
||||||
Out<SharedPointer<ISelfController>> out_self_controller) {
|
Out<SharedPointer<ISelfController>> out_self_controller) {
|
||||||
LOG_DEBUG(Service_AM, "called");
|
LOG_DEBUG(Service_AM, "called");
|
||||||
*out_self_controller =
|
*out_self_controller = std::make_shared<ISelfController>(system, m_applet, m_process);
|
||||||
std::make_shared<ISelfController>(system, m_applet, m_process, m_nvnflinger);
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class IWindowController;
|
|||||||
class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
|
class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
|
||||||
public:
|
public:
|
||||||
explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger);
|
Kernel::KProcess* process);
|
||||||
~ILibraryAppletProxy();
|
~ILibraryAppletProxy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -47,7 +47,6 @@ private:
|
|||||||
Result GetGlobalStateController(
|
Result GetGlobalStateController(
|
||||||
Out<SharedPointer<IGlobalStateController>> out_global_state_controller);
|
Out<SharedPointer<IGlobalStateController>> out_global_state_controller);
|
||||||
|
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
|
||||||
Kernel::KProcess* const m_process;
|
Kernel::KProcess* const m_process;
|
||||||
const std::shared_ptr<Applet> m_applet;
|
const std::shared_ptr<Applet> m_applet;
|
||||||
};
|
};
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet> applet,
|
ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger)
|
Kernel::KProcess* process)
|
||||||
: ServiceFramework{system_, "ISelfController"}, m_nvnflinger{nvnflinger}, m_process{process},
|
: ServiceFramework{system_, "ISelfController"}, m_process{process}, m_applet{
|
||||||
m_applet{std::move(applet)} {
|
std::move(applet)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&ISelfController::Exit>, "Exit"},
|
{0, D<&ISelfController::Exit>, "Exit"},
|
||||||
@ -74,7 +74,7 @@ ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet>
|
|||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
|
|
||||||
std::scoped_lock lk{m_applet->lock};
|
std::scoped_lock lk{m_applet->lock};
|
||||||
m_applet->display_layer_manager.Initialize(&m_nvnflinger, m_process, m_applet->applet_id,
|
m_applet->display_layer_manager.Initialize(system, m_process, m_applet->applet_id,
|
||||||
m_applet->library_applet_mode);
|
m_applet->library_applet_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ struct Applet;
|
|||||||
class ISelfController final : public ServiceFramework<ISelfController> {
|
class ISelfController final : public ServiceFramework<ISelfController> {
|
||||||
public:
|
public:
|
||||||
explicit ISelfController(Core::System& system_, std::shared_ptr<Applet> applet,
|
explicit ISelfController(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger);
|
Kernel::KProcess* process);
|
||||||
~ISelfController() override;
|
~ISelfController() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -64,7 +64,6 @@ private:
|
|||||||
Result SaveCurrentScreenshot(Capture::AlbumReportOption album_report_option);
|
Result SaveCurrentScreenshot(Capture::AlbumReportOption album_report_option);
|
||||||
Result SetRecordVolumeMuted(bool muted);
|
Result SetRecordVolumeMuted(bool muted);
|
||||||
|
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
|
||||||
Kernel::KProcess* const m_process;
|
Kernel::KProcess* const m_process;
|
||||||
const std::shared_ptr<Applet> m_applet;
|
const std::shared_ptr<Applet> m_applet;
|
||||||
};
|
};
|
||||||
|
@ -19,10 +19,9 @@
|
|||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process,
|
Kernel::KProcess* process)
|
||||||
Nvnflinger::Nvnflinger& nvnflinger)
|
: ServiceFramework{system_, "ISystemAppletProxy"}, m_process{process}, m_applet{
|
||||||
: ServiceFramework{system_, "ISystemAppletProxy"},
|
std::move(applet)} {
|
||||||
m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
{0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
|
||||||
@ -83,8 +82,7 @@ Result ISystemAppletProxy::GetWindowController(
|
|||||||
Result ISystemAppletProxy::GetSelfController(
|
Result ISystemAppletProxy::GetSelfController(
|
||||||
Out<SharedPointer<ISelfController>> out_self_controller) {
|
Out<SharedPointer<ISelfController>> out_self_controller) {
|
||||||
LOG_DEBUG(Service_AM, "called");
|
LOG_DEBUG(Service_AM, "called");
|
||||||
*out_self_controller =
|
*out_self_controller = std::make_shared<ISelfController>(system, m_applet, m_process);
|
||||||
std::make_shared<ISelfController>(system, m_applet, m_process, m_nvnflinger);
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class IWindowController;
|
|||||||
class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
|
class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
|
||||||
public:
|
public:
|
||||||
explicit ISystemAppletProxy(Core::System& system, std::shared_ptr<Applet> applet,
|
explicit ISystemAppletProxy(Core::System& system, std::shared_ptr<Applet> applet,
|
||||||
Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger);
|
Kernel::KProcess* process);
|
||||||
~ISystemAppletProxy();
|
~ISystemAppletProxy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -46,7 +46,6 @@ private:
|
|||||||
Result GetGlobalStateController(
|
Result GetGlobalStateController(
|
||||||
Out<SharedPointer<IGlobalStateController>> out_global_state_controller);
|
Out<SharedPointer<IGlobalStateController>> out_global_state_controller);
|
||||||
|
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
|
||||||
Kernel::KProcess* const m_process;
|
Kernel::KProcess* const m_process;
|
||||||
const std::shared_ptr<Applet> m_applet;
|
const std::shared_ptr<Applet> m_applet;
|
||||||
};
|
};
|
||||||
|
@ -42,7 +42,7 @@ void EventInterface::FreeEvent(Kernel::KEvent* event) {
|
|||||||
module.service_context.CloseEvent(event);
|
module.service_context.CloseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
auto server_manager = std::make_unique<ServerManager>(system);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
auto module = std::make_shared<Module>(system);
|
auto module = std::make_shared<Module>(system);
|
||||||
const auto NvdrvInterfaceFactoryForApplication = [&, module] {
|
const auto NvdrvInterfaceFactoryForApplication = [&, module] {
|
||||||
@ -62,7 +62,6 @@ void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
|
|||||||
server_manager->RegisterNamedService("nvdrv:s", NvdrvInterfaceFactoryForSysmodules);
|
server_manager->RegisterNamedService("nvdrv:s", NvdrvInterfaceFactoryForSysmodules);
|
||||||
server_manager->RegisterNamedService("nvdrv:t", NvdrvInterfaceFactoryForTesting);
|
server_manager->RegisterNamedService("nvdrv:t", NvdrvInterfaceFactoryForTesting);
|
||||||
server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
|
server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
|
||||||
nvnflinger.SetNVDrvInstance(module);
|
|
||||||
ServerManager::RunServer(std::move(server_manager));
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,6 @@ private:
|
|||||||
std::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
|
std::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
|
||||||
};
|
};
|
||||||
|
|
||||||
void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::Nvidia
|
} // namespace Service::Nvidia
|
||||||
|
@ -263,8 +263,10 @@ NVDRV::NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char*
|
|||||||
}
|
}
|
||||||
|
|
||||||
NVDRV::~NVDRV() {
|
NVDRV::~NVDRV() {
|
||||||
auto& container = nvdrv->GetContainer();
|
if (is_initialized) {
|
||||||
container.CloseSession(session_id);
|
auto& container = nvdrv->GetContainer();
|
||||||
|
container.CloseSession(session_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Nvidia
|
} // namespace Service::Nvidia
|
||||||
|
@ -16,6 +16,10 @@ public:
|
|||||||
explicit NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name);
|
explicit NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name);
|
||||||
~NVDRV() override;
|
~NVDRV() override;
|
||||||
|
|
||||||
|
std::shared_ptr<Module> GetModule() const {
|
||||||
|
return nvdrv;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Open(HLERequestContext& ctx);
|
void Open(HLERequestContext& ctx);
|
||||||
void Ioctl1(HLERequestContext& ctx);
|
void Ioctl1(HLERequestContext& ctx);
|
||||||
|
@ -3,13 +3,16 @@
|
|||||||
|
|
||||||
#include "core/hle/service/cmif_serialization.h"
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
#include "core/hle/service/nvnflinger/binder.h"
|
#include "core/hle/service/nvnflinger/binder.h"
|
||||||
|
#include "core/hle/service/nvnflinger/hos_binder_driver.h"
|
||||||
#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
|
#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
|
||||||
#include "core/hle/service/vi/hos_binder_driver.h"
|
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::Nvnflinger {
|
||||||
|
|
||||||
IHOSBinderDriver::IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server)
|
IHOSBinderDriver::IHOSBinderDriver(Core::System& system_,
|
||||||
: ServiceFramework{system_, "IHOSBinderDriver"}, m_server(server) {
|
std::shared_ptr<HosBinderDriverServer> server,
|
||||||
|
std::shared_ptr<Nvnflinger> surface_flinger)
|
||||||
|
: ServiceFramework{system_, "IHOSBinderDriver"}, m_server(server),
|
||||||
|
m_surface_flinger(surface_flinger) {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"},
|
{0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"},
|
||||||
{1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"},
|
{1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"},
|
||||||
@ -27,7 +30,7 @@ Result IHOSBinderDriver::TransactParcel(s32 binder_id, android::TransactionId tr
|
|||||||
u32 flags) {
|
u32 flags) {
|
||||||
LOG_DEBUG(Service_VI, "called. id={} transaction={}, flags={}", binder_id, transaction_id,
|
LOG_DEBUG(Service_VI, "called. id={} transaction={}, flags={}", binder_id, transaction_id,
|
||||||
flags);
|
flags);
|
||||||
m_server.TryGetProducer(binder_id)->Transact(transaction_id, flags, parcel_data, parcel_reply);
|
m_server->TryGetProducer(binder_id)->Transact(transaction_id, flags, parcel_data, parcel_reply);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +42,7 @@ Result IHOSBinderDriver::AdjustRefcount(s32 binder_id, s32 addval, s32 type) {
|
|||||||
Result IHOSBinderDriver::GetNativeHandle(s32 binder_id, u32 type_id,
|
Result IHOSBinderDriver::GetNativeHandle(s32 binder_id, u32 type_id,
|
||||||
OutCopyHandle<Kernel::KReadableEvent> out_handle) {
|
OutCopyHandle<Kernel::KReadableEvent> out_handle) {
|
||||||
LOG_WARNING(Service_VI, "(STUBBED) called id={}, type_id={}", binder_id, type_id);
|
LOG_WARNING(Service_VI, "(STUBBED) called id={}, type_id={}", binder_id, type_id);
|
||||||
*out_handle = &m_server.TryGetProducer(binder_id)->GetNativeHandle();
|
*out_handle = &m_server->TryGetProducer(binder_id)->GetNativeHandle();
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,4 +53,4 @@ Result IHOSBinderDriver::TransactParcelAuto(s32 binder_id, android::TransactionI
|
|||||||
R_RETURN(this->TransactParcel(binder_id, transaction_id, parcel_data, parcel_reply, flags));
|
R_RETURN(this->TransactParcel(binder_id, transaction_id, parcel_data, parcel_reply, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::Nvnflinger
|
@ -5,13 +5,21 @@
|
|||||||
#include "core/hle/service/nvnflinger/binder.h"
|
#include "core/hle/service/nvnflinger/binder.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::Nvnflinger {
|
||||||
|
|
||||||
|
class HosBinderDriverServer;
|
||||||
|
class Nvnflinger;
|
||||||
|
|
||||||
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_, std::shared_ptr<HosBinderDriverServer> server,
|
||||||
|
std::shared_ptr<Nvnflinger> surface_flinger);
|
||||||
~IHOSBinderDriver() override;
|
~IHOSBinderDriver() override;
|
||||||
|
|
||||||
|
std::shared_ptr<Nvnflinger> GetSurfaceFlinger() {
|
||||||
|
return m_surface_flinger;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Result TransactParcel(s32 binder_id, android::TransactionId transaction_id,
|
Result TransactParcel(s32 binder_id, android::TransactionId transaction_id,
|
||||||
InBuffer<BufferAttr_HipcMapAlias> parcel_data,
|
InBuffer<BufferAttr_HipcMapAlias> parcel_data,
|
||||||
@ -24,7 +32,8 @@ private:
|
|||||||
OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply, u32 flags);
|
OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply, u32 flags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Nvnflinger::HosBinderDriverServer& m_server;
|
const std::shared_ptr<HosBinderDriverServer> m_server;
|
||||||
|
const std::shared_ptr<Nvnflinger> m_surface_flinger;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::Nvnflinger
|
@ -1,33 +1,24 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <optional>
|
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "common/thread.h"
|
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
#include "core/hle/kernel/k_readable_event.h"
|
|
||||||
#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
|
#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
|
||||||
#include "core/hle/service/nvdrv/nvdrv.h"
|
#include "core/hle/service/nvdrv/nvdrv.h"
|
||||||
#include "core/hle/service/nvnflinger/buffer_item_consumer.h"
|
#include "core/hle/service/nvdrv/nvdrv_interface.h"
|
||||||
#include "core/hle/service/nvnflinger/buffer_queue_core.h"
|
|
||||||
#include "core/hle/service/nvnflinger/fb_share_buffer_manager.h"
|
#include "core/hle/service/nvnflinger/fb_share_buffer_manager.h"
|
||||||
#include "core/hle/service/nvnflinger/hardware_composer.h"
|
#include "core/hle/service/nvnflinger/hardware_composer.h"
|
||||||
|
#include "core/hle/service/nvnflinger/hos_binder_driver.h"
|
||||||
#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
|
#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
|
||||||
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
||||||
#include "core/hle/service/nvnflinger/ui/graphic_buffer.h"
|
#include "core/hle/service/server_manager.h"
|
||||||
|
#include "core/hle/service/sm/sm.h"
|
||||||
#include "core/hle/service/vi/display/vi_display.h"
|
#include "core/hle/service/vi/display/vi_display.h"
|
||||||
#include "core/hle/service/vi/layer/vi_layer.h"
|
#include "core/hle/service/vi/layer/vi_layer.h"
|
||||||
#include "core/hle/service/vi/vi_results.h"
|
#include "core/hle/service/vi/vi_results.h"
|
||||||
#include "video_core/gpu.h"
|
|
||||||
#include "video_core/host1x/host1x.h"
|
|
||||||
#include "video_core/host1x/syncpoint_manager.h"
|
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
namespace Service::Nvnflinger {
|
||||||
|
|
||||||
@ -47,6 +38,11 @@ void Nvnflinger::SplitVSync(std::stop_token stop_token) {
|
|||||||
while (!stop_token.stop_requested()) {
|
while (!stop_token.stop_requested()) {
|
||||||
vsync_signal.Wait();
|
vsync_signal.Wait();
|
||||||
|
|
||||||
|
if (system.IsShuttingDown()) {
|
||||||
|
ShutdownLayers();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto lock_guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
|
|
||||||
if (!is_abandoned) {
|
if (!is_abandoned) {
|
||||||
@ -65,6 +61,9 @@ Nvnflinger::Nvnflinger(Core::System& system_, HosBinderDriverServer& hos_binder_
|
|||||||
displays.emplace_back(4, "Null", hos_binder_driver_server, service_context, system);
|
displays.emplace_back(4, "Null", hos_binder_driver_server, service_context, system);
|
||||||
guard = std::make_shared<std::mutex>();
|
guard = std::make_shared<std::mutex>();
|
||||||
|
|
||||||
|
nvdrv = system.ServiceManager().GetService<Nvidia::NVDRV>("nvdrv:s", true)->GetModule();
|
||||||
|
disp_fd = nvdrv->Open("/dev/nvdisp_disp0", {});
|
||||||
|
|
||||||
// Schedule the screen composition events
|
// Schedule the screen composition events
|
||||||
multi_composition_event = Core::Timing::CreateEvent(
|
multi_composition_event = Core::Timing::CreateEvent(
|
||||||
"ScreenComposition",
|
"ScreenComposition",
|
||||||
@ -110,22 +109,12 @@ Nvnflinger::~Nvnflinger() {
|
|||||||
|
|
||||||
void Nvnflinger::ShutdownLayers() {
|
void Nvnflinger::ShutdownLayers() {
|
||||||
// Abandon consumers.
|
// Abandon consumers.
|
||||||
{
|
const auto lock_guard = Lock();
|
||||||
const auto lock_guard = Lock();
|
for (auto& display : displays) {
|
||||||
for (auto& display : displays) {
|
display.Abandon();
|
||||||
display.Abandon();
|
|
||||||
}
|
|
||||||
|
|
||||||
is_abandoned = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Join the vsync thread, if it exists.
|
is_abandoned = true;
|
||||||
vsync_thread = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
void Nvnflinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) {
|
|
||||||
nvdrv = std::move(instance);
|
|
||||||
disp_fd = nvdrv->Open("/dev/nvdisp_disp0", {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u64> Nvnflinger::OpenDisplay(std::string_view name) {
|
std::optional<u64> Nvnflinger::OpenDisplay(std::string_view name) {
|
||||||
@ -332,4 +321,14 @@ FbShareBufferManager& Nvnflinger::GetSystemBufferManager() {
|
|||||||
return *system_buffer_manager;
|
return *system_buffer_manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoopProcess(Core::System& system) {
|
||||||
|
const auto binder_server = std::make_shared<HosBinderDriverServer>(system);
|
||||||
|
const auto surface_flinger = std::make_shared<Nvnflinger>(system, *binder_server);
|
||||||
|
|
||||||
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
server_manager->RegisterNamedService(
|
||||||
|
"dispdrv", std::make_shared<IHOSBinderDriver>(system, binder_server, surface_flinger));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Service::Nvnflinger
|
} // namespace Service::Nvnflinger
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/polyfill_thread.h"
|
#include "common/polyfill_thread.h"
|
||||||
@ -57,9 +56,6 @@ public:
|
|||||||
|
|
||||||
void ShutdownLayers();
|
void ShutdownLayers();
|
||||||
|
|
||||||
/// Sets the NVDrv module instance to use to send buffers to the GPU.
|
|
||||||
void SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance);
|
|
||||||
|
|
||||||
/// Opens the specified display and returns the ID.
|
/// Opens the specified display and returns the ID.
|
||||||
///
|
///
|
||||||
/// If an invalid display name is provided, then an empty optional is returned.
|
/// If an invalid display name is provided, then an empty optional is returned.
|
||||||
@ -169,4 +165,6 @@ private:
|
|||||||
HosBinderDriverServer& hos_binder_driver_server;
|
HosBinderDriverServer& hos_binder_driver_server;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::Nvnflinger
|
} // namespace Service::Nvnflinger
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
#include "core/hle/service/npns/npns.h"
|
#include "core/hle/service/npns/npns.h"
|
||||||
#include "core/hle/service/ns/ns.h"
|
#include "core/hle/service/ns/ns.h"
|
||||||
#include "core/hle/service/nvdrv/nvdrv.h"
|
#include "core/hle/service/nvdrv/nvdrv.h"
|
||||||
#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
|
|
||||||
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
||||||
#include "core/hle/service/olsc/olsc.h"
|
#include "core/hle/service/olsc/olsc.h"
|
||||||
#include "core/hle/service/omm/omm.h"
|
#include "core/hle/service/omm/omm.h"
|
||||||
@ -210,14 +209,9 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize Services
|
/// Initialize Services
|
||||||
Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system)
|
Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system) {
|
||||||
: hos_binder_driver_server{std::make_unique<Nvnflinger::HosBinderDriverServer>(system)},
|
|
||||||
nv_flinger{std::make_unique<Nvnflinger::Nvnflinger>(system, *hos_binder_driver_server)} {
|
|
||||||
|
|
||||||
auto& kernel = system.Kernel();
|
auto& kernel = system.Kernel();
|
||||||
|
|
||||||
// Nvnflinger needs to be accessed by several services like Vi and AppletOE so we instantiate it
|
|
||||||
// here and pass it into the respective InstallInterfaces functions.
|
|
||||||
system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false);
|
system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false);
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -226,13 +220,14 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
|
|||||||
kernel.RunOnHostCoreProcess("jit", [&] { JIT::LoopProcess(system); }).detach();
|
kernel.RunOnHostCoreProcess("jit", [&] { JIT::LoopProcess(system); }).detach();
|
||||||
kernel.RunOnHostCoreProcess("ldn", [&] { LDN::LoopProcess(system); }).detach();
|
kernel.RunOnHostCoreProcess("ldn", [&] { LDN::LoopProcess(system); }).detach();
|
||||||
kernel.RunOnHostCoreProcess("Loader", [&] { LDR::LoopProcess(system); }).detach();
|
kernel.RunOnHostCoreProcess("Loader", [&] { LDR::LoopProcess(system); }).detach();
|
||||||
kernel.RunOnHostCoreProcess("nvservices", [&] { Nvidia::LoopProcess(*nv_flinger, system); }).detach();
|
kernel.RunOnHostCoreProcess("nvservices", [&] { Nvidia::LoopProcess(system); }).detach();
|
||||||
kernel.RunOnHostCoreProcess("bsdsocket", [&] { Sockets::LoopProcess(system); }).detach();
|
kernel.RunOnHostCoreProcess("bsdsocket", [&] { Sockets::LoopProcess(system); }).detach();
|
||||||
kernel.RunOnHostCoreProcess("vi", [&] { VI::LoopProcess(system, *nv_flinger, *hos_binder_driver_server); }).detach();
|
kernel.RunOnHostCoreProcess("vi", [&] { VI::LoopProcess(system); }).detach();
|
||||||
|
kernel.RunOnHostCoreProcess("nvnflinger", [&] { Nvnflinger::LoopProcess(system); }).detach();
|
||||||
|
|
||||||
kernel.RunOnGuestCoreProcess("sm", [&] { SM::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("sm", [&] { SM::LoopProcess(system); });
|
||||||
kernel.RunOnGuestCoreProcess("account", [&] { Account::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("account", [&] { Account::LoopProcess(system); });
|
||||||
kernel.RunOnGuestCoreProcess("am", [&] { AM::LoopProcess(*nv_flinger, system); });
|
kernel.RunOnGuestCoreProcess("am", [&] { AM::LoopProcess(system); });
|
||||||
kernel.RunOnGuestCoreProcess("aoc", [&] { AOC::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("aoc", [&] { AOC::LoopProcess(system); });
|
||||||
kernel.RunOnGuestCoreProcess("apm", [&] { APM::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("apm", [&] { APM::LoopProcess(system); });
|
||||||
kernel.RunOnGuestCoreProcess("bcat", [&] { BCAT::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("bcat", [&] { BCAT::LoopProcess(system); });
|
||||||
@ -246,7 +241,6 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
|
|||||||
kernel.RunOnGuestCoreProcess("fatal", [&] { Fatal::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("fatal", [&] { Fatal::LoopProcess(system); });
|
||||||
kernel.RunOnGuestCoreProcess("fgm", [&] { FGM::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("fgm", [&] { FGM::LoopProcess(system); });
|
||||||
kernel.RunOnGuestCoreProcess("friends", [&] { Friend::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("friends", [&] { Friend::LoopProcess(system); });
|
||||||
// glue depends on settings and psc, so they must come first
|
|
||||||
kernel.RunOnGuestCoreProcess("settings", [&] { Set::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("settings", [&] { Set::LoopProcess(system); });
|
||||||
kernel.RunOnGuestCoreProcess("psc", [&] { PSC::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("psc", [&] { PSC::LoopProcess(system); });
|
||||||
kernel.RunOnGuestCoreProcess("glue", [&] { Glue::LoopProcess(system); });
|
kernel.RunOnGuestCoreProcess("glue", [&] { Glue::LoopProcess(system); });
|
||||||
@ -283,8 +277,4 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
|
|||||||
|
|
||||||
Services::~Services() = default;
|
Services::~Services() = default;
|
||||||
|
|
||||||
void Services::KillNVNFlinger() {
|
|
||||||
nv_flinger->ShutdownLayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Service
|
} // namespace Service
|
||||||
|
@ -28,11 +28,6 @@ namespace FileSystem {
|
|||||||
class FileSystemController;
|
class FileSystemController;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Nvnflinger {
|
|
||||||
class HosBinderDriverServer;
|
|
||||||
class Nvnflinger;
|
|
||||||
} // namespace Nvnflinger
|
|
||||||
|
|
||||||
namespace SM {
|
namespace SM {
|
||||||
class ServiceManager;
|
class ServiceManager;
|
||||||
}
|
}
|
||||||
@ -244,12 +239,6 @@ class Services final {
|
|||||||
public:
|
public:
|
||||||
explicit Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system);
|
explicit Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system);
|
||||||
~Services();
|
~Services();
|
||||||
|
|
||||||
void KillNVNFlinger();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<Nvnflinger::HosBinderDriverServer> hos_binder_driver_server;
|
|
||||||
std::unique_ptr<Nvnflinger::Nvnflinger> nv_flinger;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service
|
} // namespace Service
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/cmif_serialization.h"
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/nvnflinger/hos_binder_driver.h"
|
||||||
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
||||||
#include "core/hle/service/nvnflinger/parcel.h"
|
#include "core/hle/service/nvnflinger/parcel.h"
|
||||||
#include "core/hle/service/vi/application_display_service.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/manager_display_service.h"
|
||||||
#include "core/hle/service/vi/system_display_service.h"
|
#include "core/hle/service/vi/system_display_service.h"
|
||||||
#include "core/hle/service/vi/vi_results.h"
|
#include "core/hle/service/vi/vi_results.h"
|
||||||
@ -13,10 +13,10 @@
|
|||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
IApplicationDisplayService::IApplicationDisplayService(
|
IApplicationDisplayService::IApplicationDisplayService(
|
||||||
Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
Core::System& system_, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service)
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
: ServiceFramework{system_, "IApplicationDisplayService"},
|
||||||
: ServiceFramework{system_, "IApplicationDisplayService"}, m_nvnflinger{nvnflinger},
|
m_binder_service{std::move(binder_service)},
|
||||||
m_hos_binder_driver_server{hos_binder_driver_server} {
|
m_surface_flinger{m_binder_service->GetSurfaceFlinger()} {
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
@ -49,36 +49,37 @@ IApplicationDisplayService::IApplicationDisplayService(
|
|||||||
|
|
||||||
IApplicationDisplayService::~IApplicationDisplayService() {
|
IApplicationDisplayService::~IApplicationDisplayService() {
|
||||||
for (const auto layer_id : m_stray_layer_ids) {
|
for (const auto layer_id : m_stray_layer_ids) {
|
||||||
m_nvnflinger.DestroyLayer(layer_id);
|
m_surface_flinger->DestroyLayer(layer_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result IApplicationDisplayService::GetRelayService(
|
Result IApplicationDisplayService::GetRelayService(
|
||||||
Out<SharedPointer<IHOSBinderDriver>> out_relay_service) {
|
Out<SharedPointer<Nvnflinger::IHOSBinderDriver>> out_relay_service) {
|
||||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
*out_relay_service = std::make_shared<IHOSBinderDriver>(system, m_hos_binder_driver_server);
|
*out_relay_service = m_binder_service;
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result IApplicationDisplayService::GetSystemDisplayService(
|
Result IApplicationDisplayService::GetSystemDisplayService(
|
||||||
Out<SharedPointer<ISystemDisplayService>> out_system_display_service) {
|
Out<SharedPointer<ISystemDisplayService>> out_system_display_service) {
|
||||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
*out_system_display_service = std::make_shared<ISystemDisplayService>(system, m_nvnflinger);
|
*out_system_display_service =
|
||||||
|
std::make_shared<ISystemDisplayService>(system, m_surface_flinger);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result IApplicationDisplayService::GetManagerDisplayService(
|
Result IApplicationDisplayService::GetManagerDisplayService(
|
||||||
Out<SharedPointer<IManagerDisplayService>> out_manager_display_service) {
|
Out<SharedPointer<IManagerDisplayService>> out_manager_display_service) {
|
||||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
*out_manager_display_service = std::make_shared<IManagerDisplayService>(system, m_nvnflinger);
|
*out_manager_display_service =
|
||||||
|
std::make_shared<IManagerDisplayService>(system, m_surface_flinger);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result IApplicationDisplayService::GetIndirectDisplayTransactionService(
|
Result IApplicationDisplayService::GetIndirectDisplayTransactionService(
|
||||||
Out<SharedPointer<IHOSBinderDriver>> out_indirect_display_transaction_service) {
|
Out<SharedPointer<Nvnflinger::IHOSBinderDriver>> out_indirect_display_transaction_service) {
|
||||||
LOG_WARNING(Service_VI, "(STUBBED) called");
|
LOG_WARNING(Service_VI, "(STUBBED) called");
|
||||||
*out_indirect_display_transaction_service =
|
*out_indirect_display_transaction_service = m_binder_service;
|
||||||
std::make_shared<IHOSBinderDriver>(system, m_hos_binder_driver_server);
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ Result IApplicationDisplayService::OpenDisplay(Out<u64> out_display_id, DisplayN
|
|||||||
ASSERT_MSG(strcmp(display_name.data(), "Default") == 0,
|
ASSERT_MSG(strcmp(display_name.data(), "Default") == 0,
|
||||||
"Non-default displays aren't supported yet");
|
"Non-default displays aren't supported yet");
|
||||||
|
|
||||||
const auto display_id = m_nvnflinger.OpenDisplay(display_name.data());
|
const auto display_id = m_surface_flinger->OpenDisplay(display_name.data());
|
||||||
if (!display_id) {
|
if (!display_id) {
|
||||||
LOG_ERROR(Service_VI, "Display not found! display_name={}", display_name.data());
|
LOG_ERROR(Service_VI, "Display not found! display_name={}", display_name.data());
|
||||||
R_THROW(VI::ResultNotFound);
|
R_THROW(VI::ResultNotFound);
|
||||||
@ -106,7 +107,7 @@ Result IApplicationDisplayService::OpenDefaultDisplay(Out<u64> out_display_id) {
|
|||||||
|
|
||||||
Result IApplicationDisplayService::CloseDisplay(u64 display_id) {
|
Result IApplicationDisplayService::CloseDisplay(u64 display_id) {
|
||||||
LOG_DEBUG(Service_VI, "called");
|
LOG_DEBUG(Service_VI, "called");
|
||||||
R_SUCCEED_IF(m_nvnflinger.CloseDisplay(display_id));
|
R_SUCCEED_IF(m_surface_flinger->CloseDisplay(display_id));
|
||||||
R_THROW(ResultUnknown);
|
R_THROW(ResultUnknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,19 +169,19 @@ Result IApplicationDisplayService::OpenLayer(Out<u64> out_size,
|
|||||||
|
|
||||||
LOG_DEBUG(Service_VI, "called. layer_id={}, aruid={:#x}", layer_id, aruid.pid);
|
LOG_DEBUG(Service_VI, "called. layer_id={}, aruid={:#x}", layer_id, aruid.pid);
|
||||||
|
|
||||||
const auto display_id = m_nvnflinger.OpenDisplay(display_name.data());
|
const auto display_id = m_surface_flinger->OpenDisplay(display_name.data());
|
||||||
if (!display_id) {
|
if (!display_id) {
|
||||||
LOG_ERROR(Service_VI, "Layer not found! layer_id={}", layer_id);
|
LOG_ERROR(Service_VI, "Layer not found! layer_id={}", layer_id);
|
||||||
R_THROW(VI::ResultNotFound);
|
R_THROW(VI::ResultNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto buffer_queue_id = m_nvnflinger.FindBufferQueueId(*display_id, layer_id);
|
const auto buffer_queue_id = m_surface_flinger->FindBufferQueueId(*display_id, layer_id);
|
||||||
if (!buffer_queue_id) {
|
if (!buffer_queue_id) {
|
||||||
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", *display_id);
|
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", *display_id);
|
||||||
R_THROW(VI::ResultNotFound);
|
R_THROW(VI::ResultNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_nvnflinger.OpenLayer(layer_id)) {
|
if (!m_surface_flinger->OpenLayer(layer_id)) {
|
||||||
LOG_WARNING(Service_VI, "Tried to open layer which was already open");
|
LOG_WARNING(Service_VI, "Tried to open layer which was already open");
|
||||||
R_THROW(VI::ResultOperationFailed);
|
R_THROW(VI::ResultOperationFailed);
|
||||||
}
|
}
|
||||||
@ -199,7 +200,7 @@ Result IApplicationDisplayService::OpenLayer(Out<u64> out_size,
|
|||||||
Result IApplicationDisplayService::CloseLayer(u64 layer_id) {
|
Result IApplicationDisplayService::CloseLayer(u64 layer_id) {
|
||||||
LOG_DEBUG(Service_VI, "called. layer_id={}", layer_id);
|
LOG_DEBUG(Service_VI, "called. layer_id={}", layer_id);
|
||||||
|
|
||||||
if (!m_nvnflinger.CloseLayer(layer_id)) {
|
if (!m_surface_flinger->CloseLayer(layer_id)) {
|
||||||
LOG_WARNING(Service_VI, "Tried to close layer which was not open");
|
LOG_WARNING(Service_VI, "Tried to close layer which was not open");
|
||||||
R_THROW(VI::ResultOperationFailed);
|
R_THROW(VI::ResultOperationFailed);
|
||||||
}
|
}
|
||||||
@ -212,14 +213,14 @@ Result IApplicationDisplayService::CreateStrayLayer(
|
|||||||
u32 flags, u64 display_id) {
|
u32 flags, u64 display_id) {
|
||||||
LOG_DEBUG(Service_VI, "called. flags={}, display_id={}", flags, display_id);
|
LOG_DEBUG(Service_VI, "called. flags={}, display_id={}", flags, display_id);
|
||||||
|
|
||||||
const auto layer_id = m_nvnflinger.CreateLayer(display_id);
|
const auto layer_id = m_surface_flinger->CreateLayer(display_id);
|
||||||
if (!layer_id) {
|
if (!layer_id) {
|
||||||
LOG_ERROR(Service_VI, "Layer not found! display_id={}", display_id);
|
LOG_ERROR(Service_VI, "Layer not found! display_id={}", display_id);
|
||||||
R_THROW(VI::ResultNotFound);
|
R_THROW(VI::ResultNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stray_layer_ids.push_back(*layer_id);
|
m_stray_layer_ids.push_back(*layer_id);
|
||||||
const auto buffer_queue_id = m_nvnflinger.FindBufferQueueId(display_id, *layer_id);
|
const auto buffer_queue_id = m_surface_flinger->FindBufferQueueId(display_id, *layer_id);
|
||||||
if (!buffer_queue_id) {
|
if (!buffer_queue_id) {
|
||||||
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", display_id);
|
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", display_id);
|
||||||
R_THROW(VI::ResultNotFound);
|
R_THROW(VI::ResultNotFound);
|
||||||
@ -240,7 +241,7 @@ Result IApplicationDisplayService::CreateStrayLayer(
|
|||||||
|
|
||||||
Result IApplicationDisplayService::DestroyStrayLayer(u64 layer_id) {
|
Result IApplicationDisplayService::DestroyStrayLayer(u64 layer_id) {
|
||||||
LOG_WARNING(Service_VI, "(STUBBED) called. layer_id={}", layer_id);
|
LOG_WARNING(Service_VI, "(STUBBED) called. layer_id={}", layer_id);
|
||||||
m_nvnflinger.DestroyLayer(layer_id);
|
m_surface_flinger->DestroyLayer(layer_id);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +249,7 @@ Result IApplicationDisplayService::GetDisplayVsyncEvent(
|
|||||||
OutCopyHandle<Kernel::KReadableEvent> out_vsync_event, u64 display_id) {
|
OutCopyHandle<Kernel::KReadableEvent> out_vsync_event, u64 display_id) {
|
||||||
LOG_DEBUG(Service_VI, "called. display_id={}", display_id);
|
LOG_DEBUG(Service_VI, "called. display_id={}", display_id);
|
||||||
|
|
||||||
const auto result = m_nvnflinger.FindVsyncEvent(out_vsync_event, display_id);
|
const auto result = m_surface_flinger->FindVsyncEvent(out_vsync_event, display_id);
|
||||||
if (result != ResultSuccess) {
|
if (result != ResultSuccess) {
|
||||||
if (result == ResultNotFound) {
|
if (result == ResultNotFound) {
|
||||||
LOG_ERROR(Service_VI, "Vsync event was not found for display_id={}", display_id);
|
LOG_ERROR(Service_VI, "Vsync event was not found for display_id={}", display_id);
|
||||||
|
@ -9,26 +9,30 @@ namespace Kernel {
|
|||||||
class KReadableEvent;
|
class KReadableEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Service::Nvnflinger {
|
||||||
|
class Nvnflinger;
|
||||||
|
class IHOSBinderDriver;
|
||||||
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
class IHOSBinderDriver;
|
|
||||||
class IManagerDisplayService;
|
class IManagerDisplayService;
|
||||||
class ISystemDisplayService;
|
class ISystemDisplayService;
|
||||||
|
|
||||||
class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
|
class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
|
||||||
public:
|
public:
|
||||||
IApplicationDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
IApplicationDisplayService(Core::System& system_,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service);
|
||||||
~IApplicationDisplayService() override;
|
~IApplicationDisplayService() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Result GetRelayService(Out<SharedPointer<IHOSBinderDriver>> out_relay_service);
|
Result GetRelayService(Out<SharedPointer<Nvnflinger::IHOSBinderDriver>> out_relay_service);
|
||||||
Result GetSystemDisplayService(
|
Result GetSystemDisplayService(
|
||||||
Out<SharedPointer<ISystemDisplayService>> out_system_display_service);
|
Out<SharedPointer<ISystemDisplayService>> out_system_display_service);
|
||||||
Result GetManagerDisplayService(
|
Result GetManagerDisplayService(
|
||||||
Out<SharedPointer<IManagerDisplayService>> out_manager_display_service);
|
Out<SharedPointer<IManagerDisplayService>> out_manager_display_service);
|
||||||
Result GetIndirectDisplayTransactionService(
|
Result GetIndirectDisplayTransactionService(
|
||||||
Out<SharedPointer<IHOSBinderDriver>> out_indirect_display_transaction_service);
|
Out<SharedPointer<Nvnflinger::IHOSBinderDriver>> out_indirect_display_transaction_service);
|
||||||
Result OpenDisplay(Out<u64> out_display_id, DisplayName display_name);
|
Result OpenDisplay(Out<u64> out_display_id, DisplayName display_name);
|
||||||
Result OpenDefaultDisplay(Out<u64> out_display_id);
|
Result OpenDefaultDisplay(Out<u64> out_display_id);
|
||||||
Result CloseDisplay(u64 display_id);
|
Result CloseDisplay(u64 display_id);
|
||||||
@ -56,8 +60,8 @@ private:
|
|||||||
s64 width, s64 height);
|
s64 width, s64 height);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
const std::shared_ptr<Nvnflinger::IHOSBinderDriver> m_binder_service;
|
||||||
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
const std::shared_ptr<Nvnflinger::Nvnflinger> m_surface_flinger;
|
||||||
std::vector<u64> m_stray_layer_ids;
|
std::vector<u64> m_stray_layer_ids;
|
||||||
bool m_vsync_event_fetched{false};
|
bool m_vsync_event_fetched{false};
|
||||||
};
|
};
|
||||||
|
@ -11,10 +11,8 @@
|
|||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
IApplicationRootService::IApplicationRootService(
|
IApplicationRootService::IApplicationRootService(
|
||||||
Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
Core::System& system_, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service)
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
: ServiceFramework{system_, "vi:u"}, m_binder_service{std::move(binder_service)} {
|
||||||
: ServiceFramework{system_, "vi:u"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
|
|
||||||
hos_binder_driver_server} {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"},
|
{0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"},
|
||||||
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
@ -27,8 +25,8 @@ IApplicationRootService::~IApplicationRootService() = default;
|
|||||||
Result IApplicationRootService::GetDisplayService(
|
Result IApplicationRootService::GetDisplayService(
|
||||||
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
||||||
LOG_DEBUG(Service_VI, "called");
|
LOG_DEBUG(Service_VI, "called");
|
||||||
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
|
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_binder_service,
|
||||||
m_hos_binder_driver_server, Permission::User, policy));
|
Permission::User, policy));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -11,8 +11,7 @@ class System;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
namespace Service::Nvnflinger {
|
||||||
class HosBinderDriverServer;
|
class IHOSBinderDriver;
|
||||||
class Nvnflinger;
|
|
||||||
} // namespace Service::Nvnflinger
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
@ -22,8 +21,8 @@ enum class Policy : u32;
|
|||||||
|
|
||||||
class IApplicationRootService final : public ServiceFramework<IApplicationRootService> {
|
class IApplicationRootService final : public ServiceFramework<IApplicationRootService> {
|
||||||
public:
|
public:
|
||||||
explicit IApplicationRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
explicit IApplicationRootService(Core::System& system_,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service);
|
||||||
~IApplicationRootService() override;
|
~IApplicationRootService() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -32,8 +31,7 @@ private:
|
|||||||
Policy policy);
|
Policy policy);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
const std::shared_ptr<Nvnflinger::IHOSBinderDriver> m_binder_service;
|
||||||
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -8,9 +8,10 @@
|
|||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
IManagerDisplayService::IManagerDisplayService(Core::System& system_,
|
IManagerDisplayService::IManagerDisplayService(
|
||||||
Nvnflinger::Nvnflinger& nvnflinger)
|
Core::System& system_, std::shared_ptr<Nvnflinger::Nvnflinger> surface_flinger)
|
||||||
: ServiceFramework{system_, "IManagerDisplayService"}, m_nvnflinger{nvnflinger} {
|
: ServiceFramework{system_, "IManagerDisplayService"},
|
||||||
|
m_surface_flinger{std::move(surface_flinger)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{200, nullptr, "AllocateProcessHeapBlock"},
|
{200, nullptr, "AllocateProcessHeapBlock"},
|
||||||
@ -107,7 +108,7 @@ Result IManagerDisplayService::CreateManagedLayer(Out<u64> out_layer_id, u32 unk
|
|||||||
LOG_WARNING(Service_VI, "(STUBBED) called. unknown={}, display={}, aruid={}", unknown,
|
LOG_WARNING(Service_VI, "(STUBBED) called. unknown={}, display={}, aruid={}", unknown,
|
||||||
display_id, aruid.pid);
|
display_id, aruid.pid);
|
||||||
|
|
||||||
const auto layer_id = m_nvnflinger.CreateLayer(display_id);
|
const auto layer_id = m_surface_flinger->CreateLayer(display_id);
|
||||||
if (!layer_id) {
|
if (!layer_id) {
|
||||||
LOG_ERROR(Service_VI, "Layer not found! display={}", display_id);
|
LOG_ERROR(Service_VI, "Layer not found! display={}", display_id);
|
||||||
R_THROW(VI::ResultNotFound);
|
R_THROW(VI::ResultNotFound);
|
||||||
|
@ -8,7 +8,8 @@ namespace Service::VI {
|
|||||||
|
|
||||||
class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {
|
class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {
|
||||||
public:
|
public:
|
||||||
explicit IManagerDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger);
|
explicit IManagerDisplayService(Core::System& system_,
|
||||||
|
std::shared_ptr<Nvnflinger::Nvnflinger> surface_flinger);
|
||||||
~IManagerDisplayService() override;
|
~IManagerDisplayService() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -18,7 +19,7 @@ private:
|
|||||||
Result SetLayerVisibility(bool visible, u64 layer_id);
|
Result SetLayerVisibility(bool visible, u64 layer_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
const std::shared_ptr<Nvnflinger::Nvnflinger> m_surface_flinger;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -11,10 +11,8 @@
|
|||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
IManagerRootService::IManagerRootService(
|
IManagerRootService::IManagerRootService(
|
||||||
Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
Core::System& system_, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service)
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
: ServiceFramework{system_, "vi:m"}, m_binder_service{std::move(binder_service)} {
|
||||||
: ServiceFramework{system_, "vi:m"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
|
|
||||||
hos_binder_driver_server} {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"},
|
{2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"},
|
||||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
@ -31,8 +29,8 @@ IManagerRootService::~IManagerRootService() = default;
|
|||||||
Result IManagerRootService::GetDisplayService(
|
Result IManagerRootService::GetDisplayService(
|
||||||
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
||||||
LOG_DEBUG(Service_VI, "called");
|
LOG_DEBUG(Service_VI, "called");
|
||||||
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
|
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_binder_service,
|
||||||
m_hos_binder_driver_server, Permission::Manager, policy));
|
Permission::Manager, policy));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -11,8 +11,7 @@ class System;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
namespace Service::Nvnflinger {
|
||||||
class HosBinderDriverServer;
|
class IHOSBinderDriver;
|
||||||
class Nvnflinger;
|
|
||||||
} // namespace Service::Nvnflinger
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
@ -22,8 +21,8 @@ enum class Policy : u32;
|
|||||||
|
|
||||||
class IManagerRootService final : public ServiceFramework<IManagerRootService> {
|
class IManagerRootService final : public ServiceFramework<IManagerRootService> {
|
||||||
public:
|
public:
|
||||||
explicit IManagerRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
explicit IManagerRootService(Core::System& system_,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service);
|
||||||
~IManagerRootService() override;
|
~IManagerRootService() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -31,8 +30,7 @@ private:
|
|||||||
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
|
||||||
Policy policy);
|
Policy policy);
|
||||||
|
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
const std::shared_ptr<Nvnflinger::IHOSBinderDriver> m_binder_service;
|
||||||
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -22,9 +22,8 @@ static bool IsValidServiceAccess(Permission permission, Policy policy) {
|
|||||||
|
|
||||||
Result GetApplicationDisplayService(
|
Result GetApplicationDisplayService(
|
||||||
std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
|
std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
|
||||||
Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
|
Core::System& system, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server, Permission permission,
|
Permission permission, Policy policy) {
|
||||||
Policy policy) {
|
|
||||||
|
|
||||||
if (!IsValidServiceAccess(permission, policy)) {
|
if (!IsValidServiceAccess(permission, policy)) {
|
||||||
LOG_ERROR(Service_VI, "Permission denied for policy {}", policy);
|
LOG_ERROR(Service_VI, "Permission denied for policy {}", policy);
|
||||||
@ -32,7 +31,7 @@ Result GetApplicationDisplayService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
*out_application_display_service =
|
*out_application_display_service =
|
||||||
std::make_shared<IApplicationDisplayService>(system, nvnflinger, hos_binder_driver_server);
|
std::make_shared<IApplicationDisplayService>(system, binder_service);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,7 @@ class System;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
namespace Service::Nvnflinger {
|
||||||
class HosBinderDriverServer;
|
class IHOSBinderDriver;
|
||||||
class Nvnflinger;
|
|
||||||
} // namespace Service::Nvnflinger
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
union Result;
|
union Result;
|
||||||
@ -26,8 +25,7 @@ enum class Policy : u32;
|
|||||||
|
|
||||||
Result GetApplicationDisplayService(
|
Result GetApplicationDisplayService(
|
||||||
std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
|
std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
|
||||||
Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
|
Core::System& system, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server, Permission permission,
|
Permission permission, Policy policy);
|
||||||
Policy policy);
|
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
ISystemDisplayService::ISystemDisplayService(Core::System& system_,
|
ISystemDisplayService::ISystemDisplayService(
|
||||||
Nvnflinger::Nvnflinger& nvnflinger)
|
Core::System& system_, std::shared_ptr<Nvnflinger::Nvnflinger> surface_flinger)
|
||||||
: ServiceFramework{system_, "ISystemDisplayService"}, m_nvnflinger{nvnflinger} {
|
: ServiceFramework{system_, "ISystemDisplayService"},
|
||||||
|
m_surface_flinger{std::move(surface_flinger)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{1200, nullptr, "GetZOrderCountMin"},
|
{1200, nullptr, "GetZOrderCountMin"},
|
||||||
@ -104,7 +105,7 @@ Result ISystemDisplayService::GetSharedBufferMemoryHandleId(
|
|||||||
u64 buffer_id, ClientAppletResourceUserId aruid) {
|
u64 buffer_id, ClientAppletResourceUserId aruid) {
|
||||||
LOG_INFO(Service_VI, "called. buffer_id={}, aruid={:#x}", buffer_id, aruid.pid);
|
LOG_INFO(Service_VI, "called. buffer_id={}, aruid={:#x}", buffer_id, aruid.pid);
|
||||||
|
|
||||||
R_RETURN(m_nvnflinger.GetSystemBufferManager().GetSharedBufferMemoryHandleId(
|
R_RETURN(m_surface_flinger->GetSystemBufferManager().GetSharedBufferMemoryHandleId(
|
||||||
out_size, out_nvmap_handle, out_pool_layout, buffer_id, aruid.pid));
|
out_size, out_nvmap_handle, out_pool_layout, buffer_id, aruid.pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ Result ISystemDisplayService::AcquireSharedFrameBuffer(Out<android::Fence> out_f
|
|||||||
Out<std::array<s32, 4>> out_slots,
|
Out<std::array<s32, 4>> out_slots,
|
||||||
Out<s64> out_target_slot, u64 layer_id) {
|
Out<s64> out_target_slot, u64 layer_id) {
|
||||||
LOG_DEBUG(Service_VI, "called");
|
LOG_DEBUG(Service_VI, "called");
|
||||||
R_RETURN(m_nvnflinger.GetSystemBufferManager().AcquireSharedFrameBuffer(
|
R_RETURN(m_surface_flinger->GetSystemBufferManager().AcquireSharedFrameBuffer(
|
||||||
out_fence, *out_slots, out_target_slot, layer_id));
|
out_fence, *out_slots, out_target_slot, layer_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,15 +132,15 @@ Result ISystemDisplayService::PresentSharedFrameBuffer(android::Fence fence,
|
|||||||
u32 window_transform, s32 swap_interval,
|
u32 window_transform, s32 swap_interval,
|
||||||
u64 layer_id, s64 surface_id) {
|
u64 layer_id, s64 surface_id) {
|
||||||
LOG_DEBUG(Service_VI, "called");
|
LOG_DEBUG(Service_VI, "called");
|
||||||
R_RETURN(m_nvnflinger.GetSystemBufferManager().PresentSharedFrameBuffer(
|
R_RETURN(m_surface_flinger->GetSystemBufferManager().PresentSharedFrameBuffer(
|
||||||
fence, crop_region, window_transform, swap_interval, layer_id, surface_id));
|
fence, crop_region, window_transform, swap_interval, layer_id, surface_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ISystemDisplayService::GetSharedFrameBufferAcquirableEvent(
|
Result ISystemDisplayService::GetSharedFrameBufferAcquirableEvent(
|
||||||
OutCopyHandle<Kernel::KReadableEvent> out_event, u64 layer_id) {
|
OutCopyHandle<Kernel::KReadableEvent> out_event, u64 layer_id) {
|
||||||
LOG_DEBUG(Service_VI, "called");
|
LOG_DEBUG(Service_VI, "called");
|
||||||
R_RETURN(m_nvnflinger.GetSystemBufferManager().GetSharedFrameBufferAcquirableEvent(out_event,
|
R_RETURN(m_surface_flinger->GetSystemBufferManager().GetSharedFrameBufferAcquirableEvent(
|
||||||
layer_id));
|
out_event, layer_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -7,14 +7,16 @@
|
|||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
namespace Service::Nvnflinger {
|
||||||
|
class Nvnflinger;
|
||||||
struct SharedMemoryPoolLayout;
|
struct SharedMemoryPoolLayout;
|
||||||
}
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
|
class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
|
||||||
public:
|
public:
|
||||||
explicit ISystemDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger);
|
explicit ISystemDisplayService(Core::System& system_,
|
||||||
|
std::shared_ptr<Nvnflinger::Nvnflinger> surface_flinger);
|
||||||
~ISystemDisplayService() override;
|
~ISystemDisplayService() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -39,7 +41,7 @@ private:
|
|||||||
s64 surface_id);
|
s64 surface_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
const std::shared_ptr<Nvnflinger::Nvnflinger> m_surface_flinger;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -10,10 +10,9 @@
|
|||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
ISystemRootService::ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
ISystemRootService::ISystemRootService(Core::System& system_,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
|
std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service)
|
||||||
: ServiceFramework{system_, "vi:s"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
|
: ServiceFramework{system_, "vi:s"}, m_binder_service{std::move(binder_service)} {
|
||||||
hos_binder_driver_server} {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"},
|
{1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"},
|
||||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
@ -26,8 +25,8 @@ ISystemRootService::~ISystemRootService() = default;
|
|||||||
Result ISystemRootService::GetDisplayService(
|
Result ISystemRootService::GetDisplayService(
|
||||||
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
|
||||||
LOG_DEBUG(Service_VI, "called");
|
LOG_DEBUG(Service_VI, "called");
|
||||||
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
|
R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_binder_service,
|
||||||
m_hos_binder_driver_server, Permission::System, policy));
|
Permission::System, policy));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -11,8 +11,7 @@ class System;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
namespace Service::Nvnflinger {
|
||||||
class HosBinderDriverServer;
|
class IHOSBinderDriver;
|
||||||
class Nvnflinger;
|
|
||||||
} // namespace Service::Nvnflinger
|
} // namespace Service::Nvnflinger
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
@ -22,8 +21,8 @@ enum class Policy : u32;
|
|||||||
|
|
||||||
class ISystemRootService final : public ServiceFramework<ISystemRootService> {
|
class ISystemRootService final : public ServiceFramework<ISystemRootService> {
|
||||||
public:
|
public:
|
||||||
explicit ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
|
explicit ISystemRootService(Core::System& system_,
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service);
|
||||||
~ISystemRootService() override;
|
~ISystemRootService() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -31,8 +30,7 @@ private:
|
|||||||
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
|
Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
|
||||||
Policy policy);
|
Policy policy);
|
||||||
|
|
||||||
Nvnflinger::Nvnflinger& m_nvnflinger;
|
const std::shared_ptr<Nvnflinger::IHOSBinderDriver> m_binder_service;
|
||||||
Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
// 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 "core/core.h"
|
||||||
|
#include "core/hle/service/nvnflinger/hos_binder_driver.h"
|
||||||
#include "core/hle/service/server_manager.h"
|
#include "core/hle/service/server_manager.h"
|
||||||
|
#include "core/hle/service/sm/sm.h"
|
||||||
#include "core/hle/service/vi/application_display_service.h"
|
#include "core/hle/service/vi/application_display_service.h"
|
||||||
#include "core/hle/service/vi/application_root_service.h"
|
#include "core/hle/service/vi/application_root_service.h"
|
||||||
#include "core/hle/service/vi/manager_root_service.h"
|
#include "core/hle/service/vi/manager_root_service.h"
|
||||||
@ -10,16 +13,17 @@
|
|||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
void LoopProcess(Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
|
void LoopProcess(Core::System& system) {
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server) {
|
const auto binder_service =
|
||||||
|
system.ServiceManager().GetService<Nvnflinger::IHOSBinderDriver>("dispdrv", true);
|
||||||
auto server_manager = std::make_unique<ServerManager>(system);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
server_manager->RegisterNamedService("vi:m", std::make_shared<IManagerRootService>(
|
|
||||||
system, nvnflinger, hos_binder_driver_server));
|
|
||||||
server_manager->RegisterNamedService(
|
server_manager->RegisterNamedService(
|
||||||
"vi:s", std::make_shared<ISystemRootService>(system, nvnflinger, hos_binder_driver_server));
|
"vi:m", std::make_shared<IManagerRootService>(system, binder_service));
|
||||||
server_manager->RegisterNamedService("vi:u", std::make_shared<IApplicationRootService>(
|
server_manager->RegisterNamedService(
|
||||||
system, nvnflinger, hos_binder_driver_server));
|
"vi:s", std::make_shared<ISystemRootService>(system, binder_service));
|
||||||
|
server_manager->RegisterNamedService(
|
||||||
|
"vi:u", std::make_shared<IApplicationRootService>(system, binder_service));
|
||||||
ServerManager::RunServer(std::move(server_manager));
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,14 +7,8 @@ namespace Core {
|
|||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::Nvnflinger {
|
|
||||||
class HosBinderDriverServer;
|
|
||||||
class Nvnflinger;
|
|
||||||
} // namespace Service::Nvnflinger
|
|
||||||
|
|
||||||
namespace Service::VI {
|
namespace Service::VI {
|
||||||
|
|
||||||
void LoopProcess(Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
|
void LoopProcess(Core::System& system);
|
||||||
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
|
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
Loading…
Reference in New Issue
Block a user