Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)

2021-07-26 Thread Taylor, Ryan
[AMD Official Use Only]

Sounds good, Thanks for clarifying. Thanks for the input Guchun.

Best,
Ryan

From: Alex Deucher 
Sent: Monday, July 26, 2021 9:58 AM
To: Taylor, Ryan 
Cc: Chen, Guchun ; kernel test robot ; 
Daniel Vetter ; Siqueira, Rodrigo 
; amd-gfx list ; 
Melissa Wen ; Maling list - DRI developers 

Subject: Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)

On Mon, Jul 26, 2021 at 12:39 PM Taylor, Ryan  wrote:
>
> [AMD Official Use Only]
>
>
> Given that amdgpu_vkms contains code from both dce_virtual and vkms should 
> the identifier be changed to GPL-2.0+ OR MIT like in amdgpu_res_cursor.h?

Most of the code is from vkms so match vkms.

Alex


>
> Best,
> Ryan
> 
> From: Alex Deucher 
> Sent: Monday, July 26, 2021 9:21 AM
> To: Chen, Guchun 
> Cc: Taylor, Ryan ; kernel test robot ; 
> Daniel Vetter ; Siqueira, Rodrigo 
> ; amd-gfx list ; 
> Melissa Wen ; Maling list - DRI developers 
> 
> Subject: Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)
>
> On Fri, Jul 23, 2021 at 10:07 PM Chen, Guchun  wrote:
> >
> > [Public]
> >
> > Look copy right statement is missed in both amdgpu_vkms.c and amdgpu_vkms.h.
>
> It's there, it just uses the newer SPDX license identifier.
>
> Alex
>
>
> >
> > Regards,
> > Guchun
> >
> > -Original Message-
> > From: amd-gfx  On Behalf Of Alex 
> > Deucher
> > Sent: Friday, July 23, 2021 10:32 PM
> > To: Taylor, Ryan 
> > Cc: kernel test robot ; Daniel Vetter 
> > ; Siqueira, Rodrigo ; 
> > amd-gfx list ; Melissa Wen 
> > ; Maling list - DRI developers 
> > 
> > Subject: Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)
> >
> > On Wed, Jul 21, 2021 at 1:07 PM Ryan Taylor  wrote:
> > >
> > > Modify the VKMS driver into an api that dce_virtual can use to create
> > > virtual displays that obey drm's atomic modesetting api.
> > >
> > > v2: Made local functions static.
> > >
> > > Reported-by: kernel test robot 
> > > Signed-off-by: Ryan Taylor 
> > > ---
> > >  drivers/gpu/drm/amd/amdgpu/Makefile  |   1 +
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu.h  |   1 +
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |   2 +-
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c   |   2 +-
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 411
> > > +++  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h |
> > > 29 ++  drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  23 +-
> > >  7 files changed, 458 insertions(+), 11 deletions(-)  create mode
> > > 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> > >  create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile
> > > b/drivers/gpu/drm/amd/amdgpu/Makefile
> > > index f089794bbdd5..30cbcd5ce1cc 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/Makefile
> > > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
> > > @@ -120,6 +120,7 @@ amdgpu-y += \
> > >  amdgpu-y += \
> > > dce_v10_0.o \
> > > dce_v11_0.o \
> > > +   amdgpu_vkms.o \
> > > dce_virtual.o
> > >
> > >  # add GFX block
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > index 54cf647bd018..d0a2f2ed433d 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > @@ -919,6 +919,7 @@ struct amdgpu_device {
> > >
> > > /* display */
> > > boolenable_virtual_display;
> > > +   struct amdgpu_vkms_output   *amdgpu_vkms_output;
> > > 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_drv.c
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > > index d0c935cf4f0f..1b016e5bc75f 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > > @@ -1230,7 +1230,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> > > int ret, retry = 0;
> > > bool supports_atomic = false;
> > >
> > > -   if (!amdgpu_virtual_display &&
> &

Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)

2021-07-26 Thread Taylor, Ryan
[AMD Official Use Only]

Given that amdgpu_vkms contains code from both dce_virtual and vkms should the 
identifier be changed to GPL-2.0+ OR MIT like in amdgpu_res_cursor.h?

Best,
Ryan

From: Alex Deucher 
Sent: Monday, July 26, 2021 9:21 AM
To: Chen, Guchun 
Cc: Taylor, Ryan ; kernel test robot ; 
Daniel Vetter ; Siqueira, Rodrigo 
; amd-gfx list ; 
Melissa Wen ; Maling list - DRI developers 

Subject: Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)

On Fri, Jul 23, 2021 at 10:07 PM Chen, Guchun  wrote:
>
> [Public]
>
> Look copy right statement is missed in both amdgpu_vkms.c and amdgpu_vkms.h.

It's there, it just uses the newer SPDX license identifier.

Alex


>
> Regards,
> Guchun
>
> -Original Message-
> From: amd-gfx  On Behalf Of Alex 
> Deucher
> Sent: Friday, July 23, 2021 10:32 PM
> To: Taylor, Ryan 
> Cc: kernel test robot ; Daniel Vetter 
> ; Siqueira, Rodrigo ; 
> amd-gfx list ; Melissa Wen 
> ; Maling list - DRI developers 
> 
> Subject: Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)
>
> On Wed, Jul 21, 2021 at 1:07 PM Ryan Taylor  wrote:
> >
> > Modify the VKMS driver into an api that dce_virtual can use to create
> > virtual displays that obey drm's atomic modesetting api.
> >
> > v2: Made local functions static.
> >
> > Reported-by: kernel test robot 
> > Signed-off-by: Ryan Taylor 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/Makefile  |   1 +
> >  drivers/gpu/drm/amd/amdgpu/amdgpu.h  |   1 +
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |   2 +-
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c   |   2 +-
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 411
> > +++  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h |
> > 29 ++  drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  23 +-
> >  7 files changed, 458 insertions(+), 11 deletions(-)  create mode
> > 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> >  create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile
> > b/drivers/gpu/drm/amd/amdgpu/Makefile
> > index f089794bbdd5..30cbcd5ce1cc 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/Makefile
> > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
> > @@ -120,6 +120,7 @@ amdgpu-y += \
> >  amdgpu-y += \
> > dce_v10_0.o \
> > dce_v11_0.o \
> > +   amdgpu_vkms.o \
> > dce_virtual.o
> >
> >  # add GFX block
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > index 54cf647bd018..d0a2f2ed433d 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > @@ -919,6 +919,7 @@ struct amdgpu_device {
> >
> > /* display */
> > boolenable_virtual_display;
> > +   struct amdgpu_vkms_output   *amdgpu_vkms_output;
> > 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_drv.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index d0c935cf4f0f..1b016e5bc75f 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -1230,7 +1230,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> > int ret, retry = 0;
> > bool supports_atomic = false;
> >
> > -   if (!amdgpu_virtual_display &&
> > +   if (amdgpu_virtual_display ||
> > amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
> > supports_atomic = true;
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > index 09b048647523..5a143ca02cf9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > @@ -344,7 +344,7 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev)
> > }
> >
> > /* disable all the possible outputs/crtcs before entering KMS mode 
> > */
> > -   if (!amdgpu_device_has_dc_support(adev))
> > +   if (!amdgpu_device_has_dc_support(adev) &&
> > + !amdgpu_virtual_display)
> >
> > drm_helper_disable_unused_functions(adev_to_drm(adev));
> >
> > drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); diff
> > --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> > b

Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)

2021-07-26 Thread Alex Deucher
On Mon, Jul 26, 2021 at 12:39 PM Taylor, Ryan  wrote:
>
> [AMD Official Use Only]
>
>
> Given that amdgpu_vkms contains code from both dce_virtual and vkms should 
> the identifier be changed to GPL-2.0+ OR MIT like in amdgpu_res_cursor.h?

Most of the code is from vkms so match vkms.

Alex


>
> Best,
> Ryan
> 
> From: Alex Deucher 
> Sent: Monday, July 26, 2021 9:21 AM
> To: Chen, Guchun 
> Cc: Taylor, Ryan ; kernel test robot ; 
> Daniel Vetter ; Siqueira, Rodrigo 
> ; amd-gfx list ; 
> Melissa Wen ; Maling list - DRI developers 
> 
> Subject: Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)
>
> On Fri, Jul 23, 2021 at 10:07 PM Chen, Guchun  wrote:
> >
> > [Public]
> >
> > Look copy right statement is missed in both amdgpu_vkms.c and amdgpu_vkms.h.
>
> It's there, it just uses the newer SPDX license identifier.
>
> Alex
>
>
> >
> > Regards,
> > Guchun
> >
> > -Original Message-
> > From: amd-gfx  On Behalf Of Alex 
> > Deucher
> > Sent: Friday, July 23, 2021 10:32 PM
> > To: Taylor, Ryan 
> > Cc: kernel test robot ; Daniel Vetter 
> > ; Siqueira, Rodrigo ; 
> > amd-gfx list ; Melissa Wen 
> > ; Maling list - DRI developers 
> > 
> > Subject: Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)
> >
> > On Wed, Jul 21, 2021 at 1:07 PM Ryan Taylor  wrote:
> > >
> > > Modify the VKMS driver into an api that dce_virtual can use to create
> > > virtual displays that obey drm's atomic modesetting api.
> > >
> > > v2: Made local functions static.
> > >
> > > Reported-by: kernel test robot 
> > > Signed-off-by: Ryan Taylor 
> > > ---
> > >  drivers/gpu/drm/amd/amdgpu/Makefile  |   1 +
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu.h  |   1 +
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |   2 +-
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c   |   2 +-
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 411
> > > +++  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h |
> > > 29 ++  drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  23 +-
> > >  7 files changed, 458 insertions(+), 11 deletions(-)  create mode
> > > 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> > >  create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile
> > > b/drivers/gpu/drm/amd/amdgpu/Makefile
> > > index f089794bbdd5..30cbcd5ce1cc 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/Makefile
> > > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
> > > @@ -120,6 +120,7 @@ amdgpu-y += \
> > >  amdgpu-y += \
> > > dce_v10_0.o \
> > > dce_v11_0.o \
> > > +   amdgpu_vkms.o \
> > > dce_virtual.o
> > >
> > >  # add GFX block
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > index 54cf647bd018..d0a2f2ed433d 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > @@ -919,6 +919,7 @@ struct amdgpu_device {
> > >
> > > /* display */
> > > boolenable_virtual_display;
> > > +   struct amdgpu_vkms_output   *amdgpu_vkms_output;
> > > 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_drv.c
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > > index d0c935cf4f0f..1b016e5bc75f 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > > @@ -1230,7 +1230,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> > > int ret, retry = 0;
> > > bool supports_atomic = false;
> > >
> > > -   if (!amdgpu_virtual_display &&
> > > +   if (amdgpu_virtual_display ||
> > > amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
> > > supports_atomic = true;
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > > index 09b048647523..5a143ca02cf9 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_f

Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)

2021-07-26 Thread Alex Deucher
On Fri, Jul 23, 2021 at 10:07 PM Chen, Guchun  wrote:
>
> [Public]
>
> Look copy right statement is missed in both amdgpu_vkms.c and amdgpu_vkms.h.

It's there, it just uses the newer SPDX license identifier.

Alex


>
> Regards,
> Guchun
>
> -Original Message-
> From: amd-gfx  On Behalf Of Alex 
> Deucher
> Sent: Friday, July 23, 2021 10:32 PM
> To: Taylor, Ryan 
> Cc: kernel test robot ; Daniel Vetter 
> ; Siqueira, Rodrigo ; 
> amd-gfx list ; Melissa Wen 
> ; Maling list - DRI developers 
> 
> Subject: Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)
>
> On Wed, Jul 21, 2021 at 1:07 PM Ryan Taylor  wrote:
> >
> > Modify the VKMS driver into an api that dce_virtual can use to create
> > virtual displays that obey drm's atomic modesetting api.
> >
> > v2: Made local functions static.
> >
> > Reported-by: kernel test robot 
> > Signed-off-by: Ryan Taylor 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/Makefile  |   1 +
> >  drivers/gpu/drm/amd/amdgpu/amdgpu.h  |   1 +
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |   2 +-
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c   |   2 +-
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 411
> > +++  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h |
> > 29 ++  drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  23 +-
> >  7 files changed, 458 insertions(+), 11 deletions(-)  create mode
> > 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> >  create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile
> > b/drivers/gpu/drm/amd/amdgpu/Makefile
> > index f089794bbdd5..30cbcd5ce1cc 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/Makefile
> > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
> > @@ -120,6 +120,7 @@ amdgpu-y += \
> >  amdgpu-y += \
> > dce_v10_0.o \
> > dce_v11_0.o \
> > +   amdgpu_vkms.o \
> > dce_virtual.o
> >
> >  # add GFX block
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > index 54cf647bd018..d0a2f2ed433d 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > @@ -919,6 +919,7 @@ struct amdgpu_device {
> >
> > /* display */
> > boolenable_virtual_display;
> > +   struct amdgpu_vkms_output   *amdgpu_vkms_output;
> > 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_drv.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index d0c935cf4f0f..1b016e5bc75f 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -1230,7 +1230,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> > int ret, retry = 0;
> > bool supports_atomic = false;
> >
> > -   if (!amdgpu_virtual_display &&
> > +   if (amdgpu_virtual_display ||
> > amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
> > supports_atomic = true;
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > index 09b048647523..5a143ca02cf9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> > @@ -344,7 +344,7 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev)
> > }
> >
> > /* disable all the possible outputs/crtcs before entering KMS mode 
> > */
> > -   if (!amdgpu_device_has_dc_support(adev))
> > +   if (!amdgpu_device_has_dc_support(adev) &&
> > + !amdgpu_virtual_display)
> >
> > drm_helper_disable_unused_functions(adev_to_drm(adev));
> >
> > drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); diff
> > --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> > new file mode 100644
> > index ..d5c1f1c58f5f
> > --- /dev/null
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> > @@ -0,0 +1,411 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +
> > +#include 
> > +#include  #include 
> > +
> > +#include "amdgpu.h"
> > +#include "amdgpu_vkms.h"
> > +#include "amdgpu_display.h"
&g

RE: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)

2021-07-23 Thread Chen, Guchun
[Public]

Look copy right statement is missed in both amdgpu_vkms.c and amdgpu_vkms.h.

Regards,
Guchun

-Original Message-
From: amd-gfx  On Behalf Of Alex Deucher
Sent: Friday, July 23, 2021 10:32 PM
To: Taylor, Ryan 
Cc: kernel test robot ; Daniel Vetter ; 
Siqueira, Rodrigo ; amd-gfx list 
; Melissa Wen ; Maling 
list - DRI developers 
Subject: Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)

On Wed, Jul 21, 2021 at 1:07 PM Ryan Taylor  wrote:
>
> Modify the VKMS driver into an api that dce_virtual can use to create 
> virtual displays that obey drm's atomic modesetting api.
>
> v2: Made local functions static.
>
> Reported-by: kernel test robot 
> Signed-off-by: Ryan Taylor 
> ---
>  drivers/gpu/drm/amd/amdgpu/Makefile  |   1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h  |   1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |   2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c   |   2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 411 
> +++  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h |  
> 29 ++  drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  23 +-
>  7 files changed, 458 insertions(+), 11 deletions(-)  create mode 
> 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
>  create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
> b/drivers/gpu/drm/amd/amdgpu/Makefile
> index f089794bbdd5..30cbcd5ce1cc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/Makefile
> +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
> @@ -120,6 +120,7 @@ amdgpu-y += \
>  amdgpu-y += \
> dce_v10_0.o \
> dce_v11_0.o \
> +   amdgpu_vkms.o \
> dce_virtual.o
>
>  # add GFX block
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 54cf647bd018..d0a2f2ed433d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -919,6 +919,7 @@ struct amdgpu_device {
>
> /* display */
> boolenable_virtual_display;
> +   struct amdgpu_vkms_output   *amdgpu_vkms_output;
> 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_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index d0c935cf4f0f..1b016e5bc75f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1230,7 +1230,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> int ret, retry = 0;
> bool supports_atomic = false;
>
> -   if (!amdgpu_virtual_display &&
> +   if (amdgpu_virtual_display ||
> amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
> supports_atomic = true;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> index 09b048647523..5a143ca02cf9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> @@ -344,7 +344,7 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev)
> }
>
> /* disable all the possible outputs/crtcs before entering KMS mode */
> -   if (!amdgpu_device_has_dc_support(adev))
> +   if (!amdgpu_device_has_dc_support(adev) && 
> + !amdgpu_virtual_display)
> 
> drm_helper_disable_unused_functions(adev_to_drm(adev));
>
> drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); diff 
> --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> new file mode 100644
> index ..d5c1f1c58f5f
> --- /dev/null
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> @@ -0,0 +1,411 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +#include 
> +#include  #include 
> +
> +#include "amdgpu.h"
> +#include "amdgpu_vkms.h"
> +#include "amdgpu_display.h"
> +
> +/**
> + * DOC: amdgpu_vkms
> + *
> + * The amdgpu vkms interface provides a virtual KMS interface for 
> +several use
> + * cases: devices without display hardware, platforms where the 
> +actual display
> + * hardware is not useful (e.g., servers), SR-IOV virtual functions, 
> +device
> + * emulation/simulation, and device bring up prior to display 
> +hardware being
> + * usable. We previously emulated a legacy KMS interface, but there 
> +was a desire
> + * to move to the atomic KMS interface. The vkms driver did 
> +everything we
> + * needed, but we wanted KMS support natively in the driver without 
> +buffer
&

Re: [PATCH 1/3] drm/amdgpu: create amdgpu_vkms (v2)

2021-07-23 Thread Alex Deucher
On Wed, Jul 21, 2021 at 1:07 PM Ryan Taylor  wrote:
>
> Modify the VKMS driver into an api that dce_virtual can use to create
> virtual displays that obey drm's atomic modesetting api.
>
> v2: Made local functions static.
>
> Reported-by: kernel test robot 
> Signed-off-by: Ryan Taylor 
> ---
>  drivers/gpu/drm/amd/amdgpu/Makefile  |   1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h  |   1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |   2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c   |   2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 411 +++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h |  29 ++
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  23 +-
>  7 files changed, 458 insertions(+), 11 deletions(-)
>  create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
>  create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.h
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
> b/drivers/gpu/drm/amd/amdgpu/Makefile
> index f089794bbdd5..30cbcd5ce1cc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/Makefile
> +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
> @@ -120,6 +120,7 @@ amdgpu-y += \
>  amdgpu-y += \
> dce_v10_0.o \
> dce_v11_0.o \
> +   amdgpu_vkms.o \
> dce_virtual.o
>
>  # add GFX block
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 54cf647bd018..d0a2f2ed433d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -919,6 +919,7 @@ struct amdgpu_device {
>
> /* display */
> boolenable_virtual_display;
> +   struct amdgpu_vkms_output   *amdgpu_vkms_output;
> 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_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index d0c935cf4f0f..1b016e5bc75f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1230,7 +1230,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> int ret, retry = 0;
> bool supports_atomic = false;
>
> -   if (!amdgpu_virtual_display &&
> +   if (amdgpu_virtual_display ||
> amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
> supports_atomic = true;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> index 09b048647523..5a143ca02cf9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> @@ -344,7 +344,7 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev)
> }
>
> /* disable all the possible outputs/crtcs before entering KMS mode */
> -   if (!amdgpu_device_has_dc_support(adev))
> +   if (!amdgpu_device_has_dc_support(adev) && !amdgpu_virtual_display)
> drm_helper_disable_unused_functions(adev_to_drm(adev));
>
> drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> new file mode 100644
> index ..d5c1f1c58f5f
> --- /dev/null
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
> @@ -0,0 +1,411 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +#include 
> +#include 
> +#include 
> +
> +#include "amdgpu.h"
> +#include "amdgpu_vkms.h"
> +#include "amdgpu_display.h"
> +
> +/**
> + * DOC: amdgpu_vkms
> + *
> + * The amdgpu vkms interface provides a virtual KMS interface for several use
> + * cases: devices without display hardware, platforms where the actual 
> display
> + * hardware is not useful (e.g., servers), SR-IOV virtual functions, device
> + * emulation/simulation, and device bring up prior to display hardware being
> + * usable. We previously emulated a legacy KMS interface, but there was a 
> desire
> + * to move to the atomic KMS interface. The vkms driver did everything we
> + * needed, but we wanted KMS support natively in the driver without buffer
> + * sharing and the ability to support an instance of VKMS per device. We 
> first
> + * looked at splitting vkms into a stub driver and a helper module that other
> + * drivers could use to implement a virtual display, but this strategy ended 
> up
> + * being messy due to driver specific callbacks needed for buffer management.
> + * Ultimately, it proved easier to import the vkms code as it mostly used 
> core
> + * drm helpers anyway.
> + */
> +
> +static const u32 amdgpu_vkms_formats[] = {
> +   DRM_FORMAT_XRGB,
> +};
> +
> +static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer 
> *timer)
> +{
> +   struct amdgpu_vkms_output *output = container_of(timer,
> +struct 
> amdgpu_vkms_output,
> +vblank_