summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJammy Zhou <Jammy.Zhou@amd.com>2015-05-21 04:17:48 +0800
committerAlex Deucher <alexander.deucher@amd.com>2015-07-30 00:11:10 -0400
commitd31a91fd46c6812471061a3c2b9345a1f16d25b4 (patch)
tree79e25a3350a7de5c925acf3fd430f4c8e74b7d83
parentf94a629f0f4919928c5b96659fe6b67ca2e24eba (diff)
amdgpu: add IB sharing support v2
A new 'offset' flag is added to the amdgpu_cs_ib_info structure, which can be used to specify location of PM4 packets to execute in the IB buffer object v2: remove the shared IB flag, etc Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--amdgpu/amdgpu.h3
-rw-r--r--amdgpu/amdgpu_cs.c12
2 files changed, 14 insertions, 1 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 32bf30e7..c6161bd1 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -342,6 +342,9 @@ struct amdgpu_cs_ib_info {
* - Could be 0
*/
uint32_t size;
+
+ /** Offset in the IB buffer object (in unit of dwords) */
+ uint32_t offset_dw;
};
/**
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index c8101b85..5e406e8b 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -316,8 +316,17 @@ static void amdgpu_cs_add_pending(amdgpu_context_handle context,
uint32_t ring)
{
struct list_head *head;
+ struct amdgpu_ib *next;
+ struct amdgpu_ib *s;
+
pthread_mutex_lock(&context->pendings_mutex);
head = &context->pendings[ip][ip_instance][ring];
+ LIST_FOR_EACH_ENTRY_SAFE(next, s, head, list_node)
+ if (next == ib) {
+ pthread_mutex_unlock(&context->pendings_mutex);
+ return;
+ }
+
LIST_ADDTAIL(&ib->list_node, head);
pthread_mutex_unlock(&context->pendings_mutex);
return;
@@ -694,7 +703,8 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,
ib = &ibs_request->ibs[i];
chunk_data[i].ib_data.handle = ib->ib_handle->buf_handle->handle;
- chunk_data[i].ib_data.va_start = ib->ib_handle->virtual_mc_base_address;
+ chunk_data[i].ib_data.va_start = ib->ib_handle->virtual_mc_base_address
+ + ib->offset_dw * 4;
chunk_data[i].ib_data.ib_bytes = ib->size * 4;
chunk_data[i].ib_data.ip_type = ibs_request->ip_type;
chunk_data[i].ib_data.ip_instance = ibs_request->ip_instance;