From: "Christian König" <deathsimple@vodafone.de>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 4/4] drm/radeon: add flag to NOT fence a BO on CS
Date: Thu, 14 Aug 2014 18:12:05 +0200 [thread overview]
Message-ID: <1408032725-6236-5-git-send-email-deathsimple@vodafone.de> (raw)
In-Reply-To: <1408032725-6236-1-git-send-email-deathsimple@vodafone.de>
From: Christian König <christian.koenig@amd.com>
This is useful and only allowed with pure sync objects. E.g.
the CS depends on finishing a previous CS, but should not add
the new fence the handle.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/radeon/radeon_cs.c | 29 ++++++++++++++++++++++++-----
include/uapi/drm/radeon_drm.h | 1 +
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 11e4789..bdb8eda 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -225,7 +225,7 @@ static int radeon_cs_get_ring(struct radeon_cs_parser *p, u32 ring, s32 priority
return 0;
}
-static void radeon_cs_sync_rings(struct radeon_cs_parser *p)
+static int radeon_cs_sync_rings(struct radeon_cs_parser *p)
{
int i;
@@ -237,6 +237,18 @@ static void radeon_cs_sync_rings(struct radeon_cs_parser *p)
if (!bo)
continue;
+ fence = bo->tbo.sync_obj;
+ if (reloc->flags & RADEON_RELOC_DONT_FENCE) {
+
+ /* only allowed for sync objects */
+ if (radeon_bo_size(bo) != 0)
+ return -EINVAL;
+
+ list_del(&p->relocs[i].tv.head);
+ radeon_bo_unreserve(bo);
+ p->relocs[i].robj = NULL;
+ }
+
/* always sync to the last operation
the clients doesn't know about */
radeon_semaphore_sync_to(p->ib.presync, bo->last_sync);
@@ -245,8 +257,6 @@ static void radeon_cs_sync_rings(struct radeon_cs_parser *p)
reloc->flags & RADEON_RELOC_DONT_SYNC)
continue;
- fence = bo->tbo.sync_obj;
-
if (bo->written && radeon_fence_signaled(bo->written))
radeon_fence_unref(&bo->written);
@@ -257,6 +267,8 @@ static void radeon_cs_sync_rings(struct radeon_cs_parser *p)
else
radeon_semaphore_sync_to(p->ib.postsync, fence);
}
+
+ return 0;
}
/* XXX: note that this is called from the legacy UMS CS ioctl as well */
@@ -498,7 +510,10 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev,
(parser->ring == TN_RING_TYPE_VCE2_INDEX))
radeon_vce_note_usage(rdev);
- radeon_cs_sync_rings(parser);
+ r = radeon_cs_sync_rings(parser);
+ if (r)
+ return r;
+
r = radeon_ib_schedule(rdev, &parser->ib, NULL);
if (r) {
DRM_ERROR("Failed to schedule IB !\n");
@@ -585,7 +600,11 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev,
if (r) {
goto out;
}
- radeon_cs_sync_rings(parser);
+
+ r = radeon_cs_sync_rings(parser);
+ if (r)
+ goto out;
+
radeon_semaphore_sync_to(parser->ib.presync, vm->fence);
if ((rdev->family >= CHIP_TAHITI) &&
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index 5bd3f68..289a0ca 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -946,6 +946,7 @@ struct drm_radeon_cs_chunk {
/* drm_radeon_cs_reloc.flags */
#define RADEON_RELOC_PRIO_MASK (0xf << 0)
#define RADEON_RELOC_DONT_SYNC (1 << 4)
+#define RADEON_RELOC_DONT_FENCE (1 << 5)
struct drm_radeon_cs_reloc {
uint32_t handle;
--
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:[~2014-08-14 16:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-14 16:12 drm/radeon: giving userspace control over hardware engine sync Christian König
2014-08-14 16:12 ` [PATCH 1/4] drm/radeon: add pre and post IB sync Christian König
2014-08-14 16:12 ` [PATCH 2/4] drm/radeon: allow concurrent BO access by different engines Christian König
2014-08-14 16:12 ` [PATCH 3/4] drm/radeon: add DONT_SYNC flag to CS relocs Christian König
2014-08-14 18:43 ` Jerome Glisse
2014-08-14 20:34 ` Alex Deucher
2014-08-14 21:06 ` Jerome Glisse
2014-08-15 7:46 ` Christian König
2014-08-14 16:12 ` Christian König [this message]
2014-08-14 18:35 ` drm/radeon: giving userspace control over hardware engine sync Jerome Glisse
2014-08-15 12:04 ` Christian König
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=1408032725-6236-5-git-send-email-deathsimple@vodafone.de \
--to=deathsimple@vodafone.de \
--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