Skip to contentSkip to conversation

drm/amdgpu: implement raster configuration

PATCH In review Huang Rui 7 participants 14 messages Sep 18, 2016 – Sep 27, 2016 8 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Huang Rui

author
#0 lore raw

cover drm/amdgpu: implement raster configuration

Hi all,

This patch set is to introduce the raster configuration for all gfx generations.

Thanks,
Rui

Huang Rui (3):
drm/amdgpu: implement raster configuration for gfx v6 drm/amdgpu: implement raster configuration for gfx v7 drm/amdgpu: implement raster configuration for gfx v8

 drivers/gpu/drm/amd/amdgpu/cikd.h             |  36 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c         | 133 +++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c         | 160 +++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c         | 168 +++++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/vid.h              |  37 ++++++
 drivers/gpu/drm/amd/include/asic_reg/si/sid.h |  35 ++++++
 6 files changed, 566 insertions(+), 3 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1474166210-21736-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 1/3 drm/amdgpu: implement raster configuration for gfx v6

This patch is to implement the raster configuration and harvested configuration of gfx v6.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c         | 133 +++++++++++++++++++++++++-
 drivers/gpu/drm/amd/include/asic_reg/si/sid.h |  35 +++++++
 2 files changed, 167 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +132 -1
index 17a560c..0905dd9 100644
@@ -937,6 +937,123 @@ static u32 gfx_v6_0_get_rb_disabled(struct amdgpu_device *adev,
 	return data & mask;
 }
 
+static void gfx_v6_0_raster_config(struct amdgpu_device *adev, u32 *rconf)
+{
+	switch (adev->asic_type) {
+	case CHIP_TAHITI:
+	case CHIP_PITCAIRN:
+		*rconf |= RB_XSEL2(2) | RB_XSEL | PKR_MAP(2) | PKR_YSEL(1) |
+			  SE_MAP(2) | SE_XSEL(2) | SE_YSEL(2);
+		break;
+	case CHIP_VERDE:
+		*rconf |= RB_XSEL | PKR_MAP(2) | PKR_YSEL(1);
+		break;
+	case CHIP_OLAND:
+		*rconf |= RB_YSEL;
+		break;
+	case CHIP_HAINAN:
+		*rconf |= 0x0;
+		break;
+	default:
+		DRM_ERROR("unknown asic: 0x%x\n", adev->asic_type);
+		break;
+	}
+}
+
+static void gfx_v6_0_write_harvested_raster_configs(struct amdgpu_device *adev,
+						    u32 raster_config, unsigned rb_mask,
+						    unsigned num_rb)
+{
+	unsigned sh_per_se = max_t(unsigned, adev->gfx.config.max_sh_per_se, 1);
+	unsigned num_se = max_t(unsigned, adev->gfx.config.max_shader_engines, 1);
+	unsigned rb_per_pkr = min_t(unsigned, num_rb / num_se / sh_per_se, 2);
+	unsigned rb_per_se = num_rb / num_se;
+	unsigned se_mask[4];
+	unsigned se;
+
+	se_mask[0] = ((1 << rb_per_se) - 1) & rb_mask;
+	se_mask[1] = (se_mask[0] << rb_per_se) & rb_mask;
+	se_mask[2] = (se_mask[1] << rb_per_se) & rb_mask;
+	se_mask[3] = (se_mask[2] << rb_per_se) & rb_mask;
+
+	WARN_ON(!(num_se == 1 || num_se == 2 || num_se == 4));
+	WARN_ON(!(sh_per_se == 1 || sh_per_se == 2));
+	WARN_ON(!(rb_per_pkr == 1 || rb_per_pkr == 2));
+
+	for (se = 0; se < num_se; se++) {
+		unsigned raster_config_se = raster_config;
+		unsigned pkr0_mask = ((1 << rb_per_pkr) - 1) << (se * rb_per_se);
+		unsigned pkr1_mask = pkr0_mask << rb_per_pkr;
+		int idx = (se / 2) * 2;
+
+		if ((num_se > 1) && (!se_mask[idx] || !se_mask[idx + 1])) {
+			raster_config_se &= ~SE_MAP_MASK;
+
+			if (!se_mask[idx]) {
+				raster_config_se |= SE_MAP(RASTER_CONFIG_SE_MAP_3);
+			} else {
+				raster_config_se |= SE_MAP(RASTER_CONFIG_SE_MAP_0);
+			}
+		}
+
+		pkr0_mask &= rb_mask;
+		pkr1_mask &= rb_mask;
+		if (rb_per_se > 2 && (!pkr0_mask || !pkr1_mask)) {
+			raster_config_se &= ~PKR_MAP_MASK;
+
+			if (!pkr0_mask) {
+				raster_config_se |= PKR_MAP(RASTER_CONFIG_PKR_MAP_3);
+			} else {
+				raster_config_se |= PKR_MAP(RASTER_CONFIG_PKR_MAP_0);
+			}
+		}
+
+		if (rb_per_se >= 2) {
+			unsigned rb0_mask = 1 << (se * rb_per_se);
+			unsigned rb1_mask = rb0_mask << 1;
+
+			rb0_mask &= rb_mask;
+			rb1_mask &= rb_mask;
+			if (!rb0_mask || !rb1_mask) {
+				raster_config_se &= ~RB_MAP_PKR0_MASK;
+
+				if (!rb0_mask) {
+					raster_config_se |=
+						RB_MAP_PKR0(RASTER_CONFIG_RB_MAP_3);
+				} else {
+					raster_config_se |=
+						RB_MAP_PKR0(RASTER_CONFIG_RB_MAP_0);
+				}
+			}
+
+			if (rb_per_se > 2) {
+				rb0_mask = 1 << (se * rb_per_se + rb_per_pkr);
+				rb1_mask = rb0_mask << 1;
+				rb0_mask &= rb_mask;
+				rb1_mask &= rb_mask;
+				if (!rb0_mask || !rb1_mask) {
+					raster_config_se &= ~RB_MAP_PKR1_MASK;
+
+					if (!rb0_mask) {
+						raster_config_se |=
+							RB_MAP_PKR1(RASTER_CONFIG_RB_MAP_3);
+					} else {
+						raster_config_se |=
+							RB_MAP_PKR1(RASTER_CONFIG_RB_MAP_0);
+					}
+				}
+			}
+		}
+
+		/* GRBM_GFX_INDEX has a different offset on SI */
+		gfx_v6_0_select_se_sh(adev, se, 0xffffffff, 0xffffffff);
+		WREG32(PA_SC_RASTER_CONFIG, raster_config_se);
+	}
+
+	/* GRBM_GFX_INDEX has a different offset on SI */
+	gfx_v6_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
+}
+
 static void gfx_v6_0_setup_rb(struct amdgpu_device *adev,
 			      u32 se_num, u32 sh_per_se,
 			      u32 max_rb_num_per_se)
@@ -945,7 +1062,9 @@ static void gfx_v6_0_setup_rb(struct amdgpu_device *adev,
 	u32 data, mask;
 	u32 disabled_rbs = 0;
 	u32 enabled_rbs = 0;
+	unsigned num_rb_pipes;
 
+	mutex_lock(&adev->grbm_idx_mutex);
 	for (i = 0; i < se_num; i++) {
 		for (j = 0; j < sh_per_se; j++) {
 			gfx_v6_0_select_se_sh(adev, i, j, 0xffffffff);
@@ -965,6 +1084,9 @@ static void gfx_v6_0_setup_rb(struct amdgpu_device *adev,
 	adev->gfx.config.backend_enable_mask = enabled_rbs;
 	adev->gfx.config.num_rbs = hweight32(enabled_rbs);
 
+	num_rb_pipes = min_t(unsigned, adev->gfx.config.max_backends_per_se *
+			     adev->gfx.config.max_shader_engines, 16);
+
 	for (i = 0; i < se_num; i++) {
 		gfx_v6_0_select_se_sh(adev, i, 0xffffffff, 0xffffffff);
 		data = 0;
@@ -983,9 +1105,18 @@ static void gfx_v6_0_setup_rb(struct amdgpu_device *adev,
 			}
 			enabled_rbs >>= 2;
 		}
-		WREG32(PA_SC_RASTER_CONFIG, data);
+		gfx_v6_0_raster_config(adev, &data);
+
+		if (!adev->gfx.config.backend_enable_mask ||
+				adev->gfx.config.num_rbs >= num_rb_pipes)
+			WREG32(PA_SC_RASTER_CONFIG, data);
+		else
+			gfx_v6_0_write_harvested_raster_configs(adev, data,
+								adev->gfx.config.backend_enable_mask,
+								num_rb_pipes);
 	}
 	gfx_v6_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
+	mutex_unlock(&adev->grbm_idx_mutex);
 }
 /*
 static void gmc_v6_0_init_compute_vmid(struct amdgpu_device *adev)
drivers/gpu/drm/amd/include/asic_reg/si/sid.h +35 -0
index 8c5608a..c57eff1 100644
@@ -1398,10 +1398,45 @@
 #define DB_DEPTH_INFO                                   0xA00F
 
 #define PA_SC_RASTER_CONFIG                             0xA0D4
+#	define RB_MAP_PKR0(x)				((x) << 0)
+#	define RB_MAP_PKR0_MASK				(0x3 << 0)
+#	define RB_MAP_PKR1(x)				((x) << 2)
+#	define RB_MAP_PKR1_MASK				(0x3 << 2)
 #       define RASTER_CONFIG_RB_MAP_0                   0
 #       define RASTER_CONFIG_RB_MAP_1                   1
 #       define RASTER_CONFIG_RB_MAP_2                   2
 #       define RASTER_CONFIG_RB_MAP_3                   3
+#	define RB_XSEL2(x)				((x) << 4)
+#	define RB_XSEL2_MASK				(0x3 << 4)
+#	define RB_XSEL					(1 << 6)
+#	define RB_YSEL					(1 << 7)
+#	define PKR_MAP(x)				((x) << 8)
+#	define PKR_MAP_MASK				(0x3 << 8)
+#       define RASTER_CONFIG_PKR_MAP_0			0
+#       define RASTER_CONFIG_PKR_MAP_1			1
+#       define RASTER_CONFIG_PKR_MAP_2			2
+#       define RASTER_CONFIG_PKR_MAP_3			3
+#	define PKR_XSEL(x)				((x) << 10)
+#	define PKR_XSEL_MASK				(0x3 << 10)
+#	define PKR_YSEL(x)				((x) << 12)
+#	define PKR_YSEL_MASK				(0x3 << 12)
+#	define SC_MAP(x)				((x) << 16)
+#	define SC_MAP_MASK				(0x3 << 16)
+#	define SC_XSEL(x)				((x) << 18)
+#	define SC_XSEL_MASK				(0x3 << 18)
+#	define SC_YSEL(x)				((x) << 20)
+#	define SC_YSEL_MASK				(0x3 << 20)
+#	define SE_MAP(x)				((x) << 24)
+#	define SE_MAP_MASK				(0x3 << 24)
+#       define RASTER_CONFIG_SE_MAP_0			0
+#       define RASTER_CONFIG_SE_MAP_1			1
+#       define RASTER_CONFIG_SE_MAP_2			2
+#       define RASTER_CONFIG_SE_MAP_3			3
+#	define SE_XSEL(x)				((x) << 26)
+#	define SE_XSEL_MASK				(0x3 << 26)
+#	define SE_YSEL(x)				((x) << 28)
+#	define SE_YSEL_MASK				(0x3 << 28)
+
 
 #define VGT_EVENT_INITIATOR                             0xA2A4
 #       define SAMPLE_STREAMOUTSTATS1                   (1 << 0)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 2/3 drm/amdgpu: implement raster configuration for gfx v7

In reply to a message not in the archive

This patch is to implement the raster configuration and harvested configuration of gfx v7.

---
 drivers/gpu/drm/amd/amdgpu/cikd.h     |  36 ++++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 160 +++++++++++++++++++++++++++++++++-
 2 files changed, 195 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/cikd.h +36 -0
index c4f6f00..8659852 100644
@@ -562,4 +562,40 @@ enum {
 	MTYPE_NONCACHED = 3
 };
 
+/* mmPA_SC_RASTER_CONFIG mask */
+#define RB_MAP_PKR0(x)				((x) << 0)
+#define RB_MAP_PKR0_MASK			(0x3 << 0)
+#define RB_MAP_PKR1(x)				((x) << 2)
+#define RB_MAP_PKR1_MASK			(0x3 << 2)
+#define RB_XSEL2(x)				((x) << 4)
+#define RB_XSEL2_MASK				(0x3 << 4)
+#define RB_XSEL					(1 << 6)
+#define RB_YSEL					(1 << 7)
+#define PKR_MAP(x)				((x) << 8)
+#define PKR_MAP_MASK				(0x3 << 8)
+#define PKR_XSEL(x)				((x) << 10)
+#define PKR_XSEL_MASK				(0x3 << 10)
+#define PKR_YSEL(x)				((x) << 12)
+#define PKR_YSEL_MASK				(0x3 << 12)
+#define SC_MAP(x)				((x) << 16)
+#define SC_MAP_MASK				(0x3 << 16)
+#define SC_XSEL(x)				((x) << 18)
+#define SC_XSEL_MASK				(0x3 << 18)
+#define SC_YSEL(x)				((x) << 20)
+#define SC_YSEL_MASK				(0x3 << 20)
+#define SE_MAP(x)				((x) << 24)
+#define SE_MAP_MASK				(0x3 << 24)
+#define SE_XSEL(x)				((x) << 26)
+#define SE_XSEL_MASK				(0x3 << 26)
+#define SE_YSEL(x)				((x) << 28)
+#define SE_YSEL_MASK				(0x3 << 28)
+
+/* mmPA_SC_RASTER_CONFIG_1 mask */
+#define SE_PAIR_MAP(x)				((x) << 0)
+#define SE_PAIR_MAP_MASK			(0x3 << 0)
+#define SE_PAIR_XSEL(x)				((x) << 2)
+#define SE_PAIR_XSEL_MASK			(0x3 << 2)
+#define SE_PAIR_YSEL(x)				((x) << 4)
+#define SE_PAIR_YSEL_MASK			(0x3 << 4)
+
 #endif
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +159 -1

184 lines not on this page · raw message

Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#4 lore raw

PATCH 3/3 drm/amdgpu: implement raster configuration for gfx v8

In reply to a message not in the archive

This patch is to implement the raster configuration and harvested configuration of gfx v8.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 168 +++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/vid.h      |  37 ++++++++
 2 files changed, 204 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +167 -1
index 4bb0a39..8516331 100644
@@ -3493,13 +3493,163 @@ static u32 gfx_v8_0_get_rb_active_bitmap(struct amdgpu_device *adev)
 	return (~data) & mask;
 }
 
+static void
+gfx_v8_0_raster_config(struct amdgpu_device *adev, u32 *rconf, u32 *rconf1)
+{
+	switch (adev->asic_type) {
+	case CHIP_FIJI:
+		*rconf |= RB_MAP_PKR0(2) | RB_MAP_PKR1(2) |
+			  RB_XSEL2(1) | PKR_MAP(2) |
+			  PKR_XSEL(1) | PKR_YSEL(1) |
+			  SE_MAP(2) | SE_XSEL(2) | SE_YSEL(3);
+		*rconf1 |= SE_PAIR_MAP(2) | SE_PAIR_XSEL(3) |
+			   SE_PAIR_YSEL(2);
+		break;
+	case CHIP_TONGA:
+	case CHIP_POLARIS10:
+		*rconf |= RB_MAP_PKR0(2) | RB_XSEL2(1) | SE_MAP(2) |
+			  SE_XSEL(1) | SE_YSEL(1);
+		*rconf1 |= SE_PAIR_MAP(2) | SE_PAIR_XSEL(2) |
+			   SE_PAIR_YSEL(2);
+		break;
+	case CHIP_TOPAZ:
+	case CHIP_CARRIZO:
+		*rconf |= RB_MAP_PKR0(2);
+		*rconf1 |= 0x0;
+		break;
+	case CHIP_POLARIS11:
+		*rconf |= RB_MAP_PKR0(2) | RB_XSEL2(1) | SE_MAP(2) |
+			  SE_XSEL(1) | SE_YSEL(1);
+		*rconf1 |= 0x0;
+		break;
+	case CHIP_STONEY:
+		*rconf |= 0x0;
+		*rconf1 |= 0x0;
+		break;
+	default:
+		DRM_ERROR("unknown asic: 0x%x\n", adev->asic_type);
+		break;
+	}
+}
+
+static void
+gfx_v8_0_write_harvested_raster_configs(struct amdgpu_device *adev,
+					u32 raster_config, u32 raster_config_1,
+					unsigned rb_mask, unsigned num_rb)
+{
+	unsigned sh_per_se = max_t(unsigned, adev->gfx.config.max_sh_per_se, 1);
+	unsigned num_se = max_t(unsigned, adev->gfx.config.max_shader_engines, 1);
+	unsigned rb_per_pkr = min_t(unsigned, num_rb / num_se / sh_per_se, 2);
+	unsigned rb_per_se = num_rb / num_se;
+	unsigned se_mask[4];
+	unsigned se;
+
+	se_mask[0] = ((1 << rb_per_se) - 1) & rb_mask;
+	se_mask[1] = (se_mask[0] << rb_per_se) & rb_mask;
+	se_mask[2] = (se_mask[1] << rb_per_se) & rb_mask;
+	se_mask[3] = (se_mask[2] << rb_per_se) & rb_mask;
+
+	WARN_ON(!(num_se == 1 || num_se == 2 || num_se == 4));
+	WARN_ON(!(sh_per_se == 1 || sh_per_se == 2));
+	WARN_ON(!(rb_per_pkr == 1 || rb_per_pkr == 2));
+
+	if ((num_se > 2) && ((!se_mask[0] && !se_mask[1]) ||
+			     (!se_mask[2] && !se_mask[3]))) {
+		raster_config_1 &= ~SE_PAIR_MAP_MASK;
+
+		if (!se_mask[0] && !se_mask[1]) {
+			raster_config_1 |=
+				SE_PAIR_MAP(RASTER_CONFIG_SE_PAIR_MAP_3);
+		} else {
+			raster_config_1 |=
+				SE_PAIR_MAP(RASTER_CONFIG_SE_PAIR_MAP_0);
+		}
+	}
+
+	for (se = 0; se < num_se; se++) {
+		unsigned raster_config_se = raster_config;
+		unsigned pkr0_mask = ((1 << rb_per_pkr) - 1) << (se * rb_per_se);
+		unsigned pkr1_mask = pkr0_mask << rb_per_pkr;
+		int idx = (se / 2) * 2;
+
+		if ((num_se > 1) && (!se_mask[idx] || !se_mask[idx + 1])) {
+			raster_config_se &= ~SE_MAP_MASK;
+
+			if (!se_mask[idx]) {
+				raster_config_se |= SE_MAP(RASTER_CONFIG_SE_MAP_3);
+			} else {
+				raster_config_se |= SE_MAP(RASTER_CONFIG_SE_MAP_0);
+			}
+		}
+
+		pkr0_mask &= rb_mask;
+		pkr1_mask &= rb_mask;
+		if (rb_per_se > 2 && (!pkr0_mask || !pkr1_mask)) {
+			raster_config_se &= ~PKR_MAP_MASK;
+
+			if (!pkr0_mask) {
+				raster_config_se |= PKR_MAP(RASTER_CONFIG_PKR_MAP_3);
+			} else {
+				raster_config_se |= PKR_MAP(RASTER_CONFIG_PKR_MAP_0);
+			}
+		}
+
+		if (rb_per_se >= 2) {
+			unsigned rb0_mask = 1 << (se * rb_per_se);
+			unsigned rb1_mask = rb0_mask << 1;
+
+			rb0_mask &= rb_mask;
+			rb1_mask &= rb_mask;
+			if (!rb0_mask || !rb1_mask) {
+				raster_config_se &= ~RB_MAP_PKR0_MASK;
+
+				if (!rb0_mask) {
+					raster_config_se |=
+						RB_MAP_PKR0(RASTER_CONFIG_RB_MAP_3);
+				} else {
+					raster_config_se |=
+						RB_MAP_PKR0(RASTER_CONFIG_RB_MAP_0);
+				}
+			}
+
+			if (rb_per_se > 2) {
+				rb0_mask = 1 << (se * rb_per_se + rb_per_pkr);
+				rb1_mask = rb0_mask << 1;
+				rb0_mask &= rb_mask;
+				rb1_mask &= rb_mask;
+				if (!rb0_mask || !rb1_mask) {
+					raster_config_se &= ~RB_MAP_PKR1_MASK;
+
+					if (!rb0_mask) {
+						raster_config_se |=
+							RB_MAP_PKR1(RASTER_CONFIG_RB_MAP_3);
+					} else {
+						raster_config_se |=
+							RB_MAP_PKR1(RASTER_CONFIG_RB_MAP_0);
+					}
+				}
+			}
+		}
+
+		/* GRBM_GFX_INDEX has a different offset on VI */
+		gfx_v8_0_select_se_sh(adev, se, 0xffffffff, 0xffffffff);
+		WREG32(mmPA_SC_RASTER_CONFIG, raster_config_se);
+		WREG32(mmPA_SC_RASTER_CONFIG_1, raster_config_1);
+	}
+
+	/* GRBM_GFX_INDEX has a different offset on VI */
+	gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
+}
+
 static void gfx_v8_0_setup_rb(struct amdgpu_device *adev)
 {
 	int i, j;
 	u32 data;
+	u32 raster_config = 0, raster_config_1 = 0;
 	u32 active_rbs = 0;
 	u32 rb_bitmap_width_per_sh = adev->gfx.config.max_backends_per_se /
 					adev->gfx.config.max_sh_per_se;
+	unsigned num_rb_pipes;
 
 	mutex_lock(&adev->grbm_idx_mutex);
 	for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
@@ -3511,10 +3661,26 @@ static void gfx_v8_0_setup_rb(struct amdgpu_device *adev)
 		}
 	}
 	gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
-	mutex_unlock(&adev->grbm_idx_mutex);
 
 	adev->gfx.config.backend_enable_mask = active_rbs;
 	adev->gfx.config.num_rbs = hweight32(active_rbs);
+
+	num_rb_pipes = min_t(unsigned, adev->gfx.config.max_backends_per_se *
+			     adev->gfx.config.max_shader_engines, 16);
+
+	gfx_v8_0_raster_config(adev, &raster_config, &raster_config_1);
+
+	if (!adev->gfx.config.backend_enable_mask ||
+			adev->gfx.config.num_rbs >= num_rb_pipes) {
+		WREG32(mmPA_SC_RASTER_CONFIG, raster_config);
+		WREG32(mmPA_SC_RASTER_CONFIG_1, raster_config_1);
+	} else {
+		gfx_v8_0_write_harvested_raster_configs(adev, raster_config, raster_config_1,
+							adev->gfx.config.backend_enable_mask,
+							num_rb_pipes);
+	}
+
+	mutex_unlock(&adev->grbm_idx_mutex);
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/vid.h +37 -0
index f62b261..11746f2 100644
@@ -373,4 +373,41 @@
 #define VCE_CMD_WAIT_GE         0x00000106
 #define VCE_CMD_UPDATE_PTB      0x00000107
 #define VCE_CMD_FLUSH_TLB       0x00000108
+
+/* mmPA_SC_RASTER_CONFIG mask */
+#define RB_MAP_PKR0(x)				((x) << 0)
+#define RB_MAP_PKR0_MASK			(0x3 << 0)
+#define RB_MAP_PKR1(x)				((x) << 2)
+#define RB_MAP_PKR1_MASK			(0x3 << 2)
+#define RB_XSEL2(x)				((x) << 4)
+#define RB_XSEL2_MASK				(0x3 << 4)
+#define RB_XSEL					(1 << 6)
+#define RB_YSEL					(1 << 7)
+#define PKR_MAP(x)				((x) << 8)
+#define PKR_MAP_MASK				(0x3 << 8)
+#define PKR_XSEL(x)				((x) << 10)
+#define PKR_XSEL_MASK				(0x3 << 10)
+#define PKR_YSEL(x)				((x) << 12)
+#define PKR_YSEL_MASK				(0x3 << 12)
+#define SC_MAP(x)				((x) << 16)
+#define SC_MAP_MASK				(0x3 << 16)
+#define SC_XSEL(x)				((x) << 18)
+#define SC_XSEL_MASK				(0x3 << 18)
+#define SC_YSEL(x)				((x) << 20)
+#define SC_YSEL_MASK				(0x3 << 20)
+#define SE_MAP(x)				((x) << 24)
+#define SE_MAP_MASK				(0x3 << 24)
+#define SE_XSEL(x)				((x) << 26)
+#define SE_XSEL_MASK				(0x3 << 26)
+#define SE_YSEL(x)				((x) << 28)
+#define SE_YSEL_MASK				(0x3 << 28)
+
+/* mmPA_SC_RASTER_CONFIG_1 mask */
+#define SE_PAIR_MAP(x)				((x) << 0)
+#define SE_PAIR_MAP_MASK			(0x3 << 0)
+#define SE_PAIR_XSEL(x)				((x) << 2)
+#define SE_PAIR_XSEL_MASK			(0x3 << 2)
+#define SE_PAIR_YSEL(x)				((x) << 4)
+#define SE_PAIR_YSEL_MASK			(0x3 << 4)
+
 #endif
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw
In reply to a message not in the archive

This series is,

Quoted 13 lines · Huang Rui

Hi all,

This patch set is to introduce the raster configuration for all gfx generations.

Thanks,
Rui

Huang Rui (3):
drm/amdgpu: implement raster configuration for gfx v6 drm/amdgpu: implement raster configuration for gfx v7 drm/amdgpu: implement raster configuration for gfx v8

Quoted 8 lines
 drivers/gpu/drm/amd/amdgpu/cikd.h             |  36 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c         | 133 +++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c         | 160 +++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c         | 168 +++++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/vid.h              |  37 ++++++
 drivers/gpu/drm/amd/include/asic_reg/si/sid.h |  35 ++++++
 6 files changed, 566 insertions(+), 3 deletions(-)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#6 lore raw
In reply to a message not in the archive
Quoted 4 lines · Huang Rui

Hi all,

This patch set is to introduce the raster configuration for all gfx generations.

What's the motivation for doing this in the kernel? Mesa will write its own values to these registers anyway.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 3790458b-489a-f408-860d-f9650a9f5cab-otUistvHUpPR7s880joybQ@public.gmane.org

#8 lore raw
Quoted 7 lines

-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Monday, September 19, 2016 10:37 PM
To: Huang, Ray; Deucher, Alexander
Cc: [email protected]; Wang, Ken; Huan, Alvin
Subject: Re: [PATCH 0/3] drm/amdgpu: implement raster configuration

Quoted 8 lines
Quoted 4 lines · Huang Rui

Hi all,

This patch set is to introduce the raster configuration for all gfx generations.

What's the motivation for doing this in the kernel? Mesa will write its own values to these registers anyway.

It's to fix the read register ioctl interface. The raster config registers can be read back by the UMDs, but if the KMD hasn't programmed them, they may have bogus values. It's mainly for the pro drivers which read the raster config registers to get the baseline before programming them. Mesa hardcodes the default raster config settings before harvesting. We arguably should have done it in the kernel as well for mesa (my bad). At least this way both sides are doing the right thing.

Alex
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MWHPR12MB1694A4272F0252A1DE07D68CF7F70-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#10 lore raw

Am 20.09.2016 um 06:05 schrieb Deucher, Alexander:

Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Monday, September 19, 2016 10:37 PM
To: Huang, Ray; Deucher, Alexander
Cc: [email protected]; Wang, Ken; Huan, Alvin
Subject: Re: [PATCH 0/3] drm/amdgpu: implement raster configuration

Quoted 8 lines
Quoted 7 lines · Huang Rui
Quoted 4 lines

Hi all,

This patch set is to introduce the raster configuration for all gfx generations.

What's the motivation for doing this in the kernel? Mesa will write its own values to these registers anyway.

It's to fix the read register ioctl interface. The raster config registers can be read back by the UMDs, but if the KMD hasn't programmed them, they may have bogus values. It's mainly for the pro drivers which read the raster config registers to get the baseline before programming them. Mesa hardcodes the default raster config settings before harvesting. We arguably should have done it in the kernel as well for mesa (my bad). At least this way both sides are doing the right thing.

Yeah, I wondered before as well why we don't do this in the kernel. What was the reason to move it into Mesa?

The patchset itself is Acked-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 6 lines

Alex
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 0ae26e18-49f2-9aba-abcc-d530c0da3947-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#12 lore raw
Quoted 28 lines · Christian König

Am 20.09.2016 um 06:05 schrieb Deucher, Alexander:

Quoted 18 lines
Quoted 10 lines

-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Monday, September 19, 2016 10:37 PM
To: Huang, Ray; Deucher, Alexander
Cc: [email protected]; Wang, Ken; Huan, Alvin
Subject: Re: [PATCH 0/3] drm/amdgpu: implement raster configuration

Quoted 1 line · Huang Rui
Quoted 7 lines
Quoted 4 lines

Hi all,

This patch set is to introduce the raster configuration for all gfx generations.

What's the motivation for doing this in the kernel? Mesa will write its own values to these registers anyway.

Quoted 7 lines

It's to fix the read register ioctl interface. The raster config registers can be read back by the UMDs, but if the KMD hasn't programmed them, they may have bogus values. It's mainly for the pro drivers which read the raster config registers to get the baseline before programming them. Mesa hardcodes the default raster config settings before harvesting. We arguably should have done it in the kernel as well for mesa (my bad). At least this way both sides are doing the right thing.

Quoted 2 lines

Yeah, I wondered before as well why we don't do this in the kernel. What was the reason to move it into Mesa?

I just thought it made more sense to do it in mesa since it's part of the 3D state and mesa needs to program it anyway (ideally we'd also make adjustments to it to handle rendering to GTT and certain crossfire configurations), but It makes more sense to put the base harvest logic in the kernel driver.

Alex

Quoted 16 lines

The patchset itself is Acked-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 6 lines

Alex
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#13 lore raw
In reply to a message not in the archive

The series is missing a DRM version bump, so Mesa can't really use it even if it wanted.

Marek

Quoted 21 lines · Huang Rui

Hi all,

This patch set is to introduce the raster configuration for all gfx generations.

Thanks,
Rui

Huang Rui (3):
drm/amdgpu: implement raster configuration for gfx v6 drm/amdgpu: implement raster configuration for gfx v7 drm/amdgpu: implement raster configuration for gfx v8

 drivers/gpu/drm/amd/amdgpu/cikd.h             |  36 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c         | 133 +++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c         | 160 +++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c         | 168 +++++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/vid.h              |  37 ++++++
 drivers/gpu/drm/amd/include/asic_reg/si/sid.h |  35 ++++++
 6 files changed, 566 insertions(+), 3 deletions(-)
Quoted 7 lines

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CAAxE2A7nSCd-_ViLiJ5RZfTC54DNoYCKL2Ny=WgLSDVCEcdVOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#15 lore raw
Quoted 10 lines

-----Original Message-----
From: Marek Olšák [mailto:[email protected]]
Sent: Monday, September 26, 2016 4:39 PM
To: Huang, Ray
Cc: amd-gfx mailing list; Deucher, Alexander; Wang, Ken; Huan, Alvin
Subject: Re: [PATCH 0/3] drm/amdgpu: implement raster configuration

The series is missing a DRM version bump, so Mesa can't really use it even if it wanted.

We bumped it already this cycle for several other things, but I can add a specific bump for this as well if that is preferred.

Alex

Quoted 16 lines

Marek

Quoted 13 lines · Huang Rui

Hi all,

This patch set is to introduce the raster configuration for all gfx generations.

Thanks,
Rui

Huang Rui (3):
drm/amdgpu: implement raster configuration for gfx v6 drm/amdgpu: implement raster configuration for gfx v7 drm/amdgpu: implement raster configuration for gfx v8

Quoted 18 lines
Quoted 2 lines
 drivers/gpu/drm/amd/amdgpu/cikd.h             |  36 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c         | 133

+++++++++++++++++++-

Quoted 1 line
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c         | 160

+++++++++++++++++++++++-

Quoted 1 line
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c         | 168

+++++++++++++++++++++++++-

Quoted 11 lines
 drivers/gpu/drm/amd/amdgpu/vid.h              |  37 ++++++
 drivers/gpu/drm/amd/include/asic_reg/si/sid.h |  35 ++++++
 6 files changed, 566 insertions(+), 3 deletions(-)

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MWHPR12MB1694E693082763289AA98A51F7CD0-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#17 lore raw
Quoted 7 lines · Alexander
Quoted 7 lines

-----Original Message-----
From: Marek Olšák [mailto:[email protected]]
Sent: Monday, September 26, 2016 4:39 PM
To: Huang, Ray
Cc: amd-gfx mailing list; Deucher, Alexander; Wang, Ken; Huan, Alvin
Subject: Re: [PATCH 0/3] drm/amdgpu: implement raster configuration

Quoted 5 lines
Quoted 3 lines

The series is missing a DRM version bump, so Mesa can't really use it even if it wanted.

We bumped it already this cycle for several other things, but I can add a specific bump for this as well if that is preferred.

Oh, that's not necessary. One bump per cycle is OK.

Marek
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CAAxE2A7qzNC1mBJ9Q0SbL3A8xmfjhMrYk6Ey4kB3ws9s7VUDeg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#19 lore raw

Am 27.09.2016 um 01:13 schrieb Marek Olšák:

Quoted 9 lines
Quoted 7 lines · Alexander
Quoted 7 lines

-----Original Message-----
From: Marek Olšák [mailto:[email protected]]
Sent: Monday, September 26, 2016 4:39 PM
To: Huang, Ray
Cc: amd-gfx mailing list; Deucher, Alexander; Wang, Ken; Huan, Alvin
Subject: Re: [PATCH 0/3] drm/amdgpu: implement raster configuration

Quoted 5 lines
Quoted 4 lines
Quoted 3 lines

The series is missing a DRM version bump, so Mesa can't really use it even if it wanted.

We bumped it already this cycle for several other things, but I can add a specific bump for this as well if that is preferred.

Oh, that's not necessary. One bump per cycle is OK.

As I wrote in the other thread as well, bumping once per cycle sucks when you want to bisect something.

We are also not short on numbers, so I suggest that we establish that we always bump when we add a new interface to the kernel IOCTL.

Christian.

Quoted 6 lines

Marek
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 4120919c-2b50-b78a-406d-f3974ef00f12-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#21 lore raw
Quoted 15 lines · Christian König

Am 27.09.2016 um 01:13 schrieb Marek Olšák:

Quoted 14 lines
Quoted 12 lines · Alexander
Quoted 10 lines

-----Original Message-----
From: Marek Olšák [mailto:[email protected]]
Sent: Monday, September 26, 2016 4:39 PM
To: Huang, Ray
Cc: amd-gfx mailing list; Deucher, Alexander; Wang, Ken; Huan, Alvin
Subject: Re: [PATCH 0/3] drm/amdgpu: implement raster configuration

The series is missing a DRM version bump, so Mesa can't really use it even if it wanted.

We bumped it already this cycle for several other things, but I can add a specific bump for this as well if that is preferred.

Quoted 7 lines
Quoted 1 line

Oh, that's not necessary. One bump per cycle is OK.

As I wrote in the other thread as well, bumping once per cycle sucks when you want to bisect something.

We are also not short on numbers, so I suggest that we establish that we always bump when we add a new interface to the kernel IOCTL.

Seconded.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx