early-access version 3058

This commit is contained in:
pineappleEA
2022-10-27 22:53:47 +02:00
parent 46450366f5
commit 6e35cb128e
9 changed files with 46 additions and 11 deletions

View File

@@ -742,6 +742,13 @@ Status BufferQueueProducer::Disconnect(NativeWindowApi api) {
return Status::NoError;
}
// HACK: We are not Android. Remove handle for items in queue, and clear queue.
// Allows synchronous destruction of nvmap handles.
for (auto& item : core->queue) {
nvmap.FreeHandle(item.graphic_buffer->BufferId(), true);
}
core->queue.clear();
switch (api) {
case NativeWindowApi::Egl:
case NativeWindowApi::Cpu:

View File

@@ -138,6 +138,19 @@ std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) {
return itr->GetID();
}
bool NVFlinger::CloseDisplay(u64 display_id) {
const auto lock_guard = Lock();
auto* const display = FindDisplay(display_id);
if (display == nullptr) {
return false;
}
display->Reset();
return true;
}
std::optional<u64> NVFlinger::CreateLayer(u64 display_id) {
const auto lock_guard = Lock();
auto* const display = FindDisplay(display_id);

View File

@@ -58,6 +58,11 @@ public:
/// If an invalid display name is provided, then an empty optional is returned.
[[nodiscard]] std::optional<u64> OpenDisplay(std::string_view name);
/// Closes the specified display by its ID.
///
/// Returns false if an invalid display ID is provided.
[[nodiscard]] bool CloseDisplay(u64 display_id);
/// Creates a layer on the specified display and returns the layer ID.
///
/// If an invalid display ID is specified, then an empty optional is returned.