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
Kirill Smelkov
linux
Commits
264ce192
Commit
264ce192
authored
Feb 14, 2013
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nv84-/fence: prepare for emit/sync support of sysram sequences
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
827520ce
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
62 deletions
+65
-62
drivers/gpu/drm/nouveau/nouveau_bo.c
drivers/gpu/drm/nouveau/nouveau_bo.c
+1
-1
drivers/gpu/drm/nouveau/nouveau_chan.c
drivers/gpu/drm/nouveau/nouveau_chan.c
+1
-1
drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/nouveau/nouveau_display.c
+1
-1
drivers/gpu/drm/nouveau/nouveau_fence.c
drivers/gpu/drm/nouveau/nouveau_fence.c
+4
-5
drivers/gpu/drm/nouveau/nouveau_fence.h
drivers/gpu/drm/nouveau/nouveau_fence.h
+6
-12
drivers/gpu/drm/nouveau/nouveau_gem.c
drivers/gpu/drm/nouveau/nouveau_gem.c
+1
-1
drivers/gpu/drm/nouveau/nv84_fence.c
drivers/gpu/drm/nouveau/nv84_fence.c
+48
-11
drivers/gpu/drm/nouveau/nvc0_fence.c
drivers/gpu/drm/nouveau/nvc0_fence.c
+3
-30
No files found.
drivers/gpu/drm/nouveau/nouveau_bo.c
View file @
264ce192
...
@@ -561,7 +561,7 @@ nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan,
...
@@ -561,7 +561,7 @@ nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan,
struct
nouveau_fence
*
fence
=
NULL
;
struct
nouveau_fence
*
fence
=
NULL
;
int
ret
;
int
ret
;
ret
=
nouveau_fence_new
(
chan
,
&
fence
);
ret
=
nouveau_fence_new
(
chan
,
false
,
&
fence
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
...
...
drivers/gpu/drm/nouveau/nouveau_chan.c
View file @
264ce192
...
@@ -51,7 +51,7 @@ nouveau_channel_idle(struct nouveau_channel *chan)
...
@@ -51,7 +51,7 @@ nouveau_channel_idle(struct nouveau_channel *chan)
struct
nouveau_fence
*
fence
=
NULL
;
struct
nouveau_fence
*
fence
=
NULL
;
int
ret
;
int
ret
;
ret
=
nouveau_fence_new
(
chan
,
&
fence
);
ret
=
nouveau_fence_new
(
chan
,
false
,
&
fence
);
if
(
!
ret
)
{
if
(
!
ret
)
{
ret
=
nouveau_fence_wait
(
fence
,
false
,
false
);
ret
=
nouveau_fence_wait
(
fence
,
false
,
false
);
nouveau_fence_unref
(
&
fence
);
nouveau_fence_unref
(
&
fence
);
...
...
drivers/gpu/drm/nouveau/nouveau_display.c
View file @
264ce192
...
@@ -540,7 +540,7 @@ nouveau_page_flip_emit(struct nouveau_channel *chan,
...
@@ -540,7 +540,7 @@ nouveau_page_flip_emit(struct nouveau_channel *chan,
}
}
FIRE_RING
(
chan
);
FIRE_RING
(
chan
);
ret
=
nouveau_fence_new
(
chan
,
pfence
);
ret
=
nouveau_fence_new
(
chan
,
false
,
pfence
);
if
(
ret
)
if
(
ret
)
goto
fail
;
goto
fail
;
...
...
drivers/gpu/drm/nouveau/nouveau_fence.c
View file @
264ce192
...
@@ -41,8 +41,6 @@ nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
...
@@ -41,8 +41,6 @@ nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
struct
nouveau_fence
*
fence
,
*
fnext
;
struct
nouveau_fence
*
fence
,
*
fnext
;
spin_lock
(
&
fctx
->
lock
);
spin_lock
(
&
fctx
->
lock
);
list_for_each_entry_safe
(
fence
,
fnext
,
&
fctx
->
pending
,
head
)
{
list_for_each_entry_safe
(
fence
,
fnext
,
&
fctx
->
pending
,
head
)
{
if
(
fence
->
work
)
fence
->
work
(
fence
->
priv
,
false
);
fence
->
channel
=
NULL
;
fence
->
channel
=
NULL
;
list_del
(
&
fence
->
head
);
list_del
(
&
fence
->
head
);
nouveau_fence_unref
(
&
fence
);
nouveau_fence_unref
(
&
fence
);
...
@@ -69,8 +67,6 @@ nouveau_fence_update(struct nouveau_channel *chan)
...
@@ -69,8 +67,6 @@ nouveau_fence_update(struct nouveau_channel *chan)
if
(
fctx
->
read
(
chan
)
<
fence
->
sequence
)
if
(
fctx
->
read
(
chan
)
<
fence
->
sequence
)
break
;
break
;
if
(
fence
->
work
)
fence
->
work
(
fence
->
priv
,
true
);
fence
->
channel
=
NULL
;
fence
->
channel
=
NULL
;
list_del
(
&
fence
->
head
);
list_del
(
&
fence
->
head
);
nouveau_fence_unref
(
&
fence
);
nouveau_fence_unref
(
&
fence
);
...
@@ -256,7 +252,8 @@ nouveau_fence_ref(struct nouveau_fence *fence)
...
@@ -256,7 +252,8 @@ nouveau_fence_ref(struct nouveau_fence *fence)
}
}
int
int
nouveau_fence_new
(
struct
nouveau_channel
*
chan
,
struct
nouveau_fence
**
pfence
)
nouveau_fence_new
(
struct
nouveau_channel
*
chan
,
bool
sysmem
,
struct
nouveau_fence
**
pfence
)
{
{
struct
nouveau_fence
*
fence
;
struct
nouveau_fence
*
fence
;
int
ret
=
0
;
int
ret
=
0
;
...
@@ -267,6 +264,8 @@ nouveau_fence_new(struct nouveau_channel *chan, struct nouveau_fence **pfence)
...
@@ -267,6 +264,8 @@ nouveau_fence_new(struct nouveau_channel *chan, struct nouveau_fence **pfence)
fence
=
kzalloc
(
sizeof
(
*
fence
),
GFP_KERNEL
);
fence
=
kzalloc
(
sizeof
(
*
fence
),
GFP_KERNEL
);
if
(
!
fence
)
if
(
!
fence
)
return
-
ENOMEM
;
return
-
ENOMEM
;
fence
->
sysmem
=
sysmem
;
kref_init
(
&
fence
->
kref
);
kref_init
(
&
fence
->
kref
);
ret
=
nouveau_fence_emit
(
fence
,
chan
);
ret
=
nouveau_fence_emit
(
fence
,
chan
);
...
...
drivers/gpu/drm/nouveau/nouveau_fence.h
View file @
264ce192
...
@@ -7,15 +7,15 @@ struct nouveau_fence {
...
@@ -7,15 +7,15 @@ struct nouveau_fence {
struct
list_head
head
;
struct
list_head
head
;
struct
kref
kref
;
struct
kref
kref
;
bool
sysmem
;
struct
nouveau_channel
*
channel
;
struct
nouveau_channel
*
channel
;
unsigned
long
timeout
;
unsigned
long
timeout
;
u32
sequence
;
u32
sequence
;
void
(
*
work
)(
void
*
priv
,
bool
signalled
);
void
*
priv
;
};
};
int
nouveau_fence_new
(
struct
nouveau_channel
*
,
struct
nouveau_fence
**
);
int
nouveau_fence_new
(
struct
nouveau_channel
*
,
bool
sysmem
,
struct
nouveau_fence
**
);
struct
nouveau_fence
*
struct
nouveau_fence
*
nouveau_fence_ref
(
struct
nouveau_fence
*
);
nouveau_fence_ref
(
struct
nouveau_fence
*
);
void
nouveau_fence_unref
(
struct
nouveau_fence
**
);
void
nouveau_fence_unref
(
struct
nouveau_fence
**
);
...
@@ -79,24 +79,18 @@ int nouveau_flip_complete(void *chan);
...
@@ -79,24 +79,18 @@ int nouveau_flip_complete(void *chan);
struct
nv84_fence_chan
{
struct
nv84_fence_chan
{
struct
nouveau_fence_chan
base
;
struct
nouveau_fence_chan
base
;
struct
nouveau_vma
vma
;
struct
nouveau_vma
vma
;
struct
nouveau_vma
vma_gart
;
struct
nouveau_vma
dispc_vma
[
4
];
struct
nouveau_vma
dispc_vma
[
4
];
};
};
struct
nv84_fence_priv
{
struct
nv84_fence_priv
{
struct
nouveau_fence_priv
base
;
struct
nouveau_fence_priv
base
;
struct
nouveau_bo
*
bo
;
struct
nouveau_bo
*
bo
;
struct
nouveau_bo
*
bo_gart
;
u32
*
suspend
;
u32
*
suspend
;
};
};
u64
nv84_fence_crtc
(
struct
nouveau_channel
*
,
int
);
u64
nv84_fence_crtc
(
struct
nouveau_channel
*
,
int
);
int
nv84_fence_emit
(
struct
nouveau_fence
*
);
int
nv84_fence_sync
(
struct
nouveau_fence
*
,
struct
nouveau_channel
*
,
struct
nouveau_channel
*
);
u32
nv84_fence_read
(
struct
nouveau_channel
*
);
int
nv84_fence_context_new
(
struct
nouveau_channel
*
);
int
nv84_fence_context_new
(
struct
nouveau_channel
*
);
void
nv84_fence_context_del
(
struct
nouveau_channel
*
);
bool
nv84_fence_suspend
(
struct
nouveau_drm
*
);
void
nv84_fence_resume
(
struct
nouveau_drm
*
);
void
nv84_fence_destroy
(
struct
nouveau_drm
*
);
#endif
#endif
drivers/gpu/drm/nouveau/nouveau_gem.c
View file @
264ce192
...
@@ -787,7 +787,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
...
@@ -787,7 +787,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
}
}
}
}
ret
=
nouveau_fence_new
(
chan
,
&
fence
);
ret
=
nouveau_fence_new
(
chan
,
false
,
&
fence
);
if
(
ret
)
{
if
(
ret
)
{
NV_ERROR
(
cli
,
"error fencing pushbuf: %d
\n
"
,
ret
);
NV_ERROR
(
cli
,
"error fencing pushbuf: %d
\n
"
,
ret
);
WIND_RING
(
chan
);
WIND_RING
(
chan
);
...
...
drivers/gpu/drm/nouveau/nv84_fence.c
View file @
264ce192
...
@@ -76,27 +76,39 @@ nv84_fence_sync32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
...
@@ -76,27 +76,39 @@ nv84_fence_sync32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
return
ret
;
return
ret
;
}
}
int
static
int
nv84_fence_emit
(
struct
nouveau_fence
*
fence
)
nv84_fence_emit
(
struct
nouveau_fence
*
fence
)
{
{
struct
nouveau_channel
*
chan
=
fence
->
channel
;
struct
nouveau_channel
*
chan
=
fence
->
channel
;
struct
nv84_fence_chan
*
fctx
=
chan
->
fence
;
struct
nv84_fence_chan
*
fctx
=
chan
->
fence
;
struct
nouveau_fifo_chan
*
fifo
=
(
void
*
)
chan
->
object
;
struct
nouveau_fifo_chan
*
fifo
=
(
void
*
)
chan
->
object
;
u64
addr
=
fctx
->
vma
.
offset
+
fifo
->
chid
*
16
;
u64
addr
=
fifo
->
chid
*
16
;
if
(
fence
->
sysmem
)
addr
+=
fctx
->
vma_gart
.
offset
;
else
addr
+=
fctx
->
vma
.
offset
;
return
fctx
->
base
.
emit32
(
chan
,
addr
,
fence
->
sequence
);
return
fctx
->
base
.
emit32
(
chan
,
addr
,
fence
->
sequence
);
}
}
int
static
int
nv84_fence_sync
(
struct
nouveau_fence
*
fence
,
nv84_fence_sync
(
struct
nouveau_fence
*
fence
,
struct
nouveau_channel
*
prev
,
struct
nouveau_channel
*
chan
)
struct
nouveau_channel
*
prev
,
struct
nouveau_channel
*
chan
)
{
{
struct
nv84_fence_chan
*
fctx
=
chan
->
fence
;
struct
nv84_fence_chan
*
fctx
=
chan
->
fence
;
struct
nouveau_fifo_chan
*
fifo
=
(
void
*
)
prev
->
object
;
struct
nouveau_fifo_chan
*
fifo
=
(
void
*
)
prev
->
object
;
u64
addr
=
fctx
->
vma
.
offset
+
fifo
->
chid
*
16
;
u64
addr
=
fifo
->
chid
*
16
;
if
(
fence
->
sysmem
)
addr
+=
fctx
->
vma_gart
.
offset
;
else
addr
+=
fctx
->
vma
.
offset
;
return
fctx
->
base
.
sync32
(
chan
,
addr
,
fence
->
sequence
);
return
fctx
->
base
.
sync32
(
chan
,
addr
,
fence
->
sequence
);
}
}
u32
static
u32
nv84_fence_read
(
struct
nouveau_channel
*
chan
)
nv84_fence_read
(
struct
nouveau_channel
*
chan
)
{
{
struct
nouveau_fifo_chan
*
fifo
=
(
void
*
)
chan
->
object
;
struct
nouveau_fifo_chan
*
fifo
=
(
void
*
)
chan
->
object
;
...
@@ -104,7 +116,7 @@ nv84_fence_read(struct nouveau_channel *chan)
...
@@ -104,7 +116,7 @@ nv84_fence_read(struct nouveau_channel *chan)
return
nouveau_bo_rd32
(
priv
->
bo
,
fifo
->
chid
*
16
/
4
);
return
nouveau_bo_rd32
(
priv
->
bo
,
fifo
->
chid
*
16
/
4
);
}
}
void
static
void
nv84_fence_context_del
(
struct
nouveau_channel
*
chan
)
nv84_fence_context_del
(
struct
nouveau_channel
*
chan
)
{
{
struct
drm_device
*
dev
=
chan
->
drm
->
dev
;
struct
drm_device
*
dev
=
chan
->
drm
->
dev
;
...
@@ -117,6 +129,7 @@ nv84_fence_context_del(struct nouveau_channel *chan)
...
@@ -117,6 +129,7 @@ nv84_fence_context_del(struct nouveau_channel *chan)
nouveau_bo_vma_del
(
bo
,
&
fctx
->
dispc_vma
[
i
]);
nouveau_bo_vma_del
(
bo
,
&
fctx
->
dispc_vma
[
i
]);
}
}
nouveau_bo_vma_del
(
priv
->
bo
,
&
fctx
->
vma_gart
);
nouveau_bo_vma_del
(
priv
->
bo
,
&
fctx
->
vma
);
nouveau_bo_vma_del
(
priv
->
bo
,
&
fctx
->
vma
);
nouveau_fence_context_del
(
&
fctx
->
base
);
nouveau_fence_context_del
(
&
fctx
->
base
);
chan
->
fence
=
NULL
;
chan
->
fence
=
NULL
;
...
@@ -144,8 +157,10 @@ nv84_fence_context_new(struct nouveau_channel *chan)
...
@@ -144,8 +157,10 @@ nv84_fence_context_new(struct nouveau_channel *chan)
fctx
->
base
.
sync32
=
nv84_fence_sync32
;
fctx
->
base
.
sync32
=
nv84_fence_sync32
;
ret
=
nouveau_bo_vma_add
(
priv
->
bo
,
client
->
vm
,
&
fctx
->
vma
);
ret
=
nouveau_bo_vma_add
(
priv
->
bo
,
client
->
vm
,
&
fctx
->
vma
);
if
(
ret
)
if
(
ret
==
0
)
{
nv84_fence_context_del
(
chan
);
ret
=
nouveau_bo_vma_add
(
priv
->
bo_gart
,
client
->
vm
,
&
fctx
->
vma_gart
);
}
/* map display semaphore buffers into channel's vm */
/* map display semaphore buffers into channel's vm */
for
(
i
=
0
;
!
ret
&&
i
<
chan
->
drm
->
dev
->
mode_config
.
num_crtc
;
i
++
)
{
for
(
i
=
0
;
!
ret
&&
i
<
chan
->
drm
->
dev
->
mode_config
.
num_crtc
;
i
++
)
{
...
@@ -154,10 +169,13 @@ nv84_fence_context_new(struct nouveau_channel *chan)
...
@@ -154,10 +169,13 @@ nv84_fence_context_new(struct nouveau_channel *chan)
}
}
nouveau_bo_wr32
(
priv
->
bo
,
fifo
->
chid
*
16
/
4
,
0x00000000
);
nouveau_bo_wr32
(
priv
->
bo
,
fifo
->
chid
*
16
/
4
,
0x00000000
);
if
(
ret
)
nv84_fence_context_del
(
chan
);
return
ret
;
return
ret
;
}
}
bool
static
bool
nv84_fence_suspend
(
struct
nouveau_drm
*
drm
)
nv84_fence_suspend
(
struct
nouveau_drm
*
drm
)
{
{
struct
nouveau_fifo
*
pfifo
=
nouveau_fifo
(
drm
->
device
);
struct
nouveau_fifo
*
pfifo
=
nouveau_fifo
(
drm
->
device
);
...
@@ -173,7 +191,7 @@ nv84_fence_suspend(struct nouveau_drm *drm)
...
@@ -173,7 +191,7 @@ nv84_fence_suspend(struct nouveau_drm *drm)
return
priv
->
suspend
!=
NULL
;
return
priv
->
suspend
!=
NULL
;
}
}
void
static
void
nv84_fence_resume
(
struct
nouveau_drm
*
drm
)
nv84_fence_resume
(
struct
nouveau_drm
*
drm
)
{
{
struct
nouveau_fifo
*
pfifo
=
nouveau_fifo
(
drm
->
device
);
struct
nouveau_fifo
*
pfifo
=
nouveau_fifo
(
drm
->
device
);
...
@@ -188,10 +206,14 @@ nv84_fence_resume(struct nouveau_drm *drm)
...
@@ -188,10 +206,14 @@ nv84_fence_resume(struct nouveau_drm *drm)
}
}
}
}
void
static
void
nv84_fence_destroy
(
struct
nouveau_drm
*
drm
)
nv84_fence_destroy
(
struct
nouveau_drm
*
drm
)
{
{
struct
nv84_fence_priv
*
priv
=
drm
->
fence
;
struct
nv84_fence_priv
*
priv
=
drm
->
fence
;
nouveau_bo_unmap
(
priv
->
bo_gart
);
if
(
priv
->
bo_gart
)
nouveau_bo_unpin
(
priv
->
bo_gart
);
nouveau_bo_ref
(
NULL
,
&
priv
->
bo_gart
);
nouveau_bo_unmap
(
priv
->
bo
);
nouveau_bo_unmap
(
priv
->
bo
);
if
(
priv
->
bo
)
if
(
priv
->
bo
)
nouveau_bo_unpin
(
priv
->
bo
);
nouveau_bo_unpin
(
priv
->
bo
);
...
@@ -233,6 +255,21 @@ nv84_fence_create(struct nouveau_drm *drm)
...
@@ -233,6 +255,21 @@ nv84_fence_create(struct nouveau_drm *drm)
nouveau_bo_ref
(
NULL
,
&
priv
->
bo
);
nouveau_bo_ref
(
NULL
,
&
priv
->
bo
);
}
}
if
(
ret
==
0
)
ret
=
nouveau_bo_new
(
drm
->
dev
,
16
*
(
pfifo
->
max
+
1
),
0
,
TTM_PL_FLAG_TT
,
0
,
0
,
NULL
,
&
priv
->
bo_gart
);
if
(
ret
==
0
)
{
ret
=
nouveau_bo_pin
(
priv
->
bo_gart
,
TTM_PL_FLAG_TT
);
if
(
ret
==
0
)
{
ret
=
nouveau_bo_map
(
priv
->
bo_gart
);
if
(
ret
)
nouveau_bo_unpin
(
priv
->
bo_gart
);
}
if
(
ret
)
nouveau_bo_ref
(
NULL
,
&
priv
->
bo_gart
);
}
if
(
ret
)
if
(
ret
)
nv84_fence_destroy
(
drm
);
nv84_fence_destroy
(
drm
);
return
ret
;
return
ret
;
...
...
drivers/gpu/drm/nouveau/nvc0_fence.c
View file @
264ce192
...
@@ -81,37 +81,10 @@ nvc0_fence_context_new(struct nouveau_channel *chan)
...
@@ -81,37 +81,10 @@ nvc0_fence_context_new(struct nouveau_channel *chan)
int
int
nvc0_fence_create
(
struct
nouveau_drm
*
drm
)
nvc0_fence_create
(
struct
nouveau_drm
*
drm
)
{
{
struct
nouveau_fifo
*
pfifo
=
nouveau_fifo
(
drm
->
device
);
int
ret
=
nv84_fence_create
(
drm
);
struct
nv84_fence_priv
*
priv
;
int
ret
;
priv
=
drm
->
fence
=
kzalloc
(
sizeof
(
*
priv
),
GFP_KERNEL
);
if
(
!
priv
)
return
-
ENOMEM
;
priv
->
base
.
dtor
=
nv84_fence_destroy
;
priv
->
base
.
suspend
=
nv84_fence_suspend
;
priv
->
base
.
resume
=
nv84_fence_resume
;
priv
->
base
.
context_new
=
nvc0_fence_context_new
;
priv
->
base
.
context_del
=
nv84_fence_context_del
;
init_waitqueue_head
(
&
priv
->
base
.
waiting
);
priv
->
base
.
uevent
=
true
;
ret
=
nouveau_bo_new
(
drm
->
dev
,
16
*
(
pfifo
->
max
+
1
),
0
,
TTM_PL_FLAG_VRAM
,
0
,
0
,
NULL
,
&
priv
->
bo
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
ret
=
nouveau_bo_pin
(
priv
->
bo
,
TTM_PL_FLAG_VRAM
);
struct
nv84_fence_priv
*
priv
=
drm
->
fence
;
if
(
ret
==
0
)
{
priv
->
base
.
context_new
=
nvc0_fence_context_new
;
ret
=
nouveau_bo_map
(
priv
->
bo
);
if
(
ret
)
nouveau_bo_unpin
(
priv
->
bo
);
}
if
(
ret
)
nouveau_bo_ref
(
NULL
,
&
priv
->
bo
);
}
}
if
(
ret
)
nv84_fence_destroy
(
drm
);
return
ret
;
return
ret
;
}
}
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