Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
76ecea5b
Commit
76ecea5b
authored
Aug 20, 2015
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/client: tidy ctor/dtor interfaces
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
47b2505e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
67 deletions
+64
-67
drivers/gpu/drm/nouveau/include/nvkm/core/client.h
drivers/gpu/drm/nouveau/include/nvkm/core/client.h
+4
-9
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/nouveau/nouveau_drm.c
+2
-2
drivers/gpu/drm/nouveau/nouveau_nvif.c
drivers/gpu/drm/nouveau/nouveau_nvif.c
+3
-5
drivers/gpu/drm/nouveau/nvkm/core/client.c
drivers/gpu/drm/nouveau/nvkm/core/client.c
+54
-50
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+1
-1
No files found.
drivers/gpu/drm/nouveau/include/nvkm/core/client.h
View file @
76ecea5b
...
...
@@ -5,7 +5,7 @@
struct
nvkm_client
{
struct
nvkm_namedb
namedb
;
struct
nvkm_handle
*
root
;
struct
nvkm_
object
*
device
;
struct
nvkm_
device
*
device
;
char
name
[
32
];
u32
debug
;
struct
nvkm_vm
*
vm
;
...
...
@@ -34,14 +34,9 @@ nvkm_client(void *obj)
return
(
void
*
)
client
;
}
#define nvkm_client_create(n,c,oc,od,d) \
nvkm_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d)
int
nvkm_client_create_
(
const
char
*
name
,
u64
device
,
const
char
*
cfg
,
const
char
*
dbg
,
int
,
void
**
);
#define nvkm_client_destroy(p) \
nvkm_namedb_destroy(&(p)->base)
int
nvkm_client_new
(
const
char
*
name
,
u64
device
,
const
char
*
cfg
,
const
char
*
dbg
,
struct
nvkm_client
**
);
void
nvkm_client_del
(
struct
nvkm_client
**
);
int
nvkm_client_init
(
struct
nvkm_client
*
);
int
nvkm_client_fini
(
struct
nvkm_client
*
,
bool
suspend
);
const
char
*
nvkm_client_name
(
void
*
obj
);
...
...
drivers/gpu/drm/nouveau/nouveau_drm.c
View file @
76ecea5b
...
...
@@ -530,14 +530,14 @@ nouveau_drm_device_remove(struct drm_device *dev)
{
struct
nouveau_drm
*
drm
=
nouveau_drm
(
dev
);
struct
nvkm_client
*
client
;
struct
nvkm_
object
*
device
;
struct
nvkm_
device
*
device
;
dev
->
irq_enabled
=
false
;
client
=
nvxx_client
(
&
drm
->
client
.
base
);
device
=
client
->
device
;
drm_put_dev
(
dev
);
nvkm_object_ref
(
NULL
,
&
device
);
nvkm_object_ref
(
NULL
,
(
struct
nvkm_object
**
)
&
device
);
}
static
void
...
...
drivers/gpu/drm/nouveau/nouveau_nvif.c
View file @
76ecea5b
...
...
@@ -72,10 +72,8 @@ nvkm_client_suspend(void *priv)
static
void
nvkm_client_driver_fini
(
void
*
priv
)
{
struct
nvkm_object
*
client
=
priv
;
nvkm_client_fini
(
nv_client
(
client
),
false
);
atomic_set
(
&
client
->
refcount
,
1
);
nvkm_object_ref
(
NULL
,
&
client
);
struct
nvkm_client
*
client
=
priv
;
nvkm_client_del
(
&
client
);
}
static
int
...
...
@@ -113,7 +111,7 @@ nvkm_client_driver_init(const char *name, u64 device, const char *cfg,
struct
nvkm_client
*
client
;
int
ret
;
ret
=
nvkm_client_
create
(
name
,
device
,
cfg
,
dbg
,
&
client
);
ret
=
nvkm_client_
new
(
name
,
device
,
cfg
,
dbg
,
&
client
);
*
ppriv
=
client
;
if
(
ret
)
return
ret
;
...
...
drivers/gpu/drm/nouveau/nvkm/core/client.c
View file @
76ecea5b
...
...
@@ -176,43 +176,73 @@ nvkm_client_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
return
-
EINVAL
;
}
static
void
nvkm_client_dtor
(
struct
nvkm_object
*
object
)
{
struct
nvkm_client
*
client
=
(
void
*
)
object
;
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
client
->
notify
);
i
++
)
nvkm_client_notify_del
(
client
,
i
);
nvkm_object_ref
(
NULL
,
&
client
->
device
);
nvkm_handle_destroy
(
client
->
root
);
nvkm_namedb_destroy
(
&
client
->
namedb
);
}
static
struct
nvkm_oclass
nvkm_client_oclass
=
{
.
ofuncs
=
&
(
struct
nvkm_ofuncs
)
{
.
dtor
=
nvkm_client_dtor
,
.
mthd
=
nvkm_client_mthd
,
},
};
int
nvkm_client_create_
(
const
char
*
name
,
u64
devname
,
const
char
*
cfg
,
const
char
*
dbg
,
int
length
,
void
**
pobject
)
nvkm_client_fini
(
struct
nvkm_client
*
client
,
bool
suspend
)
{
struct
nvkm_object
*
object
=
&
client
->
namedb
.
parent
.
object
;
const
char
*
name
[
2
]
=
{
"fini"
,
"suspend"
};
int
ret
,
i
;
nvif_trace
(
object
,
"%s running
\n
"
,
name
[
suspend
]);
nvif_trace
(
object
,
"%s notify
\n
"
,
name
[
suspend
]);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
client
->
notify
);
i
++
)
nvkm_client_notify_put
(
client
,
i
);
nvif_trace
(
object
,
"%s object
\n
"
,
name
[
suspend
]);
ret
=
nvkm_handle_fini
(
client
->
root
,
suspend
);
nvif_trace
(
object
,
"%s completed with %d
\n
"
,
name
[
suspend
],
ret
);
return
ret
;
}
int
nvkm_client_init
(
struct
nvkm_client
*
client
)
{
struct
nvkm_object
*
object
=
&
client
->
namedb
.
parent
.
object
;
int
ret
;
nvif_trace
(
object
,
"init running
\n
"
);
ret
=
nvkm_handle_init
(
client
->
root
);
nvif_trace
(
object
,
"init completed with %d
\n
"
,
ret
);
return
ret
;
}
void
nvkm_client_del
(
struct
nvkm_client
**
pclient
)
{
struct
nvkm_client
*
client
=
*
pclient
;
int
i
;
if
(
client
)
{
nvkm_client_fini
(
client
,
false
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
client
->
notify
);
i
++
)
nvkm_client_notify_del
(
client
,
i
);
nvkm_object_ref
(
NULL
,
(
struct
nvkm_object
**
)
&
client
->
device
);
nvkm_handle_destroy
(
client
->
root
);
nvkm_namedb_destroy
(
&
client
->
namedb
);
*
pclient
=
NULL
;
}
}
int
nvkm_client_new
(
const
char
*
name
,
u64
devname
,
const
char
*
cfg
,
const
char
*
dbg
,
struct
nvkm_client
**
pclient
)
{
struct
nvkm_
object
*
device
;
struct
nvkm_
device
*
device
;
struct
nvkm_client
*
client
;
int
ret
;
device
=
(
void
*
)
nvkm_device_find
(
devname
);
device
=
nvkm_device_find
(
devname
);
if
(
!
device
)
return
-
ENODEV
;
ret
=
nvkm_namedb_create
_
(
NULL
,
NULL
,
&
nvkm_client_oclass
,
NV_CLIENT_CLASS
,
NULL
,
(
1ULL
<<
NVDEV_ENGINE_DEVICE
),
length
,
pobjec
t
);
client
=
*
pobjec
t
;
ret
=
nvkm_namedb_create
(
NULL
,
NULL
,
&
nvkm_client_oclass
,
NV_CLIENT_CLASS
,
NULL
,
(
1ULL
<<
NVDEV_ENGINE_DEVICE
),
&
clien
t
);
*
pclient
=
clien
t
;
if
(
ret
)
return
ret
;
...
...
@@ -224,39 +254,13 @@ nvkm_client_create_(const char *name, u64 devname, const char *cfg,
/* prevent init/fini being called, os in in charge of this */
atomic_set
(
&
nv_object
(
client
)
->
usecount
,
2
);
nvkm_object_ref
(
device
,
&
client
->
device
);
nvkm_object_ref
(
&
device
->
engine
.
subdev
.
object
,
(
struct
nvkm_object
**
)
&
client
->
device
);
snprintf
(
client
->
name
,
sizeof
(
client
->
name
),
"%s"
,
name
);
client
->
debug
=
nvkm_dbgopt
(
dbg
,
"CLIENT"
);
return
0
;
}
int
nvkm_client_init
(
struct
nvkm_client
*
client
)
{
struct
nvkm_object
*
object
=
&
client
->
namedb
.
parent
.
object
;
int
ret
;
nvif_trace
(
object
,
"init running
\n
"
);
ret
=
nvkm_handle_init
(
client
->
root
);
nvif_trace
(
object
,
"init completed with %d
\n
"
,
ret
);
return
ret
;
}
int
nvkm_client_fini
(
struct
nvkm_client
*
client
,
bool
suspend
)
{
struct
nvkm_object
*
object
=
&
client
->
namedb
.
parent
.
object
;
const
char
*
name
[
2
]
=
{
"fini"
,
"suspend"
};
int
ret
,
i
;
nvif_trace
(
object
,
"%s running
\n
"
,
name
[
suspend
]);
nvif_trace
(
object
,
"%s notify
\n
"
,
name
[
suspend
]);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
client
->
notify
);
i
++
)
nvkm_client_notify_put
(
client
,
i
);
nvif_trace
(
object
,
"%s object
\n
"
,
name
[
suspend
]);
ret
=
nvkm_handle_fini
(
client
->
root
,
suspend
);
nvif_trace
(
object
,
"%s completed with %d
\n
"
,
name
[
suspend
],
ret
);
return
ret
;
}
const
char
*
nvkm_client_name
(
void
*
obj
)
{
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
View file @
76ecea5b
...
...
@@ -308,7 +308,7 @@ nvkm_devobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
oclass
=
&
nvkm_devobj_oclass_super
;
/* find the device subdev that matches what the client requested */
device
=
nv_device
(
client
->
device
)
;
device
=
client
->
device
;
if
(
args
->
v0
.
device
!=
~
0
)
{
device
=
nvkm_device_find
(
args
->
v0
.
device
);
if
(
!
device
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment