diff options
author | Christian König <deathsimple@vodafone.de> | 2012-05-10 15:57:31 +0200 |
---|---|---|
committer | Christian König <deathsimple@vodafone.de> | 2012-06-21 09:38:38 +0200 |
commit | 68e250b7c281dbb75ea2a892a7d4ca27f974fc91 (patch) | |
tree | f1b20eabbd8441f085f922d3d0509c3f92a1ece4 /drivers/gpu/drm/radeon/radeon.h | |
parent | 876dc9f32907e57e0298bcd0f1607cb7a2582f63 (diff) | |
download | lwn-68e250b7c281dbb75ea2a892a7d4ca27f974fc91.tar.gz lwn-68e250b7c281dbb75ea2a892a7d4ca27f974fc91.zip |
drm/radeon: add infrastructure for advanced ring synchronization v2
v2: BUG_ON not matching rings.
Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon.h')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index e2feddd91df5..33a72dc9af85 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -257,8 +257,8 @@ struct radeon_fence_driver { uint32_t scratch_reg; uint64_t gpu_addr; volatile uint32_t *cpu_addr; - /* seq is protected by ring emission lock */ - uint64_t seq; + /* sync_seq is protected by ring emission lock */ + uint64_t sync_seq[RADEON_NUM_RINGS]; atomic64_t last_seq; unsigned long last_activity; bool initialized; @@ -288,6 +288,27 @@ int radeon_fence_wait_any(struct radeon_device *rdev, struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); void radeon_fence_unref(struct radeon_fence **fence); unsigned radeon_fence_count_emitted(struct radeon_device *rdev, int ring); +bool radeon_fence_need_sync(struct radeon_fence *fence, int ring); +void radeon_fence_note_sync(struct radeon_fence *fence, int ring); +static inline struct radeon_fence *radeon_fence_later(struct radeon_fence *a, + struct radeon_fence *b) +{ + if (!a) { + return b; + } + + if (!b) { + return a; + } + + BUG_ON(a->ring != b->ring); + + if (a->seq > b->seq) { + return a; + } else { + return b; + } +} /* * Tiling registers |