drm/amdgpu: add CE preamble flag v3
authorJammy Zhou <Jammy.Zhou@amd.com>
Mon, 11 May 2015 15:49:34 +0000 (23:49 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 4 Jun 2015 01:03:31 +0000 (21:03 -0400)
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>
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
include/uapi/drm/amdgpu_drm.h

index 7428c4305418e1bb4c01a1c156059f3c3347c2dd..cec46ebae5f795fbcbde6bd95c8fc73fb4803345 100644 (file)
@@ -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;
 
index 48de9204ff5e2f0b11b6f1ae4fa5059c4898144a..fc8c46209db4e382f02333ca65d1f7c60e17608f 100644 (file)
@@ -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;
 
index ca0ea1efa3f4ca9c8dcd4147e07a6b4aa18d9134..fb428fe54186e24431cd8c87ef8c2bb9617e6de4 100644 (file)
@@ -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