diff options
author | Emily Deng <Emily.Deng@amd.com> | 2016-09-30 13:02:18 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-10-25 14:38:07 -0400 |
commit | 0f66356d24c6950bf6b1a47df7c77ca57305074d (patch) | |
tree | 54fd08d5459182f64334431bcc3e4e77bf8ca628 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | 483ef98588aa9f2236392f505beadb621f288861 (diff) |
drm/amd/amdgpu: For virtual display, enable multi crtcs. (v3)
Enable multi crtcs for virtual display, user can set the number of crtcs
by amdgpu module parameter virtual_display.
v2: make timers per crtc
v3: agd: simplify implementation
Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-By: Emily Deng <Emily.Deng@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.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 874c33b43955..22d331947aca 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1238,20 +1238,38 @@ static void amdgpu_device_enable_virtual_display(struct amdgpu_device *adev) | |||
1238 | if (amdgpu_virtual_display) { | 1238 | if (amdgpu_virtual_display) { |
1239 | struct drm_device *ddev = adev->ddev; | 1239 | struct drm_device *ddev = adev->ddev; |
1240 | const char *pci_address_name = pci_name(ddev->pdev); | 1240 | const char *pci_address_name = pci_name(ddev->pdev); |
1241 | char *pciaddstr, *pciaddstr_tmp, *pciaddname; | 1241 | char *pciaddstr, *pciaddstr_tmp, *pciaddname_tmp, *pciaddname; |
1242 | 1242 | ||
1243 | pciaddstr = kstrdup(amdgpu_virtual_display, GFP_KERNEL); | 1243 | pciaddstr = kstrdup(amdgpu_virtual_display, GFP_KERNEL); |
1244 | pciaddstr_tmp = pciaddstr; | 1244 | pciaddstr_tmp = pciaddstr; |
1245 | while ((pciaddname = strsep(&pciaddstr_tmp, ";"))) { | 1245 | while ((pciaddname_tmp = strsep(&pciaddstr_tmp, ";"))) { |
1246 | pciaddname = strsep(&pciaddname_tmp, ","); | ||
1246 | if (!strcmp(pci_address_name, pciaddname)) { | 1247 | if (!strcmp(pci_address_name, pciaddname)) { |
1248 | long num_crtc; | ||
1249 | int res = -1; | ||
1250 | |||
1247 | adev->enable_virtual_display = true; | 1251 | adev->enable_virtual_display = true; |
1252 | |||
1253 | if (pciaddname_tmp) | ||
1254 | res = kstrtol(pciaddname_tmp, 10, | ||
1255 | &num_crtc); | ||
1256 | |||
1257 | if (!res) { | ||
1258 | if (num_crtc < 1) | ||
1259 | num_crtc = 1; | ||
1260 | if (num_crtc > 6) | ||
1261 | num_crtc = 6; | ||
1262 | adev->mode_info.num_crtc = num_crtc; | ||
1263 | } else { | ||
1264 | adev->mode_info.num_crtc = 1; | ||
1265 | } | ||
1248 | break; | 1266 | break; |
1249 | } | 1267 | } |
1250 | } | 1268 | } |
1251 | 1269 | ||
1252 | DRM_INFO("virtual display string:%s, %s:virtual_display:%d\n", | 1270 | DRM_INFO("virtual display string:%s, %s:virtual_display:%d, num_crtc:%d\n", |
1253 | amdgpu_virtual_display, pci_address_name, | 1271 | amdgpu_virtual_display, pci_address_name, |
1254 | adev->enable_virtual_display); | 1272 | adev->enable_virtual_display, adev->mode_info.num_crtc); |
1255 | 1273 | ||
1256 | kfree(pciaddstr); | 1274 | kfree(pciaddstr); |
1257 | } | 1275 | } |