aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorEmily Deng <Emily.Deng@amd.com>2016-08-10 04:01:25 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-08-10 14:04:17 -0400
commit9accf2fd33e969862c55be0c20dbfb9b0890bbb8 (patch)
treee5af1b2ffec41f0a439ba3b4a49210dee0cdb2b6 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent4f4b78341b658cfa0ca7b1587f5540c21f9db997 (diff)
drm/amdgpu: Change the virtual_display type from int to char*.
For virtual display feature, as there may be multiple GPUs, for user could choose whiche GPU need to enable this feature, change the type of virtual_display from int to char*. The variable will be set like this virtual_display="xxxx:xx:xx.x;xxxx:xx:xx.x;". Signed-off-by: Emily Deng <Emily.Deng@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 4bf9bd96a46e..3751d262de68 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -46,6 +46,7 @@
46#endif 46#endif
47#include "vi.h" 47#include "vi.h"
48#include "bif/bif_4_1_d.h" 48#include "bif/bif_4_1_d.h"
49#include <linux/pci.h>
49 50
50static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev); 51static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
51static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev); 52static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);
@@ -1181,11 +1182,37 @@ int amdgpu_ip_block_version_cmp(struct amdgpu_device *adev,
1181 return 1; 1182 return 1;
1182} 1183}
1183 1184
1185static void amdgpu_whether_enable_virtual_display(struct amdgpu_device *adev)
1186{
1187 adev->enable_virtual_display = false;
1188
1189 if (amdgpu_virtual_display) {
1190 struct drm_device *ddev = adev->ddev;
1191 const char *pci_address_name = pci_name(ddev->pdev);
1192 char *pciaddstr, *pciaddstr_tmp, *pciaddname;
1193
1194 pciaddstr = kstrdup(amdgpu_virtual_display, GFP_KERNEL);
1195 pciaddstr_tmp = pciaddstr;
1196 while ((pciaddname = strsep(&pciaddstr_tmp, ";"))) {
1197 if (!strcmp(pci_address_name, pciaddname)) {
1198 adev->enable_virtual_display = true;
1199 break;
1200 }
1201 }
1202
1203 DRM_INFO("virtual display string:%s, %s:virtual_display:%d\n",
1204 amdgpu_virtual_display, pci_address_name,
1205 adev->enable_virtual_display);
1206
1207 kfree(pciaddstr);
1208 }
1209}
1210
1184static int amdgpu_early_init(struct amdgpu_device *adev) 1211static int amdgpu_early_init(struct amdgpu_device *adev)
1185{ 1212{
1186 int i, r; 1213 int i, r;
1187 1214
1188 DRM_INFO("virtual display enabled:%d\n", amdgpu_virtual_display); 1215 amdgpu_whether_enable_virtual_display(adev);
1189 1216
1190 switch (adev->asic_type) { 1217 switch (adev->asic_type) {
1191 case CHIP_TOPAZ: 1218 case CHIP_TOPAZ: