> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf
> Of Emily Deng
> Sent: Tuesday, August 09, 2016 9:45 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deng, Emily
> Subject: [PATCH v4] drm/amdgpu: Change the virtual_display type from int
> to char*.
> 
> Replace variable enable_virtual_display and change the type of
> enable_virtual_display.
> 
> 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.d...@amd.com>

Reviewed-by: Alex Deucher <alexander.deuc...@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  3 ++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 29
> ++++++++++++++++++++++++++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/cik.c           |  2 +-
>  drivers/gpu/drm/amd/amdgpu/vi.c            |  2 +-
>  5 files changed, 35 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index c309eaf..e9e3525 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -93,7 +93,7 @@ extern unsigned amdgpu_pcie_lane_cap;
>  extern unsigned amdgpu_cg_mask;
>  extern unsigned amdgpu_pg_mask;
>  extern int amdgpu_sclk_deep_sleep_en;
> -extern int amdgpu_virtual_display;
> +extern char *amdgpu_virtual_display;
> 
>  #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS               3000
>  #define AMDGPU_MAX_USEC_TIMEOUT                      100000  /* 100
> ms */
> @@ -2076,6 +2076,7 @@ struct amdgpu_device {
>       atomic_t                        gpu_reset_counter;
> 
>       /* display */
> +     bool                            enable_virtual_display;
>       struct amdgpu_mode_info         mode_info;
>       /* For pre-DCE11. DCE11 and later are in "struct amdgpu_device-
> >dm" */
>       struct work_struct              hotplug_work;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 68cce12..5376361 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -47,6 +47,7 @@
>  #endif
>  #include "vi.h"
>  #include "bif/bif_4_1_d.h"
> +#include <linux/pci.h>
> 
>  static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
>  static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);
> @@ -1182,11 +1183,37 @@ int amdgpu_ip_block_version_cmp(struct
> amdgpu_device *adev,
>       return 1;
>  }
> 
> +static void amdgpu_whether_enable_virtual_display(struct amdgpu_device
> *adev)
> +{
> +     adev->enable_virtual_display = false;
> +
> +     if (amdgpu_virtual_display) {
> +             struct drm_device *ddev = adev->ddev;
> +             const char *pci_address_name = pci_name(ddev->pdev);
> +             char *pciaddstr, *pciaddstr_tmp, *pciaddname;
> +
> +             pciaddstr = kstrdup(amdgpu_virtual_display, GFP_KERNEL);
> +             pciaddstr_tmp = pciaddstr;
> +             while ((pciaddname = strsep(&pciaddstr_tmp, ";"))) {
> +                     if (!strcmp(pci_address_name, pciaddname)) {
> +                             adev->enable_virtual_display = true;
> +                             break;
> +                     }
> +             }
> +
> +             DRM_INFO("virtual display string:%s,
> %s:virtual_display:%d\n",
> +                              amdgpu_virtual_display, pci_address_name,
> +                              adev->enable_virtual_display);
> +
> +             kfree(pciaddstr);
> +     }
> +}
> +
>  static int amdgpu_early_init(struct amdgpu_device *adev)
>  {
>       int i, r;
> 
> -     DRM_INFO("virtual display enabled:%d\n", amdgpu_virtual_display);
> +     amdgpu_whether_enable_virtual_display(adev);
> 
>       switch (adev->asic_type) {
>       case CHIP_TOPAZ:
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 7007cf7..209a539 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -90,7 +90,7 @@ unsigned amdgpu_pcie_gen_cap = 0;
>  unsigned amdgpu_pcie_lane_cap = 0;
>  unsigned amdgpu_cg_mask = 0xffffffff;
>  unsigned amdgpu_pg_mask = 0xffffffff;
> -int amdgpu_virtual_display = 0;
> +char *amdgpu_virtual_display = NULL;
> 
>  MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in
> megabytes");
>  module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
> @@ -190,8 +190,8 @@ module_param_named(cg_mask, amdgpu_cg_mask,
> uint, 0444);
>  MODULE_PARM_DESC(pg_mask, "Powergating flags mask (0 = disable
> power gating)");
>  module_param_named(pg_mask, amdgpu_pg_mask, uint, 0444);
> 
> -MODULE_PARM_DESC(virtual_display, "enable virtual display (0 = disable
> virtual display)");
> -module_param_named(virtual_display, amdgpu_virtual_display, int, 0444);
> +MODULE_PARM_DESC(virtual_display, "Enable virtual display feature (the
> virtual_display will be set like xxxx:xx:xx.x;xxxx:xx:xx.x)");
> +module_param_named(virtual_display, amdgpu_virtual_display, charp,
> 0444);
> 
>  static const struct pci_device_id pciidlist[] = {
>  #ifdef CONFIG_DRM_AMDGPU_CIK
> diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c
> b/drivers/gpu/drm/amd/amdgpu/cik.c
> index 84caa3f..a9fc2bb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/cik.c
> +++ b/drivers/gpu/drm/amd/amdgpu/cik.c
> @@ -2464,7 +2464,7 @@ static const struct amdgpu_ip_block_version
> kaveri_ip_blocks_vd[] =
> 
>  int cik_set_ip_blocks(struct amdgpu_device *adev)
>  {
> -     if (amdgpu_virtual_display) {
> +     if (adev->enable_virtual_display) {
>               amdgpu_dal = 0;
>               switch (adev->asic_type) {
>               case CHIP_BONAIRE:
> diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c
> b/drivers/gpu/drm/amd/amdgpu/vi.c
> index 224e8a0..b9da2c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vi.c
> @@ -1730,7 +1730,7 @@ static const struct amdgpu_ip_block_version
> fiji_ip_blocks_dal[] =
> 
>  int vi_set_ip_blocks(struct amdgpu_device *adev)
>  {
> -     if (amdgpu_virtual_display) {
> +     if (adev->enable_virtual_display) {
>               amdgpu_dal = 0;
>               switch (adev->asic_type) {
>               case CHIP_TOPAZ:
> --
> 1.9.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to