Well NAK, as discussed checking the global flag is more flexible since
it will still enable the preamble drop when gfxoff is disabled.
Christian.
Am 17.05.21 um 06:39 schrieb Jiansong Chen:
The optimization is safe for old GPUs and can help performance.
Signed-off-by: Jiansong Chen <Jiansong.Chen@xxxxxxx>
Change-Id: Id3b1250f1fe46dddbe8498894fb97e9753b7cafe
---
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 6 ++++++
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 3a8d52a54873..c915cc439484 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
@@ -1873,6 +1873,12 @@ static void gfx_v6_0_ring_emit_ib(struct amdgpu_ring *ring,
amdgpu_ring_write(ring, 0);
}
+ /* drop the CE preamble IB for the same context */
+ if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) &&
+ !(flags & AMDGPU_HAVE_CTX_SWITCH) &&
+ !(flags & AMDGPU_PREAMBLE_IB_PRESENT_FIRST))
+ return;
+
if (ib->flags & AMDGPU_IB_FLAG_CE)
header = PACKET3(PACKET3_INDIRECT_BUFFER_CONST, 2);
else
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index c35fdd2ef2d4..6d9ccae48024 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -2269,6 +2269,12 @@ static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
amdgpu_ring_write(ring, 0);
}
+ /* drop the CE preamble IB for the same context */
+ if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) &&
+ !(flags & AMDGPU_HAVE_CTX_SWITCH) &&
+ !(flags & AMDGPU_PREAMBLE_IB_PRESENT_FIRST))
+ return;
+
if (ib->flags & AMDGPU_IB_FLAG_CE)
header = PACKET3(PACKET3_INDIRECT_BUFFER_CONST, 2);
else
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx