]> Pileus Git - ~andy/linux/commitdiff
drm/radeon: add sync helper function
authorChristian König <deathsimple@vodafone.de>
Thu, 9 Aug 2012 14:35:36 +0000 (16:35 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 20 Sep 2012 17:10:38 +0000 (13:10 -0400)
Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
drivers/gpu/drm/radeon/radeon_cs.c

index 0a9d1eb719cf96f72b0cdb844f486d3e19ebbfda..85a80e467482dcad4d304dc838e7e12b97a0da73 100644 (file)
@@ -115,19 +115,27 @@ static int radeon_cs_get_ring(struct radeon_cs_parser *p, u32 ring, s32 priority
        return 0;
 }
 
+static void radeon_cs_sync_to(struct radeon_cs_parser *p,
+                             struct radeon_fence *fence)
+{
+       struct radeon_fence *other;
+
+       if (!fence)
+               return;
+
+       other = p->ib.sync_to[fence->ring];
+       p->ib.sync_to[fence->ring] = radeon_fence_later(fence, other);
+}
+
 static void radeon_cs_sync_rings(struct radeon_cs_parser *p)
 {
        int i;
 
        for (i = 0; i < p->nrelocs; i++) {
-               struct radeon_fence *a, *b;
-
-               if (!p->relocs[i].robj || !p->relocs[i].robj->tbo.sync_obj)
+               if (!p->relocs[i].robj)
                        continue;
 
-               a = p->relocs[i].robj->tbo.sync_obj;
-               b = p->ib.sync_to[a->ring];
-               p->ib.sync_to[a->ring] = radeon_fence_later(a, b);
+               radeon_cs_sync_to(p, p->relocs[i].robj->tbo.sync_obj);
        }
 }