aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon.h
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2012-05-09 09:34:46 -0400
committerDave Airlie <airlied@redhat.com>2012-05-09 12:22:17 -0400
commitbb635567291482a87e4cc46e6683419c1f365ddf (patch)
tree661f5a7a50310126ef035be87c4ae092752e1705 /drivers/gpu/drm/radeon/radeon.h
parentd6999bc7b5f4b4554ebba5b48377903fa20198db (diff)
drm/radeon: convert fence to uint64_t v4
This convert fence to use uint64_t sequence number intention is to use the fact that uin64_t is big enough that we don't need to care about wrap around. Tested with and without writeback using 0xFFFFF000 as initial fence sequence and thus allowing to test the wrap around from 32bits to 64bits. v2: Add comment about possible race btw CPU & GPU, add comment stressing that we need 2 dword aligned for R600_WB_EVENT_OFFSET Read fence sequenc in reverse order of GPU write them so we mitigate the race btw CPU and GPU. v3: Drop the need for ring to emit the 64bits fence, and just have each ring emit the lower 32bits of the fence sequence. We handle the wrap over 32bits in fence_process. v4: Just a small optimization: Don't reread the last_seq value if loop restarts, since we already know its value anyway. Also start at zero not one for seq value and use pre instead of post increment in emmit, otherwise wait_empty will deadlock. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Christian König <deathsimple@vodafone.de> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon.h')
-rw-r--r--drivers/gpu/drm/radeon/radeon.h39
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index e99ea816d8c9..cdf46bc6dcc4 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -100,28 +100,32 @@ extern int radeon_lockup_timeout;
100 * Copy from radeon_drv.h so we don't have to include both and have conflicting 100 * Copy from radeon_drv.h so we don't have to include both and have conflicting
101 * symbol; 101 * symbol;
102 */ 102 */
103#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ 103#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */
104#define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) 104#define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2)
105/* RADEON_IB_POOL_SIZE must be a power of 2 */ 105/* RADEON_IB_POOL_SIZE must be a power of 2 */
106#define RADEON_IB_POOL_SIZE 16 106#define RADEON_IB_POOL_SIZE 16
107#define RADEON_DEBUGFS_MAX_COMPONENTS 32 107#define RADEON_DEBUGFS_MAX_COMPONENTS 32
108#define RADEONFB_CONN_LIMIT 4 108#define RADEONFB_CONN_LIMIT 4
109#define RADEON_BIOS_NUM_SCRATCH 8 109#define RADEON_BIOS_NUM_SCRATCH 8
110 110
111/* max number of rings */ 111/* max number of rings */
112#define RADEON_NUM_RINGS 3 112#define RADEON_NUM_RINGS 3
113
114/* fence seq are set to this number when signaled */
115#define RADEON_FENCE_SIGNALED_SEQ 0LL
116#define RADEON_FENCE_NOTEMITED_SEQ (~0LL)
113 117
114/* internal ring indices */ 118/* internal ring indices */
115/* r1xx+ has gfx CP ring */ 119/* r1xx+ has gfx CP ring */
116#define RADEON_RING_TYPE_GFX_INDEX 0 120#define RADEON_RING_TYPE_GFX_INDEX 0
117 121
118/* cayman has 2 compute CP rings */ 122/* cayman has 2 compute CP rings */
119#define CAYMAN_RING_TYPE_CP1_INDEX 1 123#define CAYMAN_RING_TYPE_CP1_INDEX 1
120#define CAYMAN_RING_TYPE_CP2_INDEX 2 124#define CAYMAN_RING_TYPE_CP2_INDEX 2
121 125
122/* hardcode those limit for now */ 126/* hardcode those limit for now */
123#define RADEON_VA_RESERVED_SIZE (8 << 20) 127#define RADEON_VA_RESERVED_SIZE (8 << 20)
124#define RADEON_IB_VM_MAX_SIZE (64 << 10) 128#define RADEON_IB_VM_MAX_SIZE (64 << 10)
125 129
126/* 130/*
127 * Errata workarounds. 131 * Errata workarounds.
@@ -254,8 +258,9 @@ struct radeon_fence_driver {
254 uint32_t scratch_reg; 258 uint32_t scratch_reg;
255 uint64_t gpu_addr; 259 uint64_t gpu_addr;
256 volatile uint32_t *cpu_addr; 260 volatile uint32_t *cpu_addr;
257 atomic_t seq; 261 /* seq is protected by ring emission lock */
258 uint32_t last_seq; 262 uint64_t seq;
263 atomic64_t last_seq;
259 unsigned long last_activity; 264 unsigned long last_activity;
260 wait_queue_head_t queue; 265 wait_queue_head_t queue;
261 struct list_head emitted; 266 struct list_head emitted;
@@ -268,11 +273,9 @@ struct radeon_fence {
268 struct kref kref; 273 struct kref kref;
269 struct list_head list; 274 struct list_head list;
270 /* protected by radeon_fence.lock */ 275 /* protected by radeon_fence.lock */
271 uint32_t seq; 276 uint64_t seq;
272 bool emitted;
273 bool signaled;
274 /* RB, DMA, etc. */ 277 /* RB, DMA, etc. */
275 int ring; 278 unsigned ring;
276 struct radeon_semaphore *semaphore; 279 struct radeon_semaphore *semaphore;
277}; 280};
278 281