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
b03b4e4b
Commit
b03b4e4b
authored
Feb 28, 2014
by
Christian König
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/radeon: fix VCE suspend/resume
Signed-off-by:
Christian König
<
christian.koenig@amd.com
>
parent
f1e3dc70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
30 deletions
+34
-30
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon.h
+0
-1
drivers/gpu/drm/radeon/radeon_vce.c
drivers/gpu/drm/radeon/radeon_vce.c
+34
-29
No files found.
drivers/gpu/drm/radeon/radeon.h
View file @
b03b4e4b
...
@@ -1634,7 +1634,6 @@ int radeon_uvd_send_upll_ctlreq(struct radeon_device *rdev,
...
@@ -1634,7 +1634,6 @@ int radeon_uvd_send_upll_ctlreq(struct radeon_device *rdev,
struct
radeon_vce
{
struct
radeon_vce
{
struct
radeon_bo
*
vcpu_bo
;
struct
radeon_bo
*
vcpu_bo
;
void
*
cpu_addr
;
uint64_t
gpu_addr
;
uint64_t
gpu_addr
;
unsigned
fw_version
;
unsigned
fw_version
;
unsigned
fb_version
;
unsigned
fb_version
;
...
...
drivers/gpu/drm/radeon/radeon_vce.c
View file @
b03b4e4b
...
@@ -119,7 +119,7 @@ int radeon_vce_init(struct radeon_device *rdev)
...
@@ -119,7 +119,7 @@ int radeon_vce_init(struct radeon_device *rdev)
if
(
rdev
->
vce
.
fw_version
!=
((
40
<<
24
)
|
(
2
<<
16
)
|
(
2
<<
8
)))
if
(
rdev
->
vce
.
fw_version
!=
((
40
<<
24
)
|
(
2
<<
16
)
|
(
2
<<
8
)))
return
-
EINVAL
;
return
-
EINVAL
;
/*
load firmware into VRAM
*/
/*
allocate firmware, stack and heap BO
*/
size
=
RADEON_GPU_PAGE_ALIGN
(
rdev
->
vce_fw
->
size
)
+
size
=
RADEON_GPU_PAGE_ALIGN
(
rdev
->
vce_fw
->
size
)
+
RADEON_VCE_STACK_SIZE
+
RADEON_VCE_HEAP_SIZE
;
RADEON_VCE_STACK_SIZE
+
RADEON_VCE_HEAP_SIZE
;
...
@@ -130,16 +130,21 @@ int radeon_vce_init(struct radeon_device *rdev)
...
@@ -130,16 +130,21 @@ int radeon_vce_init(struct radeon_device *rdev)
return
r
;
return
r
;
}
}
r
=
radeon_vce_resume
(
rdev
);
r
=
radeon_bo_reserve
(
rdev
->
vce
.
vcpu_bo
,
false
);
if
(
r
)
if
(
r
)
{
radeon_bo_unref
(
&
rdev
->
vce
.
vcpu_bo
);
dev_err
(
rdev
->
dev
,
"(%d) failed to reserve VCE bo
\n
"
,
r
);
return
r
;
return
r
;
}
memset
(
rdev
->
vce
.
cpu_addr
,
0
,
size
);
r
=
radeon_bo_pin
(
rdev
->
vce
.
vcpu_bo
,
RADEON_GEM_DOMAIN_VRAM
,
memcpy
(
rdev
->
vce
.
cpu_addr
,
rdev
->
vce_fw
->
data
,
rdev
->
vce_fw
->
size
);
&
rdev
->
vce
.
gpu_addr
);
radeon_bo_unreserve
(
rdev
->
vce
.
vcpu_bo
);
r
=
radeon_vce_suspend
(
rdev
);
if
(
r
)
{
if
(
r
)
radeon_bo_unref
(
&
rdev
->
vce
.
vcpu_bo
);
dev_err
(
rdev
->
dev
,
"(%d) VCE bo pin failed
\n
"
,
r
);
return
r
;
return
r
;
}
for
(
i
=
0
;
i
<
RADEON_MAX_VCE_HANDLES
;
++
i
)
{
for
(
i
=
0
;
i
<
RADEON_MAX_VCE_HANDLES
;
++
i
)
{
atomic_set
(
&
rdev
->
vce
.
handles
[
i
],
0
);
atomic_set
(
&
rdev
->
vce
.
handles
[
i
],
0
);
...
@@ -158,8 +163,12 @@ int radeon_vce_init(struct radeon_device *rdev)
...
@@ -158,8 +163,12 @@ int radeon_vce_init(struct radeon_device *rdev)
*/
*/
void
radeon_vce_fini
(
struct
radeon_device
*
rdev
)
void
radeon_vce_fini
(
struct
radeon_device
*
rdev
)
{
{
radeon_vce_suspend
(
rdev
);
if
(
rdev
->
vce
.
vcpu_bo
==
NULL
)
return
;
radeon_bo_unref
(
&
rdev
->
vce
.
vcpu_bo
);
radeon_bo_unref
(
&
rdev
->
vce
.
vcpu_bo
);
release_firmware
(
rdev
->
vce_fw
);
}
}
/**
/**
...
@@ -167,22 +176,23 @@ void radeon_vce_fini(struct radeon_device *rdev)
...
@@ -167,22 +176,23 @@ void radeon_vce_fini(struct radeon_device *rdev)
*
*
* @rdev: radeon_device pointer
* @rdev: radeon_device pointer
*
*
* TODO: Test VCE suspend/resume
*/
*/
int
radeon_vce_suspend
(
struct
radeon_device
*
rdev
)
int
radeon_vce_suspend
(
struct
radeon_device
*
rdev
)
{
{
int
r
;
int
i
;
if
(
rdev
->
vce
.
vcpu_bo
==
NULL
)
if
(
rdev
->
vce
.
vcpu_bo
==
NULL
)
return
0
;
return
0
;
r
=
radeon_bo_reserve
(
rdev
->
vce
.
vcpu_bo
,
false
);
for
(
i
=
0
;
i
<
RADEON_MAX_VCE_HANDLES
;
++
i
)
if
(
!
r
)
{
if
(
atomic_read
(
&
rdev
->
vce
.
handles
[
i
]))
radeon_bo_kunmap
(
rdev
->
vce
.
vcpu_bo
);
break
;
radeon_bo_unpin
(
rdev
->
vce
.
vcpu_bo
);
radeon_bo_unreserve
(
rdev
->
vce
.
vcpu_bo
);
if
(
i
==
RADEON_MAX_VCE_HANDLES
)
}
return
0
;
return
r
;
/* TODO: suspending running encoding sessions isn't supported */
return
-
EINVAL
;
}
}
/**
/**
...
@@ -190,10 +200,10 @@ int radeon_vce_suspend(struct radeon_device *rdev)
...
@@ -190,10 +200,10 @@ int radeon_vce_suspend(struct radeon_device *rdev)
*
*
* @rdev: radeon_device pointer
* @rdev: radeon_device pointer
*
*
* TODO: Test VCE suspend/resume
*/
*/
int
radeon_vce_resume
(
struct
radeon_device
*
rdev
)
int
radeon_vce_resume
(
struct
radeon_device
*
rdev
)
{
{
void
*
cpu_addr
;
int
r
;
int
r
;
if
(
rdev
->
vce
.
vcpu_bo
==
NULL
)
if
(
rdev
->
vce
.
vcpu_bo
==
NULL
)
...
@@ -201,26 +211,21 @@ int radeon_vce_resume(struct radeon_device *rdev)
...
@@ -201,26 +211,21 @@ int radeon_vce_resume(struct radeon_device *rdev)
r
=
radeon_bo_reserve
(
rdev
->
vce
.
vcpu_bo
,
false
);
r
=
radeon_bo_reserve
(
rdev
->
vce
.
vcpu_bo
,
false
);
if
(
r
)
{
if
(
r
)
{
radeon_bo_unref
(
&
rdev
->
vce
.
vcpu_bo
);
dev_err
(
rdev
->
dev
,
"(%d) failed to reserve VCE bo
\n
"
,
r
);
dev_err
(
rdev
->
dev
,
"(%d) failed to reserve VCE bo
\n
"
,
r
);
return
r
;
return
r
;
}
}
r
=
radeon_bo_pin
(
rdev
->
vce
.
vcpu_bo
,
RADEON_GEM_DOMAIN_VRAM
,
r
=
radeon_bo_kmap
(
rdev
->
vce
.
vcpu_bo
,
&
cpu_addr
);
&
rdev
->
vce
.
gpu_addr
);
if
(
r
)
{
if
(
r
)
{
radeon_bo_unreserve
(
rdev
->
vce
.
vcpu_bo
);
radeon_bo_unreserve
(
rdev
->
vce
.
vcpu_bo
);
radeon_bo_unref
(
&
rdev
->
vce
.
vcpu_bo
);
dev_err
(
rdev
->
dev
,
"(%d) VCE bo pin failed
\n
"
,
r
);
return
r
;
}
r
=
radeon_bo_kmap
(
rdev
->
vce
.
vcpu_bo
,
&
rdev
->
vce
.
cpu_addr
);
if
(
r
)
{
dev_err
(
rdev
->
dev
,
"(%d) VCE map failed
\n
"
,
r
);
dev_err
(
rdev
->
dev
,
"(%d) VCE map failed
\n
"
,
r
);
return
r
;
return
r
;
}
}
memcpy
(
cpu_addr
,
rdev
->
vce_fw
->
data
,
rdev
->
vce_fw
->
size
);
radeon_bo_kunmap
(
rdev
->
vce
.
vcpu_bo
);
radeon_bo_unreserve
(
rdev
->
vce
.
vcpu_bo
);
radeon_bo_unreserve
(
rdev
->
vce
.
vcpu_bo
);
return
0
;
return
0
;
...
...
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