[Mesa-dev] [PATCH 1/2] radv: do not emit PKT3_CONTEXT_CONTROL with AMDGPU 3.6.0+

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Aug 19 13:01:20 UTC 2019


It's emitted by the kernel.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_device.c   | 9 ++++++---
 src/amd/vulkan/si_cmd_buffer.c | 9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 05d09bb08eb..110808fb98d 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -2008,9 +2008,12 @@ VkResult radv_CreateDevice(
 		device->empty_cs[family] = device->ws->cs_create(device->ws, family);
 		switch (family) {
 		case RADV_QUEUE_GENERAL:
-			radeon_emit(device->empty_cs[family], PKT3(PKT3_CONTEXT_CONTROL, 1, 0));
-			radeon_emit(device->empty_cs[family], CONTEXT_CONTROL_LOAD_ENABLE(1));
-			radeon_emit(device->empty_cs[family], CONTEXT_CONTROL_SHADOW_ENABLE(1));
+		      /* Since amdgpu version 3.6.0, CONTEXT_CONTROL is emitted by the kernel */
+			if (device->physical_device->rad_info.drm_minor < 6) {
+				radeon_emit(device->empty_cs[family], PKT3(PKT3_CONTEXT_CONTROL, 1, 0));
+				radeon_emit(device->empty_cs[family], CONTEXT_CONTROL_LOAD_ENABLE(1));
+				radeon_emit(device->empty_cs[family], CONTEXT_CONTROL_SHADOW_ENABLE(1));
+			}
 			break;
 		case RADV_QUEUE_COMPUTE:
 			radeon_emit(device->empty_cs[family], PKT3(PKT3_NOP, 0, 0));
diff --git a/src/amd/vulkan/si_cmd_buffer.c b/src/amd/vulkan/si_cmd_buffer.c
index 701b2398b50..a5057fe25a2 100644
--- a/src/amd/vulkan/si_cmd_buffer.c
+++ b/src/amd/vulkan/si_cmd_buffer.c
@@ -161,9 +161,12 @@ si_emit_graphics(struct radv_physical_device *physical_device,
 {
 	int i;
 
-	radeon_emit(cs, PKT3(PKT3_CONTEXT_CONTROL, 1, 0));
-	radeon_emit(cs, CONTEXT_CONTROL_LOAD_ENABLE(1));
-	radeon_emit(cs, CONTEXT_CONTROL_SHADOW_ENABLE(1));
+	/* Since amdgpu version 3.6.0, CONTEXT_CONTROL is emitted by the kernel */
+	if (physical_device->rad_info.drm_minor < 6) {
+		radeon_emit(cs, PKT3(PKT3_CONTEXT_CONTROL, 1, 0));
+		radeon_emit(cs, CONTEXT_CONTROL_LOAD_ENABLE(1));
+		radeon_emit(cs, CONTEXT_CONTROL_SHADOW_ENABLE(1));
+	}
 
 	if (physical_device->has_clear_state) {
 		radeon_emit(cs, PKT3(PKT3_CLEAR_STATE, 0, 0));
-- 
2.22.1



More information about the mesa-dev mailing list