Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
dd6a46cc
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
dd6a46cc
编写于
6月 03, 2011
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau: initialise any vm for a channel before pushbuf/ntfy
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
b7cb6c01
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
48 addition
and
66 deletion
+48
-66
drivers/gpu/drm/nouveau/nouveau_channel.c
drivers/gpu/drm/nouveau/nouveau_channel.c
+48
-66
未找到文件。
drivers/gpu/drm/nouveau/nouveau_channel.c
浏览文件 @
dd6a46cc
...
...
@@ -30,14 +30,31 @@
#include "nouveau_ramht.h"
static
int
nouveau_channel_pushbuf_
ctxdma_
init
(
struct
nouveau_channel
*
chan
)
nouveau_channel_pushbuf_init
(
struct
nouveau_channel
*
chan
)
{
u32
mem
=
nouveau_vram_pushbuf
?
TTM_PL_FLAG_VRAM
:
TTM_PL_FLAG_TT
;
struct
drm_device
*
dev
=
chan
->
dev
;
struct
drm_nouveau_private
*
dev_priv
=
dev
->
dev_private
;
struct
nouveau_bo
*
pb
=
chan
->
pushbuf_bo
;
struct
nouveau_gpuobj
*
pushbuf
=
NULL
;
int
ret
=
0
;
int
ret
;
/* allocate buffer object */
ret
=
nouveau_bo_new
(
dev
,
NULL
,
65536
,
0
,
mem
,
0
,
0
,
&
chan
->
pushbuf_bo
);
if
(
ret
)
goto
out
;
ret
=
nouveau_bo_pin
(
chan
->
pushbuf_bo
,
mem
);
if
(
ret
)
goto
out
;
ret
=
nouveau_bo_map
(
chan
->
pushbuf_bo
);
if
(
ret
)
goto
out
;
/* create DMA object covering the entire memtype where the push
* buffer resides, userspace can submit its own push buffers from
* anywhere within the same memtype.
*/
chan
->
pushbuf_base
=
chan
->
pushbuf_bo
->
bo
.
mem
.
start
<<
PAGE_SHIFT
;
if
(
dev_priv
->
card_type
>=
NV_50
)
{
if
(
dev_priv
->
card_type
<
NV_C0
)
{
ret
=
nouveau_gpuobj_dma_new
(
chan
,
...
...
@@ -45,23 +62,23 @@ nouveau_channel_pushbuf_ctxdma_init(struct nouveau_channel *chan)
(
1ULL
<<
40
),
NV_MEM_ACCESS_RO
,
NV_MEM_TARGET_VM
,
&
pushbuf
);
&
chan
->
pushbuf
);
}
chan
->
pushbuf_base
=
pb
->
bo
.
offset
;
chan
->
pushbuf_base
=
chan
->
pushbuf_bo
->
bo
.
offset
;
}
else
if
(
pb
->
bo
.
mem
.
mem_type
==
TTM_PL_TT
)
{
if
(
chan
->
pushbuf_bo
->
bo
.
mem
.
mem_type
==
TTM_PL_TT
)
{
ret
=
nouveau_gpuobj_dma_new
(
chan
,
NV_CLASS_DMA_IN_MEMORY
,
0
,
dev_priv
->
gart_info
.
aper_size
,
NV_MEM_ACCESS_RO
,
NV_MEM_TARGET_GART
,
&
pushbuf
);
chan
->
pushbuf_base
=
pb
->
bo
.
mem
.
start
<<
PAGE_SHIFT
;
NV_MEM_TARGET_GART
,
&
chan
->
pushbuf
)
;
}
else
if
(
dev_priv
->
card_type
!=
NV_04
)
{
ret
=
nouveau_gpuobj_dma_new
(
chan
,
NV_CLASS_DMA_IN_MEMORY
,
0
,
dev_priv
->
fb_available_size
,
NV_MEM_ACCESS_RO
,
NV_MEM_TARGET_VRAM
,
&
pushbuf
);
chan
->
pushbuf_base
=
pb
->
bo
.
mem
.
start
<<
PAGE_SHIFT
;
NV_MEM_TARGET_VRAM
,
&
chan
->
pushbuf
)
;
}
else
{
/* NV04 cmdbuf hack, from original ddx.. not sure of it's
* exact reason for existing :) PCI access to cmdbuf in
...
...
@@ -71,47 +88,21 @@ nouveau_channel_pushbuf_ctxdma_init(struct nouveau_channel *chan)
pci_resource_start
(
dev
->
pdev
,
1
),
dev_priv
->
fb_available_size
,
NV_MEM_ACCESS_RO
,
NV_MEM_TARGET_PCI
,
&
pushbuf
);
chan
->
pushbuf_base
=
pb
->
bo
.
mem
.
start
<<
PAGE_SHIFT
;
}
nouveau_gpuobj_ref
(
pushbuf
,
&
chan
->
pushbuf
);
nouveau_gpuobj_ref
(
NULL
,
&
pushbuf
);
return
ret
;
}
static
struct
nouveau_bo
*
nouveau_channel_user_pushbuf_alloc
(
struct
drm_device
*
dev
)
{
struct
nouveau_bo
*
pushbuf
=
NULL
;
int
location
,
ret
;
if
(
nouveau_vram_pushbuf
)
location
=
TTM_PL_FLAG_VRAM
;
else
location
=
TTM_PL_FLAG_TT
;
ret
=
nouveau_bo_new
(
dev
,
NULL
,
65536
,
0
,
location
,
0
,
0x0000
,
&
pushbuf
);
if
(
ret
)
{
NV_ERROR
(
dev
,
"error allocating DMA push buffer: %d
\n
"
,
ret
);
return
NULL
;
NV_MEM_TARGET_PCI
,
&
chan
->
pushbuf
);
}
ret
=
nouveau_bo_pin
(
pushbuf
,
location
);
out:
if
(
ret
)
{
NV_ERROR
(
dev
,
"error pinning DMA push buffer: %d
\n
"
,
ret
);
nouveau_bo_ref
(
NULL
,
&
pushbuf
);
return
NULL
;
}
ret
=
nouveau_bo_map
(
pushbuf
);
if
(
ret
)
{
nouveau_bo_unpin
(
pushbuf
);
nouveau_bo_ref
(
NULL
,
&
pushbuf
);
return
NULL
;
NV_ERROR
(
dev
,
"error initialising pushbuf: %d
\n
"
,
ret
);
nouveau_gpuobj_ref
(
NULL
,
&
chan
->
pushbuf
);
if
(
chan
->
pushbuf_bo
)
{
nouveau_bo_unmap
(
chan
->
pushbuf_bo
);
nouveau_bo_ref
(
NULL
,
&
chan
->
pushbuf_bo
);
}
}
return
pushbuf
;
return
0
;
}
/* allocates and initializes a fifo for user space consumption */
...
...
@@ -162,19 +153,14 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
INIT_LIST_HEAD
(
&
chan
->
nvsw
.
flip
);
INIT_LIST_HEAD
(
&
chan
->
fence
.
pending
);
/* Allocate DMA push buffer */
chan
->
pushbuf_bo
=
nouveau_channel_user_pushbuf_alloc
(
dev
);
if
(
!
chan
->
pushbuf_bo
)
{
ret
=
-
ENOMEM
;
NV_ERROR
(
dev
,
"pushbuf %d
\n
"
,
ret
);
/* setup channel's memory and vm */
ret
=
nouveau_gpuobj_channel_init
(
chan
,
vram_handle
,
gart_handle
);
if
(
ret
)
{
NV_ERROR
(
dev
,
"gpuobj %d
\n
"
,
ret
);
nouveau_channel_put
(
&
chan
);
return
ret
;
}
nouveau_dma_pre_init
(
chan
);
chan
->
user_put
=
0x40
;
chan
->
user_get
=
0x44
;
/* Allocate space for per-channel fixed notifier memory */
ret
=
nouveau_notifier_init_channel
(
chan
);
if
(
ret
)
{
...
...
@@ -183,21 +169,17 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
return
ret
;
}
/*
Setup channel's default objects
*/
ret
=
nouveau_
gpuobj_channel_init
(
chan
,
vram_handle
,
gart_handle
);
/*
Allocate DMA push buffer
*/
ret
=
nouveau_
channel_pushbuf_init
(
chan
);
if
(
ret
)
{
NV_ERROR
(
dev
,
"
gpuobj
%d
\n
"
,
ret
);
NV_ERROR
(
dev
,
"
pushbuf
%d
\n
"
,
ret
);
nouveau_channel_put
(
&
chan
);
return
ret
;
}
/* Create a dma object for the push buffer */
ret
=
nouveau_channel_pushbuf_ctxdma_init
(
chan
);
if
(
ret
)
{
NV_ERROR
(
dev
,
"pbctxdma %d
\n
"
,
ret
);
nouveau_channel_put
(
&
chan
);
return
ret
;
}
nouveau_dma_pre_init
(
chan
);
chan
->
user_put
=
0x40
;
chan
->
user_get
=
0x44
;
/* disable the fifo caches */
pfifo
->
reassign
(
dev
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录