Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
ab606194
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ab606194
编写于
12月 23, 2013
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/instmem: tidy up the object class definition
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
24a4ae86
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
127 addition
and
114 deletion
+127
-114
drivers/gpu/drm/nouveau/core/include/subdev/instmem.h
drivers/gpu/drm/nouveau/core/include/subdev/instmem.h
+0
-15
drivers/gpu/drm/nouveau/core/subdev/instmem/base.c
drivers/gpu/drm/nouveau/core/subdev/instmem/base.c
+20
-27
drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c
drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c
+36
-31
drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.h
drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.h
+1
-1
drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c
drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c
+1
-1
drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c
drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c
+43
-39
drivers/gpu/drm/nouveau/core/subdev/instmem/priv.h
drivers/gpu/drm/nouveau/core/subdev/instmem/priv.h
+26
-0
未找到文件。
drivers/gpu/drm/nouveau/core/include/subdev/instmem.h
浏览文件 @
ab606194
...
...
@@ -23,21 +23,6 @@ nv_memobj(void *obj)
return
obj
;
}
#define nouveau_instobj_create(p,e,o,d) \
nouveau_instobj_create_((p), (e), (o), sizeof(**d), (void **)d)
#define nouveau_instobj_init(p) \
nouveau_object_init(&(p)->base)
#define nouveau_instobj_fini(p,s) \
nouveau_object_fini(&(p)->base, (s))
int
nouveau_instobj_create_
(
struct
nouveau_object
*
,
struct
nouveau_object
*
,
struct
nouveau_oclass
*
,
int
,
void
**
);
void
nouveau_instobj_destroy
(
struct
nouveau_instobj
*
);
void
_nouveau_instobj_dtor
(
struct
nouveau_object
*
);
#define _nouveau_instobj_init nouveau_object_init
#define _nouveau_instobj_fini nouveau_object_fini
struct
nouveau_instmem
{
struct
nouveau_subdev
base
;
struct
list_head
list
;
...
...
drivers/gpu/drm/nouveau/core/subdev/instmem/base.c
浏览文件 @
ab606194
...
...
@@ -24,6 +24,23 @@
#include "priv.h"
/******************************************************************************
* instmem object base implementation
*****************************************************************************/
void
_nouveau_instobj_dtor
(
struct
nouveau_object
*
object
)
{
struct
nouveau_instmem
*
imem
=
(
void
*
)
object
->
engine
;
struct
nouveau_instobj
*
iobj
=
(
void
*
)
object
;
mutex_lock
(
&
nv_subdev
(
imem
)
->
mutex
);
list_del
(
&
iobj
->
head
);
mutex_unlock
(
&
nv_subdev
(
imem
)
->
mutex
);
return
nouveau_object_destroy
(
&
iobj
->
base
);
}
int
nouveau_instobj_create_
(
struct
nouveau_object
*
parent
,
struct
nouveau_object
*
engine
,
...
...
@@ -46,25 +63,6 @@ nouveau_instobj_create_(struct nouveau_object *parent,
return
0
;
}
void
nouveau_instobj_destroy
(
struct
nouveau_instobj
*
iobj
)
{
struct
nouveau_subdev
*
subdev
=
nv_subdev
(
iobj
->
base
.
engine
);
mutex_lock
(
&
subdev
->
mutex
);
list_del
(
&
iobj
->
head
);
mutex_unlock
(
&
subdev
->
mutex
);
return
nouveau_object_destroy
(
&
iobj
->
base
);
}
void
_nouveau_instobj_dtor
(
struct
nouveau_object
*
object
)
{
struct
nouveau_instobj
*
iobj
=
(
void
*
)
object
;
return
nouveau_instobj_destroy
(
iobj
);
}
/******************************************************************************
* instmem subdev base implementation
*****************************************************************************/
...
...
@@ -76,14 +74,9 @@ nouveau_instmem_alloc(struct nouveau_instmem *imem,
{
struct
nouveau_object
*
engine
=
nv_object
(
imem
);
struct
nouveau_instmem_impl
*
impl
=
(
void
*
)
engine
->
oclass
;
int
ret
;
ret
=
nouveau_object_ctor
(
parent
,
engine
,
impl
->
instobj
,
(
void
*
)(
unsigned
long
)
align
,
size
,
pobject
);
if
(
ret
)
return
ret
;
return
0
;
struct
nouveau_instobj_args
args
=
{
.
size
=
size
,
.
align
=
align
};
return
nouveau_object_ctor
(
parent
,
engine
,
impl
->
instobj
,
&
args
,
sizeof
(
args
),
pobject
);
}
int
...
...
drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c
浏览文件 @
ab606194
...
...
@@ -24,6 +24,33 @@
#include "nv04.h"
/******************************************************************************
* instmem object implementation
*****************************************************************************/
static
u32
nv04_instobj_rd32
(
struct
nouveau_object
*
object
,
u64
addr
)
{
struct
nv04_instobj_priv
*
node
=
(
void
*
)
object
;
return
nv_ro32
(
object
->
engine
,
node
->
mem
->
offset
+
addr
);
}
static
void
nv04_instobj_wr32
(
struct
nouveau_object
*
object
,
u64
addr
,
u32
data
)
{
struct
nv04_instobj_priv
*
node
=
(
void
*
)
object
;
nv_wo32
(
object
->
engine
,
node
->
mem
->
offset
+
addr
,
data
);
}
static
void
nv04_instobj_dtor
(
struct
nouveau_object
*
object
)
{
struct
nv04_instmem_priv
*
priv
=
(
void
*
)
object
->
engine
;
struct
nv04_instobj_priv
*
node
=
(
void
*
)
object
;
nouveau_mm_free
(
&
priv
->
heap
,
&
node
->
mem
);
nouveau_instobj_destroy
(
&
node
->
base
);
}
static
int
nv04_instobj_ctor
(
struct
nouveau_object
*
parent
,
struct
nouveau_object
*
engine
,
struct
nouveau_oclass
*
oclass
,
void
*
data
,
u32
size
,
...
...
@@ -31,18 +58,19 @@ nv04_instobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
{
struct
nv04_instmem_priv
*
priv
=
(
void
*
)
engine
;
struct
nv04_instobj_priv
*
node
;
int
ret
,
align
;
struct
nouveau_instobj_args
*
args
=
data
;
int
ret
;
align
=
(
unsigned
long
)
data
;
if
(
!
align
)
align
=
1
;
if
(
!
args
->
align
)
args
->
align
=
1
;
ret
=
nouveau_instobj_create
(
parent
,
engine
,
oclass
,
&
node
);
*
pobject
=
nv_object
(
node
);
if
(
ret
)
return
ret
;
ret
=
nouveau_mm_head
(
&
priv
->
heap
,
1
,
size
,
size
,
align
,
&
node
->
mem
);
ret
=
nouveau_mm_head
(
&
priv
->
heap
,
1
,
args
->
size
,
args
->
size
,
args
->
align
,
&
node
->
mem
);
if
(
ret
)
return
ret
;
...
...
@@ -51,32 +79,9 @@ nv04_instobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return
0
;
}
static
void
nv04_instobj_dtor
(
struct
nouveau_object
*
object
)
{
struct
nv04_instmem_priv
*
priv
=
(
void
*
)
object
->
engine
;
struct
nv04_instobj_priv
*
node
=
(
void
*
)
object
;
nouveau_mm_free
(
&
priv
->
heap
,
&
node
->
mem
);
nouveau_instobj_destroy
(
&
node
->
base
);
}
static
u32
nv04_instobj_rd32
(
struct
nouveau_object
*
object
,
u64
addr
)
{
struct
nv04_instobj_priv
*
node
=
(
void
*
)
object
;
return
nv_ro32
(
object
->
engine
,
node
->
mem
->
offset
+
addr
);
}
static
void
nv04_instobj_wr32
(
struct
nouveau_object
*
object
,
u64
addr
,
u32
data
)
{
struct
nv04_instobj_priv
*
node
=
(
void
*
)
object
;
nv_wo32
(
object
->
engine
,
node
->
mem
->
offset
+
addr
,
data
);
}
struct
nouveau_oclass
struct
nouveau_instobj_impl
nv04_instobj_oclass
=
{
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
base
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
ctor
=
nv04_instobj_ctor
,
.
dtor
=
nv04_instobj_dtor
,
.
init
=
_nouveau_instobj_init
,
...
...
@@ -173,5 +178,5 @@ nv04_instmem_oclass = &(struct nouveau_instmem_impl) {
.
rd32
=
nv04_instmem_rd32
,
.
wr32
=
nv04_instmem_wr32
,
},
.
instobj
=
&
nv04_instobj_oclass
,
.
instobj
=
&
nv04_instobj_oclass
.
base
,
}.
base
;
drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.h
浏览文件 @
ab606194
...
...
@@ -7,7 +7,7 @@
#include "priv.h"
extern
struct
nouveau_
oclass
nv04_instobj_oclass
;
extern
struct
nouveau_
instobj_impl
nv04_instobj_oclass
;
struct
nv04_instmem_priv
{
struct
nouveau_instmem
base
;
...
...
drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c
浏览文件 @
ab606194
...
...
@@ -134,5 +134,5 @@ nv40_instmem_oclass = &(struct nouveau_instmem_impl) {
.
rd32
=
nv40_instmem_rd32
,
.
wr32
=
nv40_instmem_wr32
,
},
.
instobj
=
&
nv04_instobj_oclass
,
.
instobj
=
&
nv04_instobj_oclass
.
base
,
}.
base
;
drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c
浏览文件 @
ab606194
...
...
@@ -38,42 +38,9 @@ struct nv50_instobj_priv {
struct
nouveau_mem
*
mem
;
};
static
int
nv50_instobj_ctor
(
struct
nouveau_object
*
parent
,
struct
nouveau_object
*
engine
,
struct
nouveau_oclass
*
oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
pobject
)
{
struct
nouveau_fb
*
pfb
=
nouveau_fb
(
parent
);
struct
nv50_instobj_priv
*
node
;
u32
align
=
(
unsigned
long
)
data
;
int
ret
;
size
=
max
((
size
+
4095
)
&
~
4095
,
(
u32
)
4096
);
align
=
max
((
align
+
4095
)
&
~
4095
,
(
u32
)
4096
);
ret
=
nouveau_instobj_create
(
parent
,
engine
,
oclass
,
&
node
);
*
pobject
=
nv_object
(
node
);
if
(
ret
)
return
ret
;
ret
=
pfb
->
ram
->
get
(
pfb
,
size
,
align
,
0
,
0x800
,
&
node
->
mem
);
if
(
ret
)
return
ret
;
node
->
base
.
addr
=
node
->
mem
->
offset
;
node
->
base
.
size
=
node
->
mem
->
size
<<
12
;
node
->
mem
->
page_shift
=
12
;
return
0
;
}
static
void
nv50_instobj_dtor
(
struct
nouveau_object
*
object
)
{
struct
nv50_instobj_priv
*
node
=
(
void
*
)
object
;
struct
nouveau_fb
*
pfb
=
nouveau_fb
(
object
);
pfb
->
ram
->
put
(
pfb
,
&
node
->
mem
);
nouveau_instobj_destroy
(
&
node
->
base
);
}
/******************************************************************************
* instmem object implementation
*****************************************************************************/
static
u32
nv50_instobj_rd32
(
struct
nouveau_object
*
object
,
u64
offset
)
...
...
@@ -113,9 +80,46 @@ nv50_instobj_wr32(struct nouveau_object *object, u64 offset, u32 data)
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
}
static
struct
nouveau_oclass
static
void
nv50_instobj_dtor
(
struct
nouveau_object
*
object
)
{
struct
nv50_instobj_priv
*
node
=
(
void
*
)
object
;
struct
nouveau_fb
*
pfb
=
nouveau_fb
(
object
);
pfb
->
ram
->
put
(
pfb
,
&
node
->
mem
);
nouveau_instobj_destroy
(
&
node
->
base
);
}
static
int
nv50_instobj_ctor
(
struct
nouveau_object
*
parent
,
struct
nouveau_object
*
engine
,
struct
nouveau_oclass
*
oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
pobject
)
{
struct
nouveau_fb
*
pfb
=
nouveau_fb
(
parent
);
struct
nouveau_instobj_args
*
args
=
data
;
struct
nv50_instobj_priv
*
node
;
int
ret
;
args
->
size
=
max
((
args
->
size
+
4095
)
&
~
4095
,
(
u32
)
4096
);
args
->
align
=
max
((
args
->
align
+
4095
)
&
~
4095
,
(
u32
)
4096
);
ret
=
nouveau_instobj_create
(
parent
,
engine
,
oclass
,
&
node
);
*
pobject
=
nv_object
(
node
);
if
(
ret
)
return
ret
;
ret
=
pfb
->
ram
->
get
(
pfb
,
args
->
size
,
args
->
align
,
0
,
0x800
,
&
node
->
mem
);
if
(
ret
)
return
ret
;
node
->
base
.
addr
=
node
->
mem
->
offset
;
node
->
base
.
size
=
node
->
mem
->
size
<<
12
;
node
->
mem
->
page_shift
=
12
;
return
0
;
}
static
struct
nouveau_instobj_impl
nv50_instobj_oclass
=
{
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
base
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
ctor
=
nv50_instobj_ctor
,
.
dtor
=
nv50_instobj_dtor
,
.
init
=
_nouveau_instobj_init
,
...
...
@@ -163,5 +167,5 @@ nv50_instmem_oclass = &(struct nouveau_instmem_impl) {
.
init
=
_nouveau_instmem_init
,
.
fini
=
nv50_instmem_fini
,
},
.
instobj
=
&
nv50_instobj_oclass
,
.
instobj
=
&
nv50_instobj_oclass
.
base
,
}.
base
;
drivers/gpu/drm/nouveau/core/subdev/instmem/priv.h
浏览文件 @
ab606194
...
...
@@ -3,6 +3,32 @@
#include <subdev/instmem.h>
struct
nouveau_instobj_impl
{
struct
nouveau_oclass
base
;
};
struct
nouveau_instobj_args
{
u32
size
;
u32
align
;
};
#define nouveau_instobj_create(p,e,o,d) \
nouveau_instobj_create_((p), (e), (o), sizeof(**d), (void **)d)
#define nouveau_instobj_destroy(p) ({ \
struct nouveau_instobj *iobj = (p); \
_nouveau_instobj_dtor(nv_object(iobj)); \
})
#define nouveau_instobj_init(p) \
nouveau_object_init(&(p)->base)
#define nouveau_instobj_fini(p,s) \
nouveau_object_fini(&(p)->base, (s))
int
nouveau_instobj_create_
(
struct
nouveau_object
*
,
struct
nouveau_object
*
,
struct
nouveau_oclass
*
,
int
,
void
**
);
void
_nouveau_instobj_dtor
(
struct
nouveau_object
*
);
#define _nouveau_instobj_init nouveau_object_init
#define _nouveau_instobj_fini nouveau_object_fini
struct
nouveau_instmem_impl
{
struct
nouveau_oclass
base
;
struct
nouveau_oclass
*
instobj
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录