summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv
diff options
context:
space:
mode:
authorVonChenPlus <vonchenplus@gmail.com>2022-06-27 06:39:57 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2022-10-06 21:00:53 +0200
commit9982cff98b4db38565715cc515ea496b6195725b (patch)
tree08ac644dcb6d51b4deda281133fa31b40b7cc3d7 /src/core/hle/service/nvdrv
parentGeneral: Fix clang format. (diff)
downloadyuzu-9982cff98b4db38565715cc515ea496b6195725b.tar
yuzu-9982cff98b4db38565715cc515ea496b6195725b.tar.gz
yuzu-9982cff98b4db38565715cc515ea496b6195725b.tar.bz2
yuzu-9982cff98b4db38565715cc515ea496b6195725b.tar.lz
yuzu-9982cff98b4db38565715cc515ea496b6195725b.tar.xz
yuzu-9982cff98b4db38565715cc515ea496b6195725b.tar.zst
yuzu-9982cff98b4db38565715cc515ea496b6195725b.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/nvdrv/core/nvmap.cpp15
-rw-r--r--src/core/hle/service/nvdrv/core/nvmap.h5
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.cpp12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.h5
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h3
5 files changed, 20 insertions, 20 deletions
diff --git a/src/core/hle/service/nvdrv/core/nvmap.cpp b/src/core/hle/service/nvdrv/core/nvmap.cpp
index b02dbb9c9..dd30e156e 100644
--- a/src/core/hle/service/nvdrv/core/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/core/nvmap.cpp
@@ -207,6 +207,19 @@ void NvMap::UnpinHandle(Handle::Id handle) {
}
}
+void NvMap::DuplicateHandle(Handle::Id handle) {
+ auto handle_description{GetHandle(handle)};
+ if (!handle_description) {
+ LOG_CRITICAL(Service_NVDRV, "Unregistered handle!");
+ return;
+ }
+
+ auto result = handle_description->Duplicate(false);
+ if (result != NvResult::Success) {
+ LOG_CRITICAL(Service_NVDRV, "Could not duplicate handle!");
+ }
+}
+
std::optional<NvMap::FreeInfo> NvMap::FreeHandle(Handle::Id handle, bool internal_session) {
std::weak_ptr<Handle> hWeak{GetHandle(handle)};
FreeInfo freeInfo;
@@ -254,7 +267,7 @@ std::optional<NvMap::FreeInfo> NvMap::FreeHandle(Handle::Id handle, bool interna
// Handle hasn't been freed from memory, set address to 0 to mark that the handle wasn't freed
if (!hWeak.expired()) {
- LOG_ERROR(Service_NVDRV, "nvmap handle: {} wasn't freed as it is still in use", handle);
+ LOG_DEBUG(Service_NVDRV, "nvmap handle: {} wasn't freed as it is still in use", handle);
freeInfo.address = 0;
}
diff --git a/src/core/hle/service/nvdrv/core/nvmap.h b/src/core/hle/service/nvdrv/core/nvmap.h
index 1082bb58d..b6613a521 100644
--- a/src/core/hle/service/nvdrv/core/nvmap.h
+++ b/src/core/hle/service/nvdrv/core/nvmap.h
@@ -163,6 +163,11 @@ public:
void UnpinHandle(Handle::Id handle);
/**
+ * @brief Tries to duplicate a handle
+ */
+ void DuplicateHandle(Handle::Id handle);
+
+ /**
* @brief Tries to free a handle and remove a single dupe
* @note If a handle has no dupes left and has no other users a FreeInfo struct will be returned
* describing the prior state of the handle
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp
index f84fc8c37..ddf273b5e 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp
@@ -69,18 +69,6 @@ NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
void nvmap::OnOpen(DeviceFD fd) {}
void nvmap::OnClose(DeviceFD fd) {}
-VAddr nvmap::GetObjectAddress(u32 handle) const {
- auto obj = file.GetHandle(handle);
- if (obj) {
- return obj->address;
- }
- return 0;
-}
-
-std::shared_ptr<NvCore::NvMap::Handle> nvmap::GetObject(u32 handle) const {
- return file.GetHandle(handle);
-}
-
NvResult nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) {
IocCreateParams params;
std::memcpy(&params, input.data(), sizeof(params));
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h
index c22eb57a4..52e1d7cff 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.h
+++ b/src/core/hle/service/nvdrv/devices/nvmap.h
@@ -36,11 +36,6 @@ public:
void OnOpen(DeviceFD fd) override;
void OnClose(DeviceFD fd) override;
- /// Returns the allocated address of an nvmap object given its handle.
- VAddr GetObjectAddress(u32 handle) const;
-
- std::shared_ptr<NvCore::NvMap::Handle> GetObject(u32 handle) const;
-
enum class HandleParameterType : u32_le {
Size = 1,
Alignment = 2,
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index b26254753..22836529d 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -96,6 +96,7 @@ public:
private:
friend class EventInterface;
+ friend class Service::NVFlinger::NVFlinger;
/// Id to use for the next open file descriptor.
DeviceFD next_fd = 1;
@@ -111,8 +112,6 @@ private:
/// Manages syncpoints on the host
NvCore::Container container;
- void CreateEvent(u32 event_id);
- void FreeEvent(u32 event_id);
std::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
};