From: Christian König <christian.koenig@xxxxxxx> 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@xxxxxxx> --- 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@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel