Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
814a2324
Commit
814a2324
authored
Nov 01, 2017
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau: implement per-client delayed workqueue with fence support
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
7f507624
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/nouveau/nouveau_drm.c
+56
-0
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/nouveau/nouveau_drv.h
+14
-0
No files found.
drivers/gpu/drm/nouveau/nouveau_drm.c
View file @
814a2324
...
@@ -111,9 +111,63 @@ nouveau_name(struct drm_device *dev)
...
@@ -111,9 +111,63 @@ nouveau_name(struct drm_device *dev)
return
nouveau_platform_name
(
to_platform_device
(
dev
->
dev
));
return
nouveau_platform_name
(
to_platform_device
(
dev
->
dev
));
}
}
static
inline
bool
nouveau_cli_work_ready
(
struct
dma_fence
*
fence
,
bool
wait
)
{
if
(
!
dma_fence_is_signaled
(
fence
))
{
if
(
!
wait
)
return
false
;
WARN_ON
(
dma_fence_wait_timeout
(
fence
,
false
,
2
*
HZ
)
<=
0
);
}
dma_fence_put
(
fence
);
return
true
;
}
static
void
nouveau_cli_work_flush
(
struct
nouveau_cli
*
cli
,
bool
wait
)
{
struct
nouveau_cli_work
*
work
,
*
wtmp
;
mutex_lock
(
&
cli
->
lock
);
list_for_each_entry_safe
(
work
,
wtmp
,
&
cli
->
worker
,
head
)
{
if
(
!
work
->
fence
||
nouveau_cli_work_ready
(
work
->
fence
,
wait
))
{
list_del
(
&
work
->
head
);
work
->
func
(
work
);
}
}
mutex_unlock
(
&
cli
->
lock
);
}
static
void
nouveau_cli_work_fence
(
struct
dma_fence
*
fence
,
struct
dma_fence_cb
*
cb
)
{
struct
nouveau_cli_work
*
work
=
container_of
(
cb
,
typeof
(
*
work
),
cb
);
schedule_work
(
&
work
->
cli
->
work
);
}
void
nouveau_cli_work_queue
(
struct
nouveau_cli
*
cli
,
struct
dma_fence
*
fence
,
struct
nouveau_cli_work
*
work
)
{
work
->
fence
=
dma_fence_get
(
fence
);
work
->
cli
=
cli
;
mutex_lock
(
&
cli
->
lock
);
list_add_tail
(
&
work
->
head
,
&
cli
->
worker
);
mutex_unlock
(
&
cli
->
lock
);
if
(
dma_fence_add_callback
(
fence
,
&
work
->
cb
,
nouveau_cli_work_fence
))
nouveau_cli_work_fence
(
fence
,
&
work
->
cb
);
}
static
void
nouveau_cli_work
(
struct
work_struct
*
w
)
{
struct
nouveau_cli
*
cli
=
container_of
(
w
,
typeof
(
*
cli
),
work
);
nouveau_cli_work_flush
(
cli
,
false
);
}
static
void
static
void
nouveau_cli_fini
(
struct
nouveau_cli
*
cli
)
nouveau_cli_fini
(
struct
nouveau_cli
*
cli
)
{
{
nouveau_cli_work_flush
(
cli
,
true
);
usif_client_fini
(
cli
);
usif_client_fini
(
cli
);
nouveau_vmm_fini
(
&
cli
->
vmm
);
nouveau_vmm_fini
(
&
cli
->
vmm
);
nvif_mmu_fini
(
&
cli
->
mmu
);
nvif_mmu_fini
(
&
cli
->
mmu
);
...
@@ -158,6 +212,8 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
...
@@ -158,6 +212,8 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
mutex_init
(
&
cli
->
mutex
);
mutex_init
(
&
cli
->
mutex
);
usif_client_init
(
cli
);
usif_client_init
(
cli
);
INIT_WORK
(
&
cli
->
work
,
nouveau_cli_work
);
INIT_LIST_HEAD
(
&
cli
->
worker
);
mutex_init
(
&
cli
->
lock
);
mutex_init
(
&
cli
->
lock
);
if
(
cli
==
&
drm
->
master
)
{
if
(
cli
==
&
drm
->
master
)
{
...
...
drivers/gpu/drm/nouveau/nouveau_drv.h
View file @
814a2324
...
@@ -104,9 +104,23 @@ struct nouveau_cli {
...
@@ -104,9 +104,23 @@ struct nouveau_cli {
struct
list_head
notifys
;
struct
list_head
notifys
;
char
name
[
32
];
char
name
[
32
];
struct
work_struct
work
;
struct
list_head
worker
;
struct
mutex
lock
;
struct
mutex
lock
;
};
};
struct
nouveau_cli_work
{
void
(
*
func
)(
struct
nouveau_cli_work
*
);
struct
nouveau_cli
*
cli
;
struct
list_head
head
;
struct
dma_fence
*
fence
;
struct
dma_fence_cb
cb
;
};
void
nouveau_cli_work_queue
(
struct
nouveau_cli
*
,
struct
dma_fence
*
,
struct
nouveau_cli_work
*
);
static
inline
struct
nouveau_cli
*
static
inline
struct
nouveau_cli
*
nouveau_cli
(
struct
drm_file
*
fpriv
)
nouveau_cli
(
struct
drm_file
*
fpriv
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment