From: "Christian König" <deathsimple@vodafone.de>
To: dri-devel@lists.freedesktop.org
Cc: Serguei.Sagalovitch@amd.com
Subject: [PATCH 1/3] drm/radeon: wait for BO move to finish on kmap
Date: Mon, 13 Apr 2015 16:52:15 +0200 [thread overview]
Message-ID: <1428936737-19103-2-git-send-email-deathsimple@vodafone.de> (raw)
In-Reply-To: <1428936737-19103-1-git-send-email-deathsimple@vodafone.de>
From: Christian König <christian.koenig@amd.com>
After resume buffer need to move back into VRAM. We already had this
problem with UVD, but solve it more general to be on the safe side.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/radeon/radeon.h | 2 ++
drivers/gpu/drm/radeon/radeon_object.c | 11 +++++++++++
drivers/gpu/drm/radeon/radeon_ttm.c | 3 +++
drivers/gpu/drm/radeon/radeon_uvd.c | 10 ----------
4 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 33d5a4f..6e6b49a 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -506,6 +506,8 @@ struct radeon_bo {
struct radeon_mn *mn;
struct interval_tree_node mn_it;
+
+ struct radeon_fence *last_move;
};
#define gem_to_radeon_bo(gobj) container_of((gobj), struct radeon_bo, gem_base)
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 318165d..14a0f87 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -263,6 +263,17 @@ int radeon_bo_kmap(struct radeon_bo *bo, void **ptr)
bool is_iomem;
int r;
+ if (bo->last_move) {
+ r = radeon_fence_wait(bo->last_move, false);
+ if (r) {
+ radeon_bo_kunmap(bo);
+ DRM_ERROR("Failed waiting BO move (%d)!\n", r);
+ return r;
+ }
+
+ radeon_fence_unref(&bo->last_move);
+ }
+
if (bo->kptr) {
if (ptr) {
*ptr = bo->kptr;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index b292aca..1fa4f2d 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -253,6 +253,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
struct ttm_mem_reg *new_mem,
struct ttm_mem_reg *old_mem)
{
+ struct radeon_bo *rbo = container_of(bo, struct radeon_bo, tbo);
struct radeon_device *rdev;
uint64_t old_start, new_start;
struct radeon_fence *fence;
@@ -300,6 +301,8 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
r = ttm_bo_move_accel_cleanup(bo, &fence->base,
evict, no_wait_gpu, new_mem);
+ radeon_fence_unref(&rbo->last_move);
+ rbo->last_move = radeon_fence_ref(fence);
radeon_fence_unref(&fence);
return r;
}
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index c10b2ae..60f96a3 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -401,7 +401,6 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
{
int32_t *msg, msg_type, handle;
unsigned img_size = 0;
- struct fence *f;
void *ptr;
int i, r;
@@ -411,15 +410,6 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo,
return -EINVAL;
}
- f = reservation_object_get_excl(bo->tbo.resv);
- if (f) {
- r = radeon_fence_wait((struct radeon_fence *)f, false);
- if (r) {
- DRM_ERROR("Failed waiting for UVD message (%d)!\n", r);
- return r;
- }
- }
-
r = radeon_bo_kmap(bo, &ptr);
if (r) {
DRM_ERROR("Failed mapping the UVD message (%d)!\n", r);
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-04-13 14:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-13 14:52 [RFC] drm/radeon: userfence IOCTL Christian König
2015-04-13 14:52 ` Christian König [this message]
2015-04-13 14:52 ` [PATCH 2/3] drm/radeon: cleanup radeon_cs_get_ring Christian König
2015-04-13 14:52 ` [PATCH 3/3] drm/radeon: add userfence IOCTL Christian König
2015-04-13 17:23 ` Daniel Vetter
2015-04-13 17:51 ` Jerome Glisse
2015-04-13 18:26 ` Christian König
2015-04-13 19:48 ` Jerome Glisse
2015-04-14 8:17 ` Daniel Vetter
2015-04-13 17:27 ` Daniel Vetter
2015-04-13 15:25 ` [RFC] drm/radeon: " Serguei Sagalovitch
2015-04-13 15:35 ` Christian König
2015-04-13 15:37 ` Serguei Sagalovitch
2015-04-13 15:46 ` Jerome Glisse
2015-04-13 15:39 ` Jerome Glisse
2015-04-13 15:47 ` Christian König
2015-04-13 15:52 ` Serguei Sagalovitch
2015-04-13 16:13 ` Jerome Glisse
2015-04-13 15:31 ` Jerome Glisse
2015-04-13 15:45 ` Christian König
2015-04-13 16:08 ` Jerome Glisse
2015-04-13 16:55 ` Christian König
2015-04-13 17:46 ` Jerome Glisse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428936737-19103-2-git-send-email-deathsimple@vodafone.de \
--to=deathsimple@vodafone.de \
--cc=Serguei.Sagalovitch@amd.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox