@@ -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) &&
@@ -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;