Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
52549242
There was an error fetching the commit references. Please try again later.
Commit
52549242
authored
6 years ago
by
Subv
Browse files
Options
Downloads
Patches
Plain Diff
GPU: Implemented the nvmap Free ioctl.
It releases a reference to an nvmap object
parent
72b5c448
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/hle/service/nvdrv/devices/nvmap.cpp
+35
-0
35 additions, 0 deletions
src/core/hle/service/nvdrv/devices/nvmap.cpp
src/core/hle/service/nvdrv/devices/nvmap.h
+13
-1
13 additions, 1 deletion
src/core/hle/service/nvdrv/devices/nvmap.h
with
48 additions
and
1 deletion
src/core/hle/service/nvdrv/devices/nvmap.cpp
+
35
−
0
View file @
52549242
...
...
@@ -30,6 +30,8 @@ u32 nvmap::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& o
return
IocFromId
(
input
,
output
);
case
IoctlCommand
::
Param
:
return
IocParam
(
input
,
output
);
case
IoctlCommand
::
Free
:
return
IocFree
(
input
,
output
);
}
UNIMPLEMENTED_MSG
(
"Unimplemented ioctl"
);
...
...
@@ -45,6 +47,7 @@ u32 nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) {
object
->
id
=
next_id
++
;
object
->
size
=
params
.
size
;
object
->
status
=
Object
::
Status
::
Created
;
object
->
refcount
=
1
;
u32
handle
=
next_handle
++
;
handles
[
handle
]
=
std
::
move
(
object
);
...
...
@@ -101,6 +104,8 @@ u32 nvmap::IocFromId(const std::vector<u8>& input, std::vector<u8>& output) {
[
&
](
const
auto
&
entry
)
{
return
entry
.
second
->
id
==
params
.
id
;
});
ASSERT
(
itr
!=
handles
.
end
());
itr
->
second
->
refcount
++
;
// Return the existing handle instead of creating a new one.
params
.
handle
=
itr
->
first
;
...
...
@@ -142,4 +147,34 @@ u32 nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output) {
return
0
;
}
u32
nvmap
::
IocFree
(
const
std
::
vector
<
u8
>&
input
,
std
::
vector
<
u8
>&
output
)
{
enum
FreeFlags
{
Freed
=
0
,
NotFreedYet
=
1
,
};
IocFreeParams
params
;
std
::
memcpy
(
&
params
,
input
.
data
(),
sizeof
(
params
));
NGLOG_WARNING
(
Service_NVDRV
,
"(STUBBED) called"
);
auto
itr
=
handles
.
find
(
params
.
handle
);
ASSERT
(
itr
!=
handles
.
end
());
itr
->
second
->
refcount
--
;
params
.
refcount
=
itr
->
second
->
refcount
;
params
.
size
=
itr
->
second
->
size
;
if
(
itr
->
second
->
refcount
==
0
)
params
.
flags
=
Freed
;
else
params
.
flags
=
NotFreedYet
;
handles
.
erase
(
params
.
handle
);
std
::
memcpy
(
output
.
data
(),
&
params
,
sizeof
(
params
));
return
0
;
}
}
// namespace Service::Nvidia::Devices
This diff is collapsed.
Click to expand it.
src/core/hle/service/nvdrv/devices/nvmap.h
+
13
−
1
View file @
52549242
...
...
@@ -34,6 +34,7 @@ public:
u8
kind
;
VAddr
addr
;
Status
status
;
u32
refcount
;
};
std
::
shared_ptr
<
Object
>
GetObject
(
u32
handle
)
const
{
...
...
@@ -59,7 +60,8 @@ private:
FromId
=
0xC0080103
,
Alloc
=
0xC0200104
,
Param
=
0xC00C0109
,
GetId
=
0xC008010E
GetId
=
0xC008010E
,
Free
=
0xC0180105
,
};
struct
IocCreateParams
{
...
...
@@ -102,11 +104,21 @@ private:
u32_le
value
;
};
struct
IocFreeParams
{
u32_le
handle
;
INSERT_PADDING_BYTES
(
4
);
u64_le
refcount
;
u32_le
size
;
u32_le
flags
;
};
static_assert
(
sizeof
(
IocFreeParams
)
==
24
,
"IocFreeParams has wrong size"
);
u32
IocCreate
(
const
std
::
vector
<
u8
>&
input
,
std
::
vector
<
u8
>&
output
);
u32
IocAlloc
(
const
std
::
vector
<
u8
>&
input
,
std
::
vector
<
u8
>&
output
);
u32
IocGetId
(
const
std
::
vector
<
u8
>&
input
,
std
::
vector
<
u8
>&
output
);
u32
IocFromId
(
const
std
::
vector
<
u8
>&
input
,
std
::
vector
<
u8
>&
output
);
u32
IocParam
(
const
std
::
vector
<
u8
>&
input
,
std
::
vector
<
u8
>&
output
);
u32
IocFree
(
const
std
::
vector
<
u8
>&
input
,
std
::
vector
<
u8
>&
output
);
};
}
// namespace Service::Nvidia::Devices
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment