summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJammy Zhou <Jammy.Zhou@amd.com>2015-05-11 23:49:34 +0800
committerAlex Deucher <alexander.deucher@amd.com>2015-05-26 15:51:42 -0400
commitf6c128053f8660c0d0e7cd0a241ededc13c66199 (patch)
tree5d25a52d4cd9b37af59597ad6fb802fa755cbffa
parentd065ed75c7ef1a47c8944087d42006f6a6e9d6a6 (diff)
drm/amdgpu: add CE preamble flag v3
The CE preamble IB can be dropped for the same context v2: use the flags directly v3: remove 'CE' for potential preamble usage by other rings Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c7
-rw-r--r--include/uapi/drm/amdgpu_drm.h3
3 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 7428c4305418..cec46ebae5f7 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -2518,6 +2518,13 @@ static void gfx_v7_0_ring_emit_ib(struct amdgpu_ring *ring,
{
u32 header, control = 0;
u32 next_rptr = ring->wptr + 5;
+
+ /* drop the CE preamble IB for the same context */
+ if ((ring->type == AMDGPU_RING_TYPE_GFX) &&
+ (ib->flags & AMDGPU_IB_FLAG_PREAMBLE) &&
+ !ring->need_ctx_switch)
+ return;
+
if (ring->type == AMDGPU_RING_TYPE_COMPUTE)
control |= INDIRECT_BUFFER_VALID;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 48de9204ff5e..fc8c46209db4 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -3647,6 +3647,13 @@ static void gfx_v8_0_ring_emit_ib(struct amdgpu_ring *ring,
{
u32 header, control = 0;
u32 next_rptr = ring->wptr + 5;
+
+ /* drop the CE preamble IB for the same context */
+ if ((ring->type == AMDGPU_RING_TYPE_GFX) &&
+ (ib->flags & AMDGPU_IB_FLAG_PREAMBLE) &&
+ !ring->need_ctx_switch)
+ return;
+
if (ring->type == AMDGPU_RING_TYPE_COMPUTE)
control |= INDIRECT_BUFFER_VALID;
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index ca0ea1efa3f4..fb428fe54186 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -369,6 +369,9 @@ union drm_amdgpu_cs {
/* GDS is used by this IB */
#define AMDGPU_IB_FLAG_GDS (1<<1)
+/* CE Preamble */
+#define AMDGPU_IB_FLAG_PREAMBLE (1<<2)
+
struct drm_amdgpu_cs_chunk_ib {
/**
* Handle of GEM object to be used as IB or 0 if it is already in