diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2017-03-28 12:52:08 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-03-29 23:54:38 -0400 |
commit | bce23e00f3369ce8c32c90f087e37c01f83002d1 (patch) | |
tree | 3df0d81efff53d806dac25a7463f0d7aad5a2a5e | |
parent | ca02061c7a8ca3956e9e1cd60947b97d444e1622 (diff) |
drm/amdgpu: add NGG parameters
NGG (Next Generation Graphics) is a new feature in GFX9.0. This
adds the relevant parameters.
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 7 | ||||
-rw-r--r-- | include/uapi/drm/amdgpu_drm.h | 8 |
4 files changed, 65 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 75525980a5a2..886f105958a5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -103,6 +103,11 @@ extern char *amdgpu_disable_cu; | |||
103 | extern char *amdgpu_virtual_display; | 103 | extern char *amdgpu_virtual_display; |
104 | extern unsigned amdgpu_pp_feature_mask; | 104 | extern unsigned amdgpu_pp_feature_mask; |
105 | extern int amdgpu_vram_page_split; | 105 | extern int amdgpu_vram_page_split; |
106 | extern int amdgpu_ngg; | ||
107 | extern int amdgpu_prim_buf_per_se; | ||
108 | extern int amdgpu_pos_buf_per_se; | ||
109 | extern int amdgpu_cntl_sb_buf_per_se; | ||
110 | extern int amdgpu_param_buf_per_se; | ||
106 | 111 | ||
107 | #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000 | 112 | #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000 |
108 | #define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ | 113 | #define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ |
@@ -957,6 +962,28 @@ struct amdgpu_gfx_funcs { | |||
957 | void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst); | 962 | void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst); |
958 | }; | 963 | }; |
959 | 964 | ||
965 | struct amdgpu_ngg_buf { | ||
966 | struct amdgpu_bo *bo; | ||
967 | uint64_t gpu_addr; | ||
968 | uint32_t size; | ||
969 | uint32_t bo_size; | ||
970 | }; | ||
971 | |||
972 | enum { | ||
973 | PRIM = 0, | ||
974 | POS, | ||
975 | CNTL, | ||
976 | PARAM, | ||
977 | NGG_BUF_MAX | ||
978 | }; | ||
979 | |||
980 | struct amdgpu_ngg { | ||
981 | struct amdgpu_ngg_buf buf[NGG_BUF_MAX]; | ||
982 | uint32_t gds_reserve_addr; | ||
983 | uint32_t gds_reserve_size; | ||
984 | bool init; | ||
985 | }; | ||
986 | |||
960 | struct amdgpu_gfx { | 987 | struct amdgpu_gfx { |
961 | struct mutex gpu_clock_mutex; | 988 | struct mutex gpu_clock_mutex; |
962 | struct amdgpu_gfx_config config; | 989 | struct amdgpu_gfx_config config; |
@@ -1000,6 +1027,8 @@ struct amdgpu_gfx { | |||
1000 | uint32_t grbm_soft_reset; | 1027 | uint32_t grbm_soft_reset; |
1001 | uint32_t srbm_soft_reset; | 1028 | uint32_t srbm_soft_reset; |
1002 | bool in_reset; | 1029 | bool in_reset; |
1030 | /* NGG */ | ||
1031 | struct amdgpu_ngg ngg; | ||
1003 | }; | 1032 | }; |
1004 | 1033 | ||
1005 | int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, | 1034 | int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 7292f4e7bb1a..2b05c891747b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |||
@@ -103,6 +103,11 @@ unsigned amdgpu_pg_mask = 0xffffffff; | |||
103 | char *amdgpu_disable_cu = NULL; | 103 | char *amdgpu_disable_cu = NULL; |
104 | char *amdgpu_virtual_display = NULL; | 104 | char *amdgpu_virtual_display = NULL; |
105 | unsigned amdgpu_pp_feature_mask = 0xffffffff; | 105 | unsigned amdgpu_pp_feature_mask = 0xffffffff; |
106 | int amdgpu_ngg = 0; | ||
107 | int amdgpu_prim_buf_per_se = 0; | ||
108 | int amdgpu_pos_buf_per_se = 0; | ||
109 | int amdgpu_cntl_sb_buf_per_se = 0; | ||
110 | int amdgpu_param_buf_per_se = 0; | ||
106 | 111 | ||
107 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); | 112 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); |
108 | module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); | 113 | module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); |
@@ -210,6 +215,22 @@ MODULE_PARM_DESC(virtual_display, | |||
210 | "Enable virtual display feature (the virtual_display will be set like xxxx:xx:xx.x,x;xxxx:xx:xx.x,x)"); | 215 | "Enable virtual display feature (the virtual_display will be set like xxxx:xx:xx.x,x;xxxx:xx:xx.x,x)"); |
211 | module_param_named(virtual_display, amdgpu_virtual_display, charp, 0444); | 216 | module_param_named(virtual_display, amdgpu_virtual_display, charp, 0444); |
212 | 217 | ||
218 | MODULE_PARM_DESC(ngg, "Next Generation Graphics (1 = enable, 0 = disable(default depending on gfx))"); | ||
219 | module_param_named(ngg, amdgpu_ngg, int, 0444); | ||
220 | |||
221 | MODULE_PARM_DESC(prim_buf_per_se, "the size of Primitive Buffer per Shader Engine (default depending on gfx)"); | ||
222 | module_param_named(prim_buf_per_se, amdgpu_prim_buf_per_se, int, 0444); | ||
223 | |||
224 | MODULE_PARM_DESC(pos_buf_per_se, "the size of Position Buffer per Shader Engine (default depending on gfx)"); | ||
225 | module_param_named(pos_buf_per_se, amdgpu_pos_buf_per_se, int, 0444); | ||
226 | |||
227 | MODULE_PARM_DESC(cntl_sb_buf_per_se, "the size of Control Sideband per Shader Engine (default depending on gfx)"); | ||
228 | module_param_named(cntl_sb_buf_per_se, amdgpu_cntl_sb_buf_per_se, int, 0444); | ||
229 | |||
230 | MODULE_PARM_DESC(param_buf_per_se, "the size of Off-Chip Pramater Cache per Shader Engine (default depending on gfx)"); | ||
231 | module_param_named(param_buf_per_se, amdgpu_param_buf_per_se, int, 0444); | ||
232 | |||
233 | |||
213 | static const struct pci_device_id pciidlist[] = { | 234 | static const struct pci_device_id pciidlist[] = { |
214 | #ifdef CONFIG_DRM_AMDGPU_SI | 235 | #ifdef CONFIG_DRM_AMDGPU_SI |
215 | {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI}, | 236 | {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI}, |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index ef91c8e2b8e3..a6d15978d821 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
@@ -541,6 +541,13 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
541 | dev_info.gc_double_offchip_lds_buf = | 541 | dev_info.gc_double_offchip_lds_buf = |
542 | adev->gfx.config.double_offchip_lds_buf; | 542 | adev->gfx.config.double_offchip_lds_buf; |
543 | 543 | ||
544 | if (amdgpu_ngg) { | ||
545 | dev_info.prim_buf_gpu_addr = adev->gfx.ngg.buf[PRIM].gpu_addr; | ||
546 | dev_info.pos_buf_gpu_addr = adev->gfx.ngg.buf[POS].gpu_addr; | ||
547 | dev_info.cntl_sb_buf_gpu_addr = adev->gfx.ngg.buf[CNTL].gpu_addr; | ||
548 | dev_info.param_buf_gpu_addr = adev->gfx.ngg.buf[PARAM].gpu_addr; | ||
549 | } | ||
550 | |||
544 | return copy_to_user(out, &dev_info, | 551 | return copy_to_user(out, &dev_info, |
545 | min((size_t)size, sizeof(dev_info))) ? -EFAULT : 0; | 552 | min((size_t)size, sizeof(dev_info))) ? -EFAULT : 0; |
546 | } | 553 | } |
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 5d8e7090fe9e..d3f121a02bed 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h | |||
@@ -743,6 +743,14 @@ struct drm_amdgpu_info_device { | |||
743 | __u32 vce_harvest_config; | 743 | __u32 vce_harvest_config; |
744 | /* gfx double offchip LDS buffers */ | 744 | /* gfx double offchip LDS buffers */ |
745 | __u32 gc_double_offchip_lds_buf; | 745 | __u32 gc_double_offchip_lds_buf; |
746 | /* NGG Primitive Buffer */ | ||
747 | __u64 prim_buf_gpu_addr; | ||
748 | /* NGG Position Buffer */ | ||
749 | __u64 pos_buf_gpu_addr; | ||
750 | /* NGG Control Sideband */ | ||
751 | __u64 cntl_sb_buf_gpu_addr; | ||
752 | /* NGG Parameter Cache */ | ||
753 | __u64 param_buf_gpu_addr; | ||
746 | }; | 754 | }; |
747 | 755 | ||
748 | struct drm_amdgpu_info_hw_ip { | 756 | struct drm_amdgpu_info_hw_ip { |