diff options
| author | Sebastian Valle <subv2112@gmail.com> | 2018-07-02 14:07:17 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-02 14:07:17 -0500 |
| commit | 79167fc989f682ce54877df0ffc0d5b73d4aaed9 (patch) | |
| tree | ff9994a63f8ad5c8ddd8840a263dcdfee85ae119 /src/core/hle/service/nvdrv/devices/nvmap.cpp | |
| parent | 9685dd5840209ffe7cddfe70531c296001c43f06 (diff) | |
| parent | 6c0c81dfdc49c1e9dba9af778b9d6d7cf2008ae5 (diff) | |
Merge pull request #603 from Subv/nvmap_free
GPU: Remove unmapped surfaces from the rasterizer cache and fix our nvmap::Free behavior.
Diffstat (limited to 'src/core/hle/service/nvdrv/devices/nvmap.cpp')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvmap.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 23fe98190..2fc7c87e0 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp @@ -148,6 +148,7 @@ u32 nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output) { } u32 nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) { + // TODO(Subv): These flags are unconfirmed. enum FreeFlags { Freed = 0, NotFreedYet = 1, @@ -161,15 +162,21 @@ u32 nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) { auto itr = handles.find(params.handle); ASSERT(itr != handles.end()); + ASSERT(itr->second->refcount > 0); + itr->second->refcount--; - params.refcount = itr->second->refcount; params.size = itr->second->size; - if (itr->second->refcount == 0) + if (itr->second->refcount == 0) { params.flags = Freed; - else + // The address of the nvmap is written to the output if we're finally freeing it, otherwise + // 0 is written. + params.address = itr->second->addr; + } else { params.flags = NotFreedYet; + params.address = 0; + } handles.erase(params.handle); |
