aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJammy Zhou2015-05-20 15:17:48 -0500
committerAlex Deucher2015-08-05 12:47:50 -0500
commit60e221c925e7ee81b9831b06ebd4ca54bea03deb (patch)
treeec0578c07d07d007f3429bfa21f4bb9d92aae4d5
parent7c50f0d9847f855d6d008840931898f001faad8c (diff)
downloadexternal-libgbm-60e221c925e7ee81b9831b06ebd4ca54bea03deb.tar.gz
external-libgbm-60e221c925e7ee81b9831b06ebd4ca54bea03deb.tar.xz
external-libgbm-60e221c925e7ee81b9831b06ebd4ca54bea03deb.zip
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 {
342 * - Could be 0 342 * - Could be 0
343 */ 343 */
344 uint32_t size; 344 uint32_t size;
345
346 /** Offset in the IB buffer object (in unit of dwords) */
347 uint32_t offset_dw;
345}; 348};
346 349
347/** 350/**
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,
316 uint32_t ring) 316 uint32_t ring)
317{ 317{
318 struct list_head *head; 318 struct list_head *head;
319 struct amdgpu_ib *next;
320 struct amdgpu_ib *s;
321
319 pthread_mutex_lock(&context->pendings_mutex); 322 pthread_mutex_lock(&context->pendings_mutex);
320 head = &context->pendings[ip][ip_instance][ring]; 323 head = &context->pendings[ip][ip_instance][ring];
324 LIST_FOR_EACH_ENTRY_SAFE(next, s, head, list_node)
325 if (next == ib) {
326 pthread_mutex_unlock(&context->pendings_mutex);
327 return;
328 }
329
321 LIST_ADDTAIL(&ib->list_node, head); 330 LIST_ADDTAIL(&ib->list_node, head);
322 pthread_mutex_unlock(&context->pendings_mutex); 331 pthread_mutex_unlock(&context->pendings_mutex);
323 return; 332 return;
@@ -694,7 +703,8 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,
694 ib = &ibs_request->ibs[i]; 703 ib = &ibs_request->ibs[i];
695 704
696 chunk_data[i].ib_data.handle = ib->ib_handle->buf_handle->handle; 705 chunk_data[i].ib_data.handle = ib->ib_handle->buf_handle->handle;
697 chunk_data[i].ib_data.va_start = ib->ib_handle->virtual_mc_base_address; 706 chunk_data[i].ib_data.va_start = ib->ib_handle->virtual_mc_base_address
707 + ib->offset_dw * 4;
698 chunk_data[i].ib_data.ib_bytes = ib->size * 4; 708 chunk_data[i].ib_data.ib_bytes = ib->size * 4;
699 chunk_data[i].ib_data.ip_type = ibs_request->ip_type; 709 chunk_data[i].ib_data.ip_type = ibs_request->ip_type;
700 chunk_data[i].ib_data.ip_instance = ibs_request->ip_instance; 710 chunk_data[i].ib_data.ip_instance = ibs_request->ip_instance;