Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
a1e88736
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看板
提交
a1e88736
编写于
8月 20, 2015
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/device: decouple from engine machinery
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
a1bfb29a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
104 addition
and
59 deletion
+104
-59
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
+7
-1
drivers/gpu/drm/nouveau/nvkm/core/client.c
drivers/gpu/drm/nouveau/nvkm/core/client.c
+8
-3
drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c
drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c
+2
-7
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+19
-18
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
+0
-2
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
+47
-6
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c
+14
-14
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
+4
-5
drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
+2
-2
未找到文件。
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
浏览文件 @
a1e88736
...
...
@@ -4,7 +4,6 @@
#include <core/event.h>
enum
nvkm_devidx
{
NVDEV_ENGINE_DEVICE
,
NVDEV_SUBDEV_VBIOS
,
/* All subdevs from DEVINIT to DEVINIT_LAST will be created before
...
...
@@ -65,7 +64,10 @@ enum nvkm_devidx {
struct
nvkm_device
{
struct
nvkm_engine
engine
;
struct
list_head
head
;
struct
mutex
mutex
;
int
refcount
;
struct
pci_dev
*
pdev
;
struct
platform_device
*
platformdev
;
...
...
@@ -210,11 +212,15 @@ enum nv_bus_type {
NVKM_BUS_PLATFORM
,
};
extern
struct
nvkm_ofuncs
nvkm_udevice_ofuncs
;
int
nvkm_device_new
(
void
*
,
enum
nv_bus_type
type
,
u64
name
,
const
char
*
sname
,
const
char
*
cfg
,
const
char
*
dbg
,
bool
detect
,
bool
mmio
,
u64
subdev_mask
,
struct
nvkm_device
**
);
void
nvkm_device_del
(
struct
nvkm_device
**
);
int
nvkm_device_init
(
struct
nvkm_device
*
);
int
nvkm_device_fini
(
struct
nvkm_device
*
,
bool
suspend
);
/* device logging */
#define nvdev_printk_(d,l,p,f,a...) do { \
...
...
drivers/gpu/drm/nouveau/nvkm/core/client.c
浏览文件 @
a1e88736
...
...
@@ -226,6 +226,12 @@ nvkm_client_del(struct nvkm_client **pclient)
}
}
static
struct
nvkm_oclass
nvkm_client_sclass
[]
=
{
{
NV_DEVICE
,
&
nvkm_udevice_ofuncs
},
{}
};
int
nvkm_client_new
(
const
char
*
name
,
u64
devname
,
const
char
*
cfg
,
const
char
*
dbg
,
struct
nvkm_client
**
pclient
)
...
...
@@ -239,9 +245,8 @@ nvkm_client_new(const char *name, u64 devname, const char *cfg,
return
-
ENODEV
;
ret
=
nvkm_namedb_create
(
NULL
,
NULL
,
&
nvkm_client_oclass
,
NV_CLIENT_CLASS
,
NULL
,
(
1ULL
<<
NVDEV_ENGINE_DEVICE
),
&
client
);
NV_CLIENT_CLASS
,
nvkm_client_sclass
,
0
,
&
client
);
*
pclient
=
client
;
if
(
ret
)
return
ret
;
...
...
drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c
浏览文件 @
a1e88736
...
...
@@ -216,7 +216,6 @@ nvkm_gpuobj_new(struct nvkm_object *parent, struct nvkm_object *pargpu,
u32
size
,
u32
align
,
u32
flags
,
struct
nvkm_gpuobj
**
pgpuobj
)
{
struct
nvkm_object
*
engine
=
parent
;
struct
nvkm_gpuobj_class
args
=
{
.
pargpu
=
pargpu
,
.
size
=
size
,
...
...
@@ -224,12 +223,8 @@ nvkm_gpuobj_new(struct nvkm_object *parent, struct nvkm_object *pargpu,
.
flags
=
flags
,
};
if
(
!
nv_iclass
(
engine
,
NV_SUBDEV_CLASS
))
engine
=
&
engine
->
engine
->
subdev
.
object
;
BUG_ON
(
engine
==
NULL
);
return
nvkm_object_ctor
(
parent
,
engine
,
&
_nvkm_gpuobj_oclass
,
&
args
,
sizeof
(
args
),
return
nvkm_object_ctor
(
parent
,
&
parent
->
engine
->
subdev
.
object
,
&
_nvkm_gpuobj_oclass
,
&
args
,
sizeof
(
args
),
(
struct
nvkm_object
**
)
pgpuobj
);
}
...
...
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
浏览文件 @
a1e88736
...
...
@@ -31,7 +31,7 @@ nvkm_subdev(void *obj, int idx)
struct
nvkm_object
*
object
=
nv_object
(
obj
);
while
(
object
&&
!
nv_iclass
(
object
,
NV_SUBDEV_CLASS
))
object
=
object
->
parent
;
if
(
object
==
NULL
||
nv_subidx
(
nv_subdev
(
object
))
!=
idx
)
if
(
object
==
NULL
||
!
object
->
parent
||
nv_subidx
(
nv_subdev
(
object
))
!=
idx
)
object
=
nv_device
(
obj
)
->
subdev
[
idx
];
return
object
?
nv_subdev
(
object
)
:
NULL
;
}
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
浏览文件 @
a1e88736
...
...
@@ -61,13 +61,24 @@ nvkm_device_list(u64 *name, int size)
return
nr
;
}
#include <core/parent.h>
struct
nvkm_device
*
nv_device
(
void
*
obj
)
{
struct
nvkm_object
*
device
=
nv_object
(
obj
);
if
(
device
->
engine
==
NULL
)
{
while
(
device
&&
device
->
parent
)
while
(
device
&&
device
->
parent
)
{
if
(
nv_mclass
(
device
)
==
0x0080
)
{
struct
{
struct
nvkm_parent
base
;
struct
nvkm_device
*
device
;
}
*
udevice
=
(
void
*
)
device
;
return
udevice
->
device
;
}
device
=
device
->
parent
;
}
}
else
{
device
=
&
nv_object
(
obj
)
->
engine
->
subdev
.
object
;
if
(
device
&&
device
->
parent
)
...
...
@@ -79,12 +90,6 @@ nv_device(void *obj)
return
(
void
*
)
device
;
}
static
struct
nvkm_oclass
nvkm_device_sclass
[]
=
{
{
0x0080
,
&
nvkm_udevice_ofuncs
},
{}
};
static
int
nvkm_device_event_ctor
(
struct
nvkm_object
*
object
,
void
*
data
,
u32
size
,
struct
nvkm_notify
*
notify
)
...
...
@@ -103,10 +108,9 @@ nvkm_device_event_func = {
.
ctor
=
nvkm_device_event_ctor
,
};
static
int
nvkm_device_fini
(
struct
nvkm_
object
*
object
,
bool
suspend
)
int
nvkm_device_fini
(
struct
nvkm_
device
*
device
,
bool
suspend
)
{
struct
nvkm_device
*
device
=
(
void
*
)
object
;
struct
nvkm_object
*
subdev
;
int
ret
,
i
;
...
...
@@ -136,10 +140,9 @@ nvkm_device_fini(struct nvkm_object *object, bool suspend)
return
ret
;
}
static
int
nvkm_device_init
(
struct
nvkm_
object
*
object
)
int
nvkm_device_init
(
struct
nvkm_
device
*
device
)
{
struct
nvkm_device
*
device
=
(
void
*
)
object
;
struct
nvkm_object
*
subdev
;
int
ret
,
i
=
0
,
c
;
...
...
@@ -147,7 +150,7 @@ nvkm_device_init(struct nvkm_object *object)
if
(
ret
)
goto
fail
;
for
(
i
=
1
,
c
=
1
;
i
<
NVDEV_SUBDEV_NR
;
i
++
)
{
for
(
i
=
0
,
c
=
0
;
i
<
NVDEV_SUBDEV_NR
;
i
++
)
{
#define _(s,m) case s: if (device->oclass[s] && !device->subdev[s]) { \
ret = nvkm_object_ctor(nv_object(device), NULL, \
device->oclass[s], NULL, (s), \
...
...
@@ -286,10 +289,7 @@ nv_device_get_irq(struct nvkm_device *device, bool stall)
static
struct
nvkm_oclass
nvkm_device_oclass
=
{
.
handle
=
NV_ENGINE
(
DEVICE
,
0x00
),
.
ofuncs
=
&
(
struct
nvkm_ofuncs
)
{
.
init
=
nvkm_device_init
,
.
fini
=
nvkm_device_fini
,
},
};
...
...
@@ -356,7 +356,6 @@ nvkm_device_new(void *dev, enum nv_bus_type type, u64 name,
device
->
name
=
sname
;
nv_subdev
(
device
)
->
debug
=
nvkm_dbgopt
(
device
->
dbgopt
,
"DEVICE"
);
nv_engine
(
device
)
->
sclass
=
nvkm_device_sclass
;
list_add_tail
(
&
device
->
head
,
&
nv_devices
);
ret
=
nvkm_event_init
(
&
nvkm_device_event_func
,
1
,
1
,
&
device
->
event
);
...
...
@@ -482,6 +481,8 @@ nvkm_device_new(void *dev, enum nv_bus_type type, u64 name,
device
->
oclass
[
i
]
=
NULL
;
}
atomic_set
(
&
device
->
engine
.
subdev
.
object
.
usecount
,
2
);
mutex_init
(
&
device
->
mutex
);
done:
mutex_unlock
(
&
nv_devices_mutex
);
return
ret
;
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
浏览文件 @
a1e88736
...
...
@@ -13,6 +13,4 @@ int nv50_identify(struct nvkm_device *);
int
gf100_identify
(
struct
nvkm_device
*
);
int
gk104_identify
(
struct
nvkm_device
*
);
int
gm100_identify
(
struct
nvkm_device
*
);
extern
struct
nvkm_ofuncs
nvkm_udevice_ofuncs
;
#endif
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
浏览文件 @
a1e88736
...
...
@@ -173,13 +173,55 @@ nvkm_udevice_map(struct nvkm_object *object, u64 *addr, u32 *size)
return
0
;
}
static
int
nvkm_udevice_fini
(
struct
nvkm_object
*
object
,
bool
suspend
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
struct
nvkm_device
*
device
=
udev
->
device
;
int
ret
=
0
;
mutex_lock
(
&
device
->
mutex
);
if
(
!--
device
->
refcount
)
{
ret
=
nvkm_device_fini
(
device
,
suspend
);
if
(
ret
&&
suspend
)
{
device
->
refcount
++
;
goto
done
;
}
}
done:
mutex_unlock
(
&
device
->
mutex
);
return
ret
;
}
static
int
nvkm_udevice_init
(
struct
nvkm_object
*
object
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
struct
nvkm_device
*
device
=
udev
->
device
;
int
ret
=
0
;
mutex_lock
(
&
device
->
mutex
);
if
(
!
device
->
refcount
++
)
{
ret
=
nvkm_device_init
(
device
);
if
(
ret
)
{
device
->
refcount
--
;
goto
done
;
}
}
done:
mutex_unlock
(
&
device
->
mutex
);
return
ret
;
}
static
struct
nvkm_oclass
nvkm_udevice_oclass_super
=
{
.
handle
=
NV_DEVICE
,
.
ofuncs
=
&
(
struct
nvkm_ofuncs
)
{
.
dtor
=
_nvkm_parent_dtor
,
.
init
=
_nvkm_parent
_init
,
.
fini
=
_nvkm_parent
_fini
,
.
init
=
nvkm_udevice
_init
,
.
fini
=
nvkm_udevice
_fini
,
.
mthd
=
nvkm_udevice_mthd
,
.
map
=
nvkm_udevice_map
,
.
rd08
=
nvkm_udevice_rd08
,
...
...
@@ -223,8 +265,7 @@ nvkm_udevice_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
return
-
ENODEV
;
}
ret
=
nvkm_parent_create
(
parent
,
nv_object
(
device
),
oclass
,
0
,
nvkm_control_oclass
,
ret
=
nvkm_parent_create
(
parent
,
NULL
,
oclass
,
0
,
nvkm_control_oclass
,
(
1ULL
<<
NVDEV_ENGINE_DMAOBJ
)
|
(
1ULL
<<
NVDEV_ENGINE_FIFO
)
|
(
1ULL
<<
NVDEV_ENGINE_DISP
)
|
...
...
@@ -241,7 +282,7 @@ struct nvkm_ofuncs
nvkm_udevice_ofuncs
=
{
.
ctor
=
nvkm_udevice_ctor
,
.
dtor
=
_nvkm_parent_dtor
,
.
init
=
_nvkm_parent
_init
,
.
fini
=
_nvkm_parent
_fini
,
.
init
=
nvkm_udevice
_init
,
.
fini
=
nvkm_udevice
_fini
,
.
mthd
=
nvkm_udevice_mthd
,
};
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c
浏览文件 @
a1e88736
...
...
@@ -26,7 +26,7 @@
#include "outpdp.h"
#include <core/client.h>
#include <core/
engctx
.h>
#include <core/
gpuobj
.h>
#include <core/enum.h>
#include <core/handle.h>
#include <core/ramht.h>
...
...
@@ -1292,8 +1292,8 @@ nv50_disp_data_ctor(struct nvkm_object *parent,
struct
nvkm_object
**
pobject
)
{
struct
nv50_disp
*
disp
=
(
void
*
)
engine
;
struct
nvkm_
engctx
*
ectx
;
int
ret
=
-
EBUSY
;
struct
nvkm_
gpuobj
*
gpuobj
;
int
ret
;
/* no context needed for channel objects... */
if
(
nv_mclass
(
parent
)
!=
NV_DEVICE
)
{
...
...
@@ -1303,26 +1303,26 @@ nv50_disp_data_ctor(struct nvkm_object *parent,
}
/* allocate display hardware to client */
ret
=
nvkm_gpuobj_create
(
parent
,
engine
,
oclass
,
0
,
NULL
,
0x10000
,
0x10000
,
NVOBJ_FLAG_HEAP
,
&
gpuobj
);
*
pobject
=
nv_object
(
gpuobj
);
mutex_lock
(
&
nv_subdev
(
disp
)
->
mutex
);
if
(
list_empty
(
&
nv_engine
(
disp
)
->
contexts
))
{
ret
=
nvkm_engctx_create
(
parent
,
engine
,
oclass
,
NULL
,
0x10000
,
0x10000
,
NVOBJ_FLAG_HEAP
,
&
ectx
);
*
pobject
=
nv_object
(
ectx
);
}
if
(
!
list_empty
(
&
nv_engine
(
disp
)
->
contexts
))
ret
=
-
EBUSY
;
mutex_unlock
(
&
nv_subdev
(
disp
)
->
mutex
);
return
ret
;
}
struct
nvkm_oclass
nv50_disp_cclass
=
{
.
handle
=
NV_ENGCTX
(
DISP
,
0x50
),
.
ofuncs
=
&
(
struct
nvkm_ofuncs
)
{
.
ctor
=
nv50_disp_data_ctor
,
.
dtor
=
_nvkm_
engctx
_dtor
,
.
init
=
_nvkm_
engctx
_init
,
.
fini
=
_nvkm_
engctx
_fini
,
.
rd32
=
_nvkm_
engctx
_rd32
,
.
wr32
=
_nvkm_
engctx
_wr32
,
.
dtor
=
_nvkm_
gpuobj
_dtor
,
.
init
=
_nvkm_
gpuobj
_init
,
.
fini
=
_nvkm_
gpuobj
_fini
,
.
rd32
=
_nvkm_
gpuobj
_rd32
,
.
wr32
=
_nvkm_
gpuobj
_wr32
,
},
};
...
...
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
浏览文件 @
a1e88736
...
...
@@ -639,7 +639,7 @@ nvkm_perfctx_dtor(struct nvkm_object *object)
struct
nvkm_perfctx
*
ctx
=
(
void
*
)
object
;
mutex_lock
(
&
nv_subdev
(
pm
)
->
mutex
);
nvkm_
engctx
_destroy
(
&
ctx
->
base
);
nvkm_
gpuobj
_destroy
(
&
ctx
->
base
);
if
(
pm
->
context
==
ctx
)
pm
->
context
=
NULL
;
mutex_unlock
(
&
nv_subdev
(
pm
)
->
mutex
);
...
...
@@ -661,7 +661,7 @@ nvkm_perfctx_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
return
1
;
}
ret
=
nvkm_
engctx_create
(
parent
,
engine
,
oclass
,
NULL
,
0
,
0
,
0
,
&
ctx
);
ret
=
nvkm_
gpuobj_create
(
parent
,
engine
,
oclass
,
0
,
NULL
,
0
,
0
,
0
,
&
ctx
);
*
pobject
=
nv_object
(
ctx
);
if
(
ret
)
return
ret
;
...
...
@@ -678,12 +678,11 @@ nvkm_perfctx_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct
nvkm_oclass
nvkm_pm_cclass
=
{
.
handle
=
NV_ENGCTX
(
PM
,
0x00
),
.
ofuncs
=
&
(
struct
nvkm_ofuncs
)
{
.
ctor
=
nvkm_perfctx_ctor
,
.
dtor
=
nvkm_perfctx_dtor
,
.
init
=
_nvkm_
engctx
_init
,
.
fini
=
_nvkm_
engctx
_fini
,
.
init
=
_nvkm_
gpuobj
_init
,
.
fini
=
_nvkm_
gpuobj
_fini
,
},
};
...
...
drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
浏览文件 @
a1e88736
...
...
@@ -14,10 +14,10 @@ struct nvkm_perfctr {
extern
struct
nvkm_oclass
nvkm_pm_sclass
[];
#include <core/
engctx
.h>
#include <core/
gpuobj
.h>
struct
nvkm_perfctx
{
struct
nvkm_
engctx
base
;
struct
nvkm_
gpuobj
base
;
};
extern
struct
nvkm_oclass
nvkm_pm_cclass
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录