Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
6de8a748
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6de8a748
编写于
10月 25, 2011
作者:
D
Daniel Vetter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/sis: track user->memblock mapping with idr
Signed-off-by:
N
Daniel Vetter
<
daniel.vetter@ffwll.ch
>
上级
77ee8f38
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
14 deletion
+51
-14
drivers/gpu/drm/sis/sis_drv.c
drivers/gpu/drm/sis/sis_drv.c
+4
-0
drivers/gpu/drm/sis/sis_drv.h
drivers/gpu/drm/sis/sis_drv.h
+2
-0
drivers/gpu/drm/sis/sis_mm.c
drivers/gpu/drm/sis/sis_mm.c
+43
-14
drivers/gpu/drm/via/via_map.c
drivers/gpu/drm/via/via_map.c
+2
-0
未找到文件。
drivers/gpu/drm/sis/sis_drv.c
浏览文件 @
6de8a748
...
...
@@ -48,6 +48,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
dev
->
dev_private
=
(
void
*
)
dev_priv
;
dev_priv
->
chipset
=
chipset
;
idr_init
(
&
dev
->
object_name_idr
);
ret
=
drm_sman_init
(
&
dev_priv
->
sman
,
2
,
12
,
8
);
if
(
ret
)
kfree
(
dev_priv
);
...
...
@@ -60,6 +61,9 @@ static int sis_driver_unload(struct drm_device *dev)
drm_sis_private_t
*
dev_priv
=
dev
->
dev_private
;
drm_sman_takedown
(
&
dev_priv
->
sman
);
idr_remove_all
(
&
dev_priv
->
object_idr
);
idr_destroy
(
&
dev_priv
->
object_idr
);
kfree
(
dev_priv
);
return
0
;
...
...
drivers/gpu/drm/sis/sis_drv.h
浏览文件 @
6de8a748
...
...
@@ -60,6 +60,8 @@ typedef struct drm_sis_private {
int
agp_initialized
;
unsigned
long
vram_offset
;
unsigned
long
agp_offset
;
/** Mapping of userspace keys to mm objects */
struct
idr
object_idr
;
}
drm_sis_private_t
;
extern
int
sis_idle
(
struct
drm_device
*
dev
);
...
...
drivers/gpu/drm/sis/sis_mm.c
浏览文件 @
6de8a748
...
...
@@ -125,7 +125,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file,
{
drm_sis_private_t
*
dev_priv
=
dev
->
dev_private
;
drm_sis_mem_t
*
mem
=
data
;
int
retval
=
0
;
int
retval
=
0
,
user_key
;
struct
drm_memblock_item
*
item
;
struct
sis_file_private
*
file_priv
=
file
->
driver_priv
;
...
...
@@ -141,23 +141,44 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file,
mem
->
size
=
(
mem
->
size
+
SIS_MM_ALIGN_MASK
)
>>
SIS_MM_ALIGN_SHIFT
;
item
=
drm_sman_alloc
(
&
dev_priv
->
sman
,
pool
,
mem
->
size
,
0
,
0
);
if
(
!
item
)
{
retval
=
-
ENOMEM
;
goto
fail_alloc
;
}
if
(
item
)
{
list_add
(
&
item
->
owner_list
,
&
file_priv
->
obj_list
);
mem
->
offset
=
((
pool
==
0
)
?
dev_priv
->
vram_offset
:
dev_priv
->
agp_offset
)
+
(
item
->
mm
->
offset
(
item
->
mm
,
item
->
mm_info
)
<<
SIS_MM_ALIGN_SHIFT
);
mem
->
free
=
item
->
user_hash
.
key
;
mem
->
size
=
mem
->
size
<<
SIS_MM_ALIGN_SHIFT
;
}
else
{
mem
->
offset
=
0
;
mem
->
size
=
0
;
mem
->
free
=
0
;
again:
if
(
idr_pre_get
(
&
dev_priv
->
object_idr
,
GFP_KERNEL
)
==
0
)
{
retval
=
-
ENOMEM
;
goto
fail_idr
;
}
retval
=
idr_get_new_above
(
&
dev_priv
->
object_idr
,
item
,
1
,
&
user_key
);
if
(
retval
==
-
EAGAIN
)
goto
again
;
if
(
retval
)
goto
fail_idr
;
list_add
(
&
item
->
owner_list
,
&
file_priv
->
obj_list
);
mutex_unlock
(
&
dev
->
struct_mutex
);
mem
->
offset
=
((
pool
==
0
)
?
dev_priv
->
vram_offset
:
dev_priv
->
agp_offset
)
+
(
item
->
mm
->
offset
(
item
->
mm
,
item
->
mm_info
)
<<
SIS_MM_ALIGN_SHIFT
);
mem
->
free
=
user_key
;
mem
->
size
=
mem
->
size
<<
SIS_MM_ALIGN_SHIFT
;
return
0
;
fail_idr:
drm_sman_free
(
item
);
fail_alloc:
mutex_unlock
(
&
dev
->
struct_mutex
);
mem
->
offset
=
0
;
mem
->
size
=
0
;
mem
->
free
=
0
;
DRM_DEBUG
(
"alloc %d, size = %d, offset = %d
\n
"
,
pool
,
mem
->
size
,
mem
->
offset
);
...
...
@@ -168,10 +189,18 @@ static int sis_drm_free(struct drm_device *dev, void *data, struct drm_file *fil
{
drm_sis_private_t
*
dev_priv
=
dev
->
dev_private
;
drm_sis_mem_t
*
mem
=
data
;
struct
drm_memblock_item
*
obj
;
int
ret
;
mutex_lock
(
&
dev
->
struct_mutex
);
ret
=
drm_sman_free_key
(
&
dev_priv
->
sman
,
mem
->
free
);
obj
=
idr_find
(
&
dev_priv
->
object_idr
,
mem
->
free
);
if
(
obj
==
NULL
)
{
mutex_unlock
(
&
dev
->
struct_mutex
);
return
-
EINVAL
;
}
idr_remove
(
&
dev_priv
->
object_idr
,
mem
->
free
);
drm_sman_free
(
obj
);
mutex_unlock
(
&
dev
->
struct_mutex
);
DRM_DEBUG
(
"free = 0x%lx
\n
"
,
mem
->
free
);
...
...
drivers/gpu/drm/via/via_map.c
浏览文件 @
6de8a748
...
...
@@ -126,6 +126,8 @@ int via_driver_unload(struct drm_device *dev)
drm_via_private_t
*
dev_priv
=
dev
->
dev_private
;
drm_sman_takedown
(
&
dev_priv
->
sman
);
idr_remove_all
(
&
dev_priv
->
object_idr
);
idr_destroy
(
&
dev_priv
->
object_idr
);
kfree
(
dev_priv
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录