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
4d681b66
Commit
4d681b66
authored
Aug 10, 2014
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/core: move handle-based object apis to handle.c
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
f5ee92f0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
135 additions
and
120 deletions
+135
-120
drivers/gpu/drm/nouveau/core/core/handle.c
drivers/gpu/drm/nouveau/core/core/handle.c
+113
-0
drivers/gpu/drm/nouveau/core/core/object.c
drivers/gpu/drm/nouveau/core/core/object.c
+0
-116
drivers/gpu/drm/nouveau/core/include/core/handle.h
drivers/gpu/drm/nouveau/core/include/core/handle.h
+5
-0
drivers/gpu/drm/nouveau/core/include/core/object.h
drivers/gpu/drm/nouveau/core/include/core/object.h
+17
-4
No files found.
drivers/gpu/drm/nouveau/core/core/handle.c
View file @
4d681b66
...
@@ -224,3 +224,116 @@ nouveau_handle_put(struct nouveau_handle *handle)
...
@@ -224,3 +224,116 @@ nouveau_handle_put(struct nouveau_handle *handle)
if
(
handle
)
if
(
handle
)
nouveau_namedb_put
(
handle
);
nouveau_namedb_put
(
handle
);
}
}
int
nouveau_handle_new
(
struct
nouveau_object
*
client
,
u32
_parent
,
u32
_handle
,
u16
_oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
pobject
)
{
struct
nouveau_object
*
parent
=
NULL
;
struct
nouveau_object
*
engctx
=
NULL
;
struct
nouveau_object
*
object
=
NULL
;
struct
nouveau_object
*
engine
;
struct
nouveau_oclass
*
oclass
;
struct
nouveau_handle
*
handle
;
int
ret
;
/* lookup parent object and ensure it *is* a parent */
parent
=
nouveau_handle_ref
(
client
,
_parent
);
if
(
!
parent
)
{
nv_error
(
client
,
"parent 0x%08x not found
\n
"
,
_parent
);
return
-
ENOENT
;
}
if
(
!
nv_iclass
(
parent
,
NV_PARENT_CLASS
))
{
nv_error
(
parent
,
"cannot have children
\n
"
);
ret
=
-
EINVAL
;
goto
fail_class
;
}
/* check that parent supports the requested subclass */
ret
=
nouveau_parent_sclass
(
parent
,
_oclass
,
&
engine
,
&
oclass
);
if
(
ret
)
{
nv_debug
(
parent
,
"illegal class 0x%04x
\n
"
,
_oclass
);
goto
fail_class
;
}
/* make sure engine init has been completed *before* any objects
* it controls are created - the constructors may depend on
* state calculated at init (ie. default context construction)
*/
if
(
engine
)
{
ret
=
nouveau_object_inc
(
engine
);
if
(
ret
)
goto
fail_class
;
}
/* if engine requires it, create a context object to insert
* between the parent and its children (eg. PGRAPH context)
*/
if
(
engine
&&
nv_engine
(
engine
)
->
cclass
)
{
ret
=
nouveau_object_ctor
(
parent
,
engine
,
nv_engine
(
engine
)
->
cclass
,
data
,
size
,
&
engctx
);
if
(
ret
)
goto
fail_engctx
;
}
else
{
nouveau_object_ref
(
parent
,
&
engctx
);
}
/* finally, create new object and bind it to its handle */
ret
=
nouveau_object_ctor
(
engctx
,
engine
,
oclass
,
data
,
size
,
&
object
);
*
pobject
=
object
;
if
(
ret
)
goto
fail_ctor
;
ret
=
nouveau_object_inc
(
object
);
if
(
ret
)
goto
fail_init
;
ret
=
nouveau_handle_create
(
parent
,
_parent
,
_handle
,
object
,
&
handle
);
if
(
ret
)
goto
fail_handle
;
ret
=
nouveau_handle_init
(
handle
);
if
(
ret
)
nouveau_handle_destroy
(
handle
);
fail_handle:
nouveau_object_dec
(
object
,
false
);
fail_init:
nouveau_object_ref
(
NULL
,
&
object
);
fail_ctor:
nouveau_object_ref
(
NULL
,
&
engctx
);
fail_engctx:
if
(
engine
)
nouveau_object_dec
(
engine
,
false
);
fail_class:
nouveau_object_ref
(
NULL
,
&
parent
);
return
ret
;
}
int
nouveau_handle_del
(
struct
nouveau_object
*
client
,
u32
_parent
,
u32
_handle
)
{
struct
nouveau_object
*
parent
=
NULL
;
struct
nouveau_object
*
namedb
=
NULL
;
struct
nouveau_handle
*
handle
=
NULL
;
parent
=
nouveau_handle_ref
(
client
,
_parent
);
if
(
!
parent
)
return
-
ENOENT
;
namedb
=
nv_pclass
(
parent
,
NV_NAMEDB_CLASS
);
if
(
namedb
)
{
handle
=
nouveau_namedb_get
(
nv_namedb
(
namedb
),
_handle
);
if
(
handle
)
{
nouveau_namedb_put
(
handle
);
nouveau_handle_fini
(
handle
,
false
);
nouveau_handle_destroy
(
handle
);
}
}
nouveau_object_ref
(
NULL
,
&
parent
);
return
handle
?
0
:
-
EINVAL
;
}
drivers/gpu/drm/nouveau/core/core/object.c
View file @
4d681b66
...
@@ -23,9 +23,6 @@
...
@@ -23,9 +23,6 @@
*/
*/
#include <core/object.h>
#include <core/object.h>
#include <core/parent.h>
#include <core/namedb.h>
#include <core/handle.h>
#include <core/engine.h>
#include <core/engine.h>
#ifdef NOUVEAU_OBJECT_MAGIC
#ifdef NOUVEAU_OBJECT_MAGIC
...
@@ -164,119 +161,6 @@ nouveau_object_ref(struct nouveau_object *obj, struct nouveau_object **ref)
...
@@ -164,119 +161,6 @@ nouveau_object_ref(struct nouveau_object *obj, struct nouveau_object **ref)
*
ref
=
obj
;
*
ref
=
obj
;
}
}
int
nouveau_object_new
(
struct
nouveau_object
*
client
,
u32
_parent
,
u32
_handle
,
u16
_oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
pobject
)
{
struct
nouveau_object
*
parent
=
NULL
;
struct
nouveau_object
*
engctx
=
NULL
;
struct
nouveau_object
*
object
=
NULL
;
struct
nouveau_object
*
engine
;
struct
nouveau_oclass
*
oclass
;
struct
nouveau_handle
*
handle
;
int
ret
;
/* lookup parent object and ensure it *is* a parent */
parent
=
nouveau_handle_ref
(
client
,
_parent
);
if
(
!
parent
)
{
nv_error
(
client
,
"parent 0x%08x not found
\n
"
,
_parent
);
return
-
ENOENT
;
}
if
(
!
nv_iclass
(
parent
,
NV_PARENT_CLASS
))
{
nv_error
(
parent
,
"cannot have children
\n
"
);
ret
=
-
EINVAL
;
goto
fail_class
;
}
/* check that parent supports the requested subclass */
ret
=
nouveau_parent_sclass
(
parent
,
_oclass
,
&
engine
,
&
oclass
);
if
(
ret
)
{
nv_debug
(
parent
,
"illegal class 0x%04x
\n
"
,
_oclass
);
goto
fail_class
;
}
/* make sure engine init has been completed *before* any objects
* it controls are created - the constructors may depend on
* state calculated at init (ie. default context construction)
*/
if
(
engine
)
{
ret
=
nouveau_object_inc
(
engine
);
if
(
ret
)
goto
fail_class
;
}
/* if engine requires it, create a context object to insert
* between the parent and its children (eg. PGRAPH context)
*/
if
(
engine
&&
nv_engine
(
engine
)
->
cclass
)
{
ret
=
nouveau_object_ctor
(
parent
,
engine
,
nv_engine
(
engine
)
->
cclass
,
data
,
size
,
&
engctx
);
if
(
ret
)
goto
fail_engctx
;
}
else
{
nouveau_object_ref
(
parent
,
&
engctx
);
}
/* finally, create new object and bind it to its handle */
ret
=
nouveau_object_ctor
(
engctx
,
engine
,
oclass
,
data
,
size
,
&
object
);
*
pobject
=
object
;
if
(
ret
)
goto
fail_ctor
;
ret
=
nouveau_object_inc
(
object
);
if
(
ret
)
goto
fail_init
;
ret
=
nouveau_handle_create
(
parent
,
_parent
,
_handle
,
object
,
&
handle
);
if
(
ret
)
goto
fail_handle
;
ret
=
nouveau_handle_init
(
handle
);
if
(
ret
)
nouveau_handle_destroy
(
handle
);
fail_handle:
nouveau_object_dec
(
object
,
false
);
fail_init:
nouveau_object_ref
(
NULL
,
&
object
);
fail_ctor:
nouveau_object_ref
(
NULL
,
&
engctx
);
fail_engctx:
if
(
engine
)
nouveau_object_dec
(
engine
,
false
);
fail_class:
nouveau_object_ref
(
NULL
,
&
parent
);
return
ret
;
}
int
nouveau_object_del
(
struct
nouveau_object
*
client
,
u32
_parent
,
u32
_handle
)
{
struct
nouveau_object
*
parent
=
NULL
;
struct
nouveau_object
*
namedb
=
NULL
;
struct
nouveau_handle
*
handle
=
NULL
;
parent
=
nouveau_handle_ref
(
client
,
_parent
);
if
(
!
parent
)
return
-
ENOENT
;
namedb
=
nv_pclass
(
parent
,
NV_NAMEDB_CLASS
);
if
(
namedb
)
{
handle
=
nouveau_namedb_get
(
nv_namedb
(
namedb
),
_handle
);
if
(
handle
)
{
nouveau_namedb_put
(
handle
);
nouveau_handle_fini
(
handle
,
false
);
nouveau_handle_destroy
(
handle
);
}
}
nouveau_object_ref
(
NULL
,
&
parent
);
return
handle
?
0
:
-
EINVAL
;
}
int
int
nouveau_object_inc
(
struct
nouveau_object
*
object
)
nouveau_object_inc
(
struct
nouveau_object
*
object
)
{
{
...
...
drivers/gpu/drm/nouveau/core/include/core/handle.h
View file @
4d681b66
...
@@ -20,6 +20,11 @@ void nouveau_handle_destroy(struct nouveau_handle *);
...
@@ -20,6 +20,11 @@ void nouveau_handle_destroy(struct nouveau_handle *);
int
nouveau_handle_init
(
struct
nouveau_handle
*
);
int
nouveau_handle_init
(
struct
nouveau_handle
*
);
int
nouveau_handle_fini
(
struct
nouveau_handle
*
,
bool
suspend
);
int
nouveau_handle_fini
(
struct
nouveau_handle
*
,
bool
suspend
);
int
nouveau_handle_new
(
struct
nouveau_object
*
,
u32
parent
,
u32
handle
,
u16
oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
);
int
nouveau_handle_del
(
struct
nouveau_object
*
,
u32
parent
,
u32
handle
);
struct
nouveau_object
*
struct
nouveau_object
*
nouveau_handle_ref
(
struct
nouveau_object
*
,
u32
name
);
nouveau_handle_ref
(
struct
nouveau_object
*
,
u32
name
);
...
...
drivers/gpu/drm/nouveau/core/include/core/object.h
View file @
4d681b66
...
@@ -106,10 +106,6 @@ void nouveau_object_ref(struct nouveau_object *, struct nouveau_object **);
...
@@ -106,10 +106,6 @@ void nouveau_object_ref(struct nouveau_object *, struct nouveau_object **);
int
nouveau_object_inc
(
struct
nouveau_object
*
);
int
nouveau_object_inc
(
struct
nouveau_object
*
);
int
nouveau_object_dec
(
struct
nouveau_object
*
,
bool
suspend
);
int
nouveau_object_dec
(
struct
nouveau_object
*
,
bool
suspend
);
int
nouveau_object_new
(
struct
nouveau_object
*
,
u32
parent
,
u32
handle
,
u16
oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
);
int
nouveau_object_del
(
struct
nouveau_object
*
,
u32
parent
,
u32
handle
);
void
nouveau_object_debug
(
void
);
void
nouveau_object_debug
(
void
);
static
inline
int
static
inline
int
...
@@ -199,4 +195,21 @@ nv_memcmp(void *obj, u32 addr, const char *str, u32 len)
...
@@ -199,4 +195,21 @@ nv_memcmp(void *obj, u32 addr, const char *str, u32 len)
return
0
;
return
0
;
}
}
#include <core/handle.h>
static
inline
int
nouveau_object_new
(
struct
nouveau_object
*
client
,
u32
parent
,
u32
handle
,
u16
oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
pobject
)
{
return
nouveau_handle_new
(
client
,
parent
,
handle
,
oclass
,
data
,
size
,
pobject
);
}
static
inline
int
nouveau_object_del
(
struct
nouveau_object
*
client
,
u32
parent
,
u32
handle
)
{
return
nouveau_handle_del
(
client
,
parent
,
handle
);
}
#endif
#endif
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