Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
168c2e21
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看板
提交
168c2e21
编写于
8月 20, 2015
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/engine: implement support for new-style nvkm_engine
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
f0290215
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
164 addition
and
0 deletion
+164
-0
drivers/gpu/drm/nouveau/include/nvkm/core/engine.h
drivers/gpu/drm/nouveau/include/nvkm/core/engine.h
+37
-0
drivers/gpu/drm/nouveau/nvkm/core/engine.c
drivers/gpu/drm/nouveau/nvkm/core/engine.c
+127
-0
未找到文件。
drivers/gpu/drm/nouveau/include/nvkm/core/engine.h
浏览文件 @
168c2e21
#ifndef __NVKM_ENGINE_H__
#define __NVKM_ENGINE_H__
#include <core/subdev.h>
struct
nvkm_device_oclass
;
/*XXX: DEV!ENG */
struct
nvkm_fifo_chan
;
#define NV_ENGINE_(eng,var) (((var) << 8) | (eng))
#define NV_ENGINE(name,var) NV_ENGINE_(NVDEV_ENGINE_##name, (var))
struct
nvkm_engine
{
struct
nvkm_subdev
subdev
;
const
struct
nvkm_engine_func
*
func
;
int
usecount
;
struct
nvkm_oclass
*
cclass
;
struct
nvkm_oclass
*
sclass
;
...
...
@@ -17,6 +23,37 @@ struct nvkm_engine {
int
(
*
tlb_flush
)(
struct
nvkm_engine
*
);
};
struct
nvkm_engine_func
{
void
*
(
*
dtor
)(
struct
nvkm_engine
*
);
int
(
*
oneinit
)(
struct
nvkm_engine
*
);
int
(
*
init
)(
struct
nvkm_engine
*
);
int
(
*
fini
)(
struct
nvkm_engine
*
,
bool
suspend
);
void
(
*
intr
)(
struct
nvkm_engine
*
);
struct
{
int
(
*
sclass
)(
struct
nvkm_oclass
*
,
int
index
,
const
struct
nvkm_device_oclass
**
);
}
base
;
struct
{
int
(
*
cclass
)(
struct
nvkm_fifo_chan
*
,
const
struct
nvkm_oclass
*
,
struct
nvkm_object
**
);
int
(
*
sclass
)(
struct
nvkm_oclass
*
,
int
index
);
}
fifo
;
struct
nvkm_sclass
sclass
[];
};
int
nvkm_engine_ctor
(
const
struct
nvkm_engine_func
*
,
struct
nvkm_device
*
,
int
index
,
u32
pmc_enable
,
bool
enable
,
struct
nvkm_engine
*
);
int
nvkm_engine_new_
(
const
struct
nvkm_engine_func
*
,
struct
nvkm_device
*
,
int
index
,
u32
pmc_enable
,
bool
enable
,
struct
nvkm_engine
**
);
struct
nvkm_engine
*
nvkm_engine_ref
(
struct
nvkm_engine
*
);
void
nvkm_engine_unref
(
struct
nvkm_engine
**
);
static
inline
struct
nvkm_engine
*
nv_engine
(
void
*
obj
)
{
...
...
drivers/gpu/drm/nouveau/nvkm/core/engine.c
浏览文件 @
168c2e21
...
...
@@ -25,6 +25,133 @@
#include <core/device.h>
#include <core/option.h>
void
nvkm_engine_unref
(
struct
nvkm_engine
**
pengine
)
{
struct
nvkm_engine
*
engine
=
*
pengine
;
if
(
engine
)
{
mutex_lock
(
&
engine
->
subdev
.
mutex
);
if
(
--
engine
->
usecount
==
0
)
nvkm_subdev_fini
(
&
engine
->
subdev
,
false
);
mutex_unlock
(
&
engine
->
subdev
.
mutex
);
*
pengine
=
NULL
;
}
}
struct
nvkm_engine
*
nvkm_engine_ref
(
struct
nvkm_engine
*
engine
)
{
if
(
engine
)
{
mutex_lock
(
&
engine
->
subdev
.
mutex
);
if
(
++
engine
->
usecount
==
1
)
{
int
ret
=
nvkm_subdev_init
(
&
engine
->
subdev
);
if
(
ret
)
{
engine
->
usecount
--
;
mutex_unlock
(
&
engine
->
subdev
.
mutex
);
return
ERR_PTR
(
ret
);
}
}
mutex_unlock
(
&
engine
->
subdev
.
mutex
);
}
return
engine
;
}
static
void
nvkm_engine_intr
(
struct
nvkm_subdev
*
obj
)
{
struct
nvkm_engine
*
engine
=
container_of
(
obj
,
typeof
(
*
engine
),
subdev
);
if
(
engine
->
func
->
intr
)
engine
->
func
->
intr
(
engine
);
}
static
int
nvkm_engine_fini
(
struct
nvkm_subdev
*
obj
,
bool
suspend
)
{
struct
nvkm_engine
*
engine
=
container_of
(
obj
,
typeof
(
*
engine
),
subdev
);
if
(
engine
->
func
->
fini
)
return
engine
->
func
->
fini
(
engine
,
suspend
);
return
0
;
}
static
int
nvkm_engine_init
(
struct
nvkm_subdev
*
obj
)
{
struct
nvkm_engine
*
engine
=
container_of
(
obj
,
typeof
(
*
engine
),
subdev
);
struct
nvkm_subdev
*
subdev
=
&
engine
->
subdev
;
int
ret
=
0
;
s64
time
;
if
(
!
engine
->
usecount
)
{
nvkm_trace
(
subdev
,
"init skipped, engine has no users
\n
"
);
return
ret
;
}
if
(
engine
->
func
->
oneinit
&&
!
engine
->
subdev
.
oneinit
)
{
nvkm_trace
(
subdev
,
"one-time init running...
\n
"
);
time
=
ktime_to_us
(
ktime_get
());
ret
=
engine
->
func
->
oneinit
(
engine
);
if
(
ret
)
{
nvkm_trace
(
subdev
,
"one-time init failed, %d
\n
"
,
ret
);
return
ret
;
}
engine
->
subdev
.
oneinit
=
true
;
time
=
ktime_to_us
(
ktime_get
())
-
time
;
nvkm_trace
(
subdev
,
"one-time init completed in %lldus
\n
"
,
time
);
}
if
(
engine
->
func
->
init
)
ret
=
engine
->
func
->
init
(
engine
);
return
ret
;
}
static
void
*
nvkm_engine_dtor
(
struct
nvkm_subdev
*
obj
)
{
struct
nvkm_engine
*
engine
=
container_of
(
obj
,
typeof
(
*
engine
),
subdev
);
if
(
engine
->
func
->
dtor
)
return
engine
->
func
->
dtor
(
engine
);
return
engine
;
}
static
const
struct
nvkm_subdev_func
nvkm_engine_func
=
{
.
dtor
=
nvkm_engine_dtor
,
.
init
=
nvkm_engine_init
,
.
fini
=
nvkm_engine_fini
,
.
intr
=
nvkm_engine_intr
,
};
int
nvkm_engine_ctor
(
const
struct
nvkm_engine_func
*
func
,
struct
nvkm_device
*
device
,
int
index
,
u32
pmc_enable
,
bool
enable
,
struct
nvkm_engine
*
engine
)
{
nvkm_subdev_ctor
(
&
nvkm_engine_func
,
device
,
index
,
pmc_enable
,
&
engine
->
subdev
);
engine
->
func
=
func
;
if
(
!
nvkm_boolopt
(
device
->
cfgopt
,
nvkm_subdev_name
[
index
],
enable
))
{
nvkm_debug
(
&
engine
->
subdev
,
"disabled
\n
"
);
return
-
ENODEV
;
}
spin_lock_init
(
&
engine
->
lock
);
return
0
;
}
int
nvkm_engine_new_
(
const
struct
nvkm_engine_func
*
func
,
struct
nvkm_device
*
device
,
int
index
,
u32
pmc_enable
,
bool
enable
,
struct
nvkm_engine
**
pengine
)
{
if
(
!
(
*
pengine
=
kzalloc
(
sizeof
(
**
pengine
),
GFP_KERNEL
)))
return
-
ENOMEM
;
return
nvkm_engine_ctor
(
func
,
device
,
index
,
pmc_enable
,
enable
,
*
pengine
);
}
struct
nvkm_engine
*
nvkm_engine
(
void
*
obj
,
int
idx
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录