summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2021-11-05 02:11:46 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2022-10-06 21:00:51 +0200
commit68d9504a046f40ce4ada54b0eba7228e659970de (patch)
tree9184a02d5154efa6284739322d4aa37e41a3a0ae /src/core/hle/service/nvdrv
parentNVDRV: Fix Open/Close and make sure each device is correctly created. (diff)
downloadyuzu-68d9504a046f40ce4ada54b0eba7228e659970de.tar
yuzu-68d9504a046f40ce4ada54b0eba7228e659970de.tar.gz
yuzu-68d9504a046f40ce4ada54b0eba7228e659970de.tar.bz2
yuzu-68d9504a046f40ce4ada54b0eba7228e659970de.tar.lz
yuzu-68d9504a046f40ce4ada54b0eba7228e659970de.tar.xz
yuzu-68d9504a046f40ce4ada54b0eba7228e659970de.tar.zst
yuzu-68d9504a046f40ce4ada54b0eba7228e659970de.zip
Diffstat (limited to 'src/core/hle/service/nvdrv')
-rw-r--r--src/core/hle/service/nvdrv/core/nvmap.cpp4
-rw-r--r--src/core/hle/service/nvdrv/core/nvmap.h1
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.cpp28
3 files changed, 18 insertions, 15 deletions
diff --git a/src/core/hle/service/nvdrv/core/nvmap.cpp b/src/core/hle/service/nvdrv/core/nvmap.cpp
index 281381cc4..1126daeb5 100644
--- a/src/core/hle/service/nvdrv/core/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/core/nvmap.cpp
@@ -11,7 +11,9 @@
using Core::Memory::YUZU_PAGESIZE;
namespace Service::Nvidia::NvCore {
-NvMap::Handle::Handle(u64 size, Id id) : size(size), aligned_size(size), orig_size(size), id(id) {}
+NvMap::Handle::Handle(u64 size, Id id) : size(size), aligned_size(size), orig_size(size), id(id) {
+ flags.raw = 0;
+}
NvResult NvMap::Handle::Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress) {
std::scoped_lock lock(mutex);
diff --git a/src/core/hle/service/nvdrv/core/nvmap.h b/src/core/hle/service/nvdrv/core/nvmap.h
index 994c70e6f..5e6c73589 100644
--- a/src/core/hle/service/nvdrv/core/nvmap.h
+++ b/src/core/hle/service/nvdrv/core/nvmap.h
@@ -44,6 +44,7 @@ public:
std::optional<typename std::list<std::shared_ptr<Handle>>::iterator> unmap_queue_entry{};
union Flags {
+ u32 raw;
BitField<0, 1, u32> map_uncached; //!< If the handle should be mapped as uncached
BitField<2, 1, u32> keep_uncached_after_free; //!< Only applicable when the handle was
//!< allocated with a fixed address
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp
index 2aee68f5c..57f58055d 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp
@@ -82,7 +82,7 @@ std::shared_ptr<NvCore::NvMap::Handle> nvmap::GetObject(u32 handle) const {
NvResult nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) {
IocCreateParams params;
std::memcpy(&params, input.data(), sizeof(params));
- LOG_WARNING(Service_NVDRV, "called, size=0x{:08X}", params.size);
+ LOG_DEBUG(Service_NVDRV, "called, size=0x{:08X}", params.size);
std::shared_ptr<NvCore::NvMap::Handle> handle_description{};
auto result =
@@ -102,7 +102,7 @@ NvResult nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output)
NvResult nvmap::IocAlloc(const std::vector<u8>& input, std::vector<u8>& output) {
IocAllocParams params;
std::memcpy(&params, input.data(), sizeof(params));
- LOG_WARNING(Service_NVDRV, "called, addr={:X}", params.address);
+ LOG_DEBUG(Service_NVDRV, "called, addr={:X}", params.address);
if (!params.handle) {
LOG_CRITICAL(Service_NVDRV, "Handle is 0");
@@ -144,7 +144,7 @@ NvResult nvmap::IocGetId(const std::vector<u8>& input, std::vector<u8>& output)
IocGetIdParams params;
std::memcpy(&params, input.data(), sizeof(params));
- LOG_WARNING(Service_NVDRV, "called");
+ LOG_DEBUG(Service_NVDRV, "called");
// See the comment in FromId for extra info on this function
if (!params.handle) {
@@ -168,26 +168,26 @@ NvResult nvmap::IocFromId(const std::vector<u8>& input, std::vector<u8>& output)
IocFromIdParams params;
std::memcpy(&params, input.data(), sizeof(params));
- LOG_WARNING(Service_NVDRV, "called, id:{}");
+ LOG_DEBUG(Service_NVDRV, "called, id:{}");
// Handles and IDs are always the same value in nvmap however IDs can be used globally given the
// right permissions.
// Since we don't plan on ever supporting multiprocess we can skip implementing handle refs and
// so this function just does simple validation and passes through the handle id.
if (!params.id) {
- LOG_CRITICAL(Service_NVDRV, "Error!");
+ LOG_CRITICAL(Service_NVDRV, "Zero Id is invalid!");
return NvResult::BadValue;
}
auto handle_description{file.GetHandle(params.id)};
if (!handle_description) {
- LOG_CRITICAL(Service_NVDRV, "Error!");
+ LOG_CRITICAL(Service_NVDRV, "Unregistered handle!");
return NvResult::BadValue;
}
auto result = handle_description->Duplicate(false);
if (result != NvResult::Success) {
- LOG_CRITICAL(Service_NVDRV, "Error!");
+ LOG_CRITICAL(Service_NVDRV, "Could not duplicate handle!");
return result;
}
params.handle = handle_description->id;
@@ -201,16 +201,16 @@ NvResult nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output)
IocParamParams params;
std::memcpy(&params, input.data(), sizeof(params));
- LOG_WARNING(Service_NVDRV, "called type={}", params.param);
+ LOG_DEBUG(Service_NVDRV, "called type={}", params.param);
if (!params.handle) {
- LOG_CRITICAL(Service_NVDRV, "Error!");
+ LOG_CRITICAL(Service_NVDRV, "Invalid handle!");
return NvResult::BadValue;
}
auto handle_description{file.GetHandle(params.handle)};
if (!handle_description) {
- LOG_CRITICAL(Service_NVDRV, "Error!");
+ LOG_CRITICAL(Service_NVDRV, "Not registered handle!");
return NvResult::BadValue;
}
@@ -228,7 +228,7 @@ NvResult nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output)
if (handle_description->allocated)
params.result = 0x40000000;
else
- params.result = 0x40000000;
+ params.result = 0;
break;
case HandleParameterType::Kind:
params.result = handle_description->kind;
@@ -248,7 +248,7 @@ NvResult nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) {
IocFreeParams params;
std::memcpy(&params, input.data(), sizeof(params));
- LOG_WARNING(Service_NVDRV, "called");
+ LOG_DEBUG(Service_NVDRV, "called");
if (!params.handle) {
LOG_CRITICAL(Service_NVDRV, "Handle null freed?");
@@ -258,10 +258,10 @@ NvResult nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) {
if (auto freeInfo{file.FreeHandle(params.handle, false)}) {
params.address = freeInfo->address;
params.size = static_cast<u32>(freeInfo->size);
- params.flags = NvCore::NvMap::Handle::Flags{.map_uncached = freeInfo->was_uncached};
+ params.flags.raw = 0;
+ params.flags.map_uncached = freeInfo->was_uncached;
} else {
// This is possible when there's internel dups or other duplicates.
- LOG_CRITICAL(Service_NVDRV, "Not freed");
}
std::memcpy(output.data(), &params, sizeof(params));