RE: [PATCH 3/3] drm/amdgpu:Limit the resolution for virtual_display

2021-01-07 Thread Deng, Emily
[AMD Official Use Only - Internal Distribution Only]

>-Original Message-
>From: Michel Dänzer 
>Sent: Thursday, January 7, 2021 4:42 PM
>To: Deng, Emily ; Alex Deucher
>
>Cc: amd-gfx list 
>Subject: Re: [PATCH 3/3] drm/amdgpu:Limit the resolution for virtual_display
>
>On 2021-01-07 3:28 a.m., Deng, Emily wrote:
>>> From: Michel Dänzer  On 2021-01-06 11:40 a.m.,
>>> Deng, Emily wrote:
>>>>> From: Alex Deucher  On Tue, Jan 5, 2021 at
>>>>> 3:37 AM Emily.Deng  wrote:
>>>>>>
>>>>>> Limit the resolution not bigger than 16384, which means
>>>>>> dev->mode_info.num_crtc * common_modes[i].w not bigger than
>16384.
>>>>>>
>>>>>> Signed-off-by: Emily.Deng 
>>>>>> ---
>>>>>>drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 7 +--
>>>>>>1 file changed, 5 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>>>>>> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>>>>>> index 2b16c8faca34..c23d37b02fd7 100644
>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>>>>>> @@ -319,6 +319,7 @@ dce_virtual_encoder(struct drm_connector
>>>>>> *connector)  static int dce_virtual_get_modes(struct drm_connector
>>>>>> *connector)  {
>>>>>>   struct drm_device *dev = connector->dev;
>>>>>> +   struct amdgpu_device *adev = dev->dev_private;
>>>>>>   struct drm_display_mode *mode = NULL;
>>>>>>   unsigned i;
>>>>>>   static const struct mode_size { @@ -350,8 +351,10 @@
>>>>>> static int dce_virtual_get_modes(struct drm_connector *connector)
>>>>>>   };
>>>>>>
>>>>>>   for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
>>>>>> -   mode = drm_cvt_mode(dev, common_modes[i].w,
>>>>> common_modes[i].h, 60, false, false, false);
>>>>>> -   drm_mode_probed_add(connector, mode);
>>>>>> +   if (adev->mode_info.num_crtc <= 4 ||
>>>>>> + common_modes[i].w <= 2560) {
>>>>>
>>>>> You are also limiting the number of crtcs here.  Intended?  Won't
>>>>> this break 5 or 6 crtc configs?
>>>>>
>>>>> Alex
>>>> Yes, it is intended,  for num_crtc bigger then 4, don't support
>>>> resolution
>>> bigger then 2560, because of the max supported width is 16384 for xcb
>>> protocol.
>>>
>>> There's no such limitation with Wayland. I'd recommend against
>>> artificially imposing limits from X11 to the kernel.
>>>
>>>
>>> (As a side note, the X11 protocol limit should actually be 32768; the
>>> 16384 limit exposed in the RANDR extension comes from the kernel
>>> driver, specifically drmModeGetResources's max_width/height)
>> It is our test and debug result, that the follow variable only have 16bit. 
>> Will
>limit the resolution to 16384.
>> glamor_pixmap_from_fd(ScreenPtr screen,
>>int fd,
>>CARD16 width,
>>CARD16 height,
>>CARD16 stride, CARD8 depth, CARD8 bpp)
>
>I assume you're referring to the stride parameter, which is in bytes.
>
>This function is only used for pixmaps created from a dma-buf via DRI3.
>It does not limit the size of other pixmaps, so it does not limit the size of 
>the
>screen pixmap (which corresponds to the framebuffer size in the RANDR
>extension) in general.
>
>Also, this is an implementation detail, the limitation could be lifted by
>changing the type of the parameter (though that would be an ABI break for
>Xorg).
>
>Xwayland isn't affected by this:
>
>Screen 0: minimum 16 x 16, current 1920 x 1200, maximum 32767 x 32767
Yes, openGL driver will refer to the stride. As we have tried resolution bigger 
than 16384, the screen won't display well.
And seem no body has verified this. So we want to limit the max supported modes 
to not bigger than 16384.
>
>
>--
>Earthling Michel Dänzer   |
>https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fredha
>t.com%2Fdata=04%7C01%7CEmily.Deng%40amd.com%7C6279eb2390
>0b436337b408d8b2e82635%7C3dd8961fe4884e608e11a82d994e183d%7C0%
>7C0%7C637456057455424961%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
>wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000
>mp;sdata=u%2FuKB%2ByxJMzCr3nfU8rkFyjjI37gc%2BZ2rmHP9riZB5w%3D
>mp;reserved=0
>Libre software enthusiast | Mesa and X developer
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 3/3] drm/amdgpu:Limit the resolution for virtual_display

2021-01-07 Thread Michel Dänzer

On 2021-01-07 3:28 a.m., Deng, Emily wrote:

From: Michel Dänzer 
On 2021-01-06 11:40 a.m., Deng, Emily wrote:

From: Alex Deucher  On Tue, Jan 5, 2021 at
3:37 AM Emily.Deng  wrote:


Limit the resolution not bigger than 16384, which means
dev->mode_info.num_crtc * common_modes[i].w not bigger than 16384.

Signed-off-by: Emily.Deng 
---
   drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 7 +--
   1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index 2b16c8faca34..c23d37b02fd7 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -319,6 +319,7 @@ dce_virtual_encoder(struct drm_connector
*connector)  static int dce_virtual_get_modes(struct drm_connector
*connector)  {
  struct drm_device *dev = connector->dev;
+   struct amdgpu_device *adev = dev->dev_private;
  struct drm_display_mode *mode = NULL;
  unsigned i;
  static const struct mode_size { @@ -350,8 +351,10 @@ static
int dce_virtual_get_modes(struct drm_connector *connector)
  };

  for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
-   mode = drm_cvt_mode(dev, common_modes[i].w,

common_modes[i].h, 60, false, false, false);

-   drm_mode_probed_add(connector, mode);
+   if (adev->mode_info.num_crtc <= 4 ||
+ common_modes[i].w <= 2560) {


You are also limiting the number of crtcs here.  Intended?  Won't
this break 5 or 6 crtc configs?

Alex

Yes, it is intended,  for num_crtc bigger then 4, don't support resolution

bigger then 2560, because of the max supported width is 16384 for xcb
protocol.

There's no such limitation with Wayland. I'd recommend against artificially
imposing limits from X11 to the kernel.


(As a side note, the X11 protocol limit should actually be 32768; the
16384 limit exposed in the RANDR extension comes from the kernel driver,
specifically drmModeGetResources's max_width/height)

It is our test and debug result, that the follow variable only have 16bit. Will 
limit the resolution to 16384.
glamor_pixmap_from_fd(ScreenPtr screen,
   int fd,
   CARD16 width,
   CARD16 height,
   CARD16 stride, CARD8 depth, CARD8 bpp)


I assume you're referring to the stride parameter, which is in bytes.

This function is only used for pixmaps created from a dma-buf via DRI3. 
It does not limit the size of other pixmaps, so it does not limit the 
size of the screen pixmap (which corresponds to the framebuffer size in 
the RANDR extension) in general.


Also, this is an implementation detail, the limitation could be lifted 
by changing the type of the parameter (though that would be an ABI break 
for Xorg).


Xwayland isn't affected by this:

Screen 0: minimum 16 x 16, current 1920 x 1200, maximum 32767 x 32767


--
Earthling Michel Dänzer   |   https://redhat.com
Libre software enthusiast | Mesa and X developer
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 3/3] drm/amdgpu:Limit the resolution for virtual_display

2021-01-06 Thread Deng, Emily
[AMD Official Use Only - Internal Distribution Only]

>-Original Message-
>From: Michel Dänzer 
>Sent: Wednesday, January 6, 2021 11:25 PM
>To: Deng, Emily ; Alex Deucher
>
>Cc: amd-gfx list 
>Subject: Re: [PATCH 3/3] drm/amdgpu:Limit the resolution for virtual_display
>
>On 2021-01-06 11:40 a.m., Deng, Emily wrote:
>>> From: Alex Deucher  On Tue, Jan 5, 2021 at
>>> 3:37 AM Emily.Deng  wrote:
>>>>
>>>> Limit the resolution not bigger than 16384, which means
>>>> dev->mode_info.num_crtc * common_modes[i].w not bigger than 16384.
>>>>
>>>> Signed-off-by: Emily.Deng 
>>>> ---
>>>>   drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 7 +--
>>>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>>>> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>>>> index 2b16c8faca34..c23d37b02fd7 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>>>> @@ -319,6 +319,7 @@ dce_virtual_encoder(struct drm_connector
>>>> *connector)  static int dce_virtual_get_modes(struct drm_connector
>>>> *connector)  {
>>>>  struct drm_device *dev = connector->dev;
>>>> +   struct amdgpu_device *adev = dev->dev_private;
>>>>  struct drm_display_mode *mode = NULL;
>>>>  unsigned i;
>>>>  static const struct mode_size { @@ -350,8 +351,10 @@ static
>>>> int dce_virtual_get_modes(struct drm_connector *connector)
>>>>  };
>>>>
>>>>  for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
>>>> -   mode = drm_cvt_mode(dev, common_modes[i].w,
>>> common_modes[i].h, 60, false, false, false);
>>>> -   drm_mode_probed_add(connector, mode);
>>>> +   if (adev->mode_info.num_crtc <= 4 ||
>>>> + common_modes[i].w <= 2560) {
>>>
>>> You are also limiting the number of crtcs here.  Intended?  Won't
>>> this break 5 or 6 crtc configs?
>>>
>>> Alex
>> Yes, it is intended,  for num_crtc bigger then 4, don't support resolution
>bigger then 2560, because of the max supported width is 16384 for xcb
>protocol.
>
>There's no such limitation with Wayland. I'd recommend against artificially
>imposing limits from X11 to the kernel.
>
>
>(As a side note, the X11 protocol limit should actually be 32768; the
>16384 limit exposed in the RANDR extension comes from the kernel driver,
>specifically drmModeGetResources's max_width/height)
It is our test and debug result, that the follow variable only have 16bit. Will 
limit the resolution to 16384.
glamor_pixmap_from_fd(ScreenPtr screen,
  int fd,
  CARD16 width,
  CARD16 height,
  CARD16 stride, CARD8 depth, CARD8 bpp)
>
>
>--
>Earthling Michel Dänzer   |
>https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fredha
>t.com%2Fdata=04%7C01%7CEmily.Deng%40amd.com%7Ca822927192
>e54d50539c08d8b2574439%7C3dd8961fe4884e608e11a82d994e183d%7C0%
>7C0%7C637455435178758996%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
>wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000
>mp;sdata=5u7%2Bz2q52PTyPEg9LWcLGVGLERYupc%2B5nKJiIHZTTKw%3D
>mp;reserved=0
>Libre software enthusiast | Mesa and X developer
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 3/3] drm/amdgpu:Limit the resolution for virtual_display

2021-01-06 Thread Michel Dänzer

On 2021-01-06 11:40 a.m., Deng, Emily wrote:

From: Alex Deucher 
On Tue, Jan 5, 2021 at 3:37 AM Emily.Deng  wrote:


Limit the resolution not bigger than 16384, which means
dev->mode_info.num_crtc * common_modes[i].w not bigger than 16384.

Signed-off-by: Emily.Deng 
---
  drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 7 +--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index 2b16c8faca34..c23d37b02fd7 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -319,6 +319,7 @@ dce_virtual_encoder(struct drm_connector
*connector)  static int dce_virtual_get_modes(struct drm_connector
*connector)  {
 struct drm_device *dev = connector->dev;
+   struct amdgpu_device *adev = dev->dev_private;
 struct drm_display_mode *mode = NULL;
 unsigned i;
 static const struct mode_size { @@ -350,8 +351,10 @@ static
int dce_virtual_get_modes(struct drm_connector *connector)
 };

 for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
-   mode = drm_cvt_mode(dev, common_modes[i].w,

common_modes[i].h, 60, false, false, false);

-   drm_mode_probed_add(connector, mode);
+   if (adev->mode_info.num_crtc <= 4 ||
+ common_modes[i].w <= 2560) {


You are also limiting the number of crtcs here.  Intended?  Won't this break 5
or 6 crtc configs?

Alex

Yes, it is intended,  for num_crtc bigger then 4, don't support resolution 
bigger then 2560, because of the max supported width is 16384 for xcb protocol.


There's no such limitation with Wayland. I'd recommend against 
artificially imposing limits from X11 to the kernel.



(As a side note, the X11 protocol limit should actually be 32768; the 
16384 limit exposed in the RANDR extension comes from the kernel driver, 
specifically drmModeGetResources's max_width/height)



--
Earthling Michel Dänzer   |   https://redhat.com
Libre software enthusiast | Mesa and X developer
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 3/3] drm/amdgpu:Limit the resolution for virtual_display

2021-01-06 Thread Deng, Emily
[AMD Official Use Only - Internal Distribution Only]

>-Original Message-
>From: Alex Deucher 
>Sent: Wednesday, January 6, 2021 1:23 AM
>To: Deng, Emily 
>Cc: amd-gfx list 
>Subject: Re: [PATCH 3/3] drm/amdgpu:Limit the resolution for virtual_display
>
>On Tue, Jan 5, 2021 at 3:37 AM Emily.Deng  wrote:
>>
>> Limit the resolution not bigger than 16384, which means
>> dev->mode_info.num_crtc * common_modes[i].w not bigger than 16384.
>>
>> Signed-off-by: Emily.Deng 
>> ---
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 7 +--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index 2b16c8faca34..c23d37b02fd7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -319,6 +319,7 @@ dce_virtual_encoder(struct drm_connector
>> *connector)  static int dce_virtual_get_modes(struct drm_connector
>> *connector)  {
>> struct drm_device *dev = connector->dev;
>> +   struct amdgpu_device *adev = dev->dev_private;
>> struct drm_display_mode *mode = NULL;
>> unsigned i;
>> static const struct mode_size { @@ -350,8 +351,10 @@ static
>> int dce_virtual_get_modes(struct drm_connector *connector)
>> };
>>
>> for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
>> -   mode = drm_cvt_mode(dev, common_modes[i].w,
>common_modes[i].h, 60, false, false, false);
>> -   drm_mode_probed_add(connector, mode);
>> +   if (adev->mode_info.num_crtc <= 4 ||
>> + common_modes[i].w <= 2560) {
>
>You are also limiting the number of crtcs here.  Intended?  Won't this break 5
>or 6 crtc configs?
>
>Alex
Yes, it is intended,  for num_crtc bigger then 4, don't support resolution 
bigger then 2560, because of the max supported width is 16384 for xcb protocol.
>
>> +   mode = drm_cvt_mode(dev, common_modes[i].w,
>common_modes[i].h, 60, false, false, false);
>> +   drm_mode_probed_add(connector, mode);
>> +   }
>> }
>>
>> return 0;
>> --
>> 2.25.1
>>
>> ___
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
>> s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-
>gfxdata=04%7C01%7CEm
>>
>ily.Deng%40amd.com%7Ce17ab0515ecf483eff6a08d8b19ea565%7C3dd8961f
>e4884e
>>
>608e11a82d994e183d%7C0%7C0%7C637454642229402978%7CUnknown%7
>CTWFpbGZsb3
>>
>d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%
>3D%7
>>
>C1000sdata=YEVtCVJZ8JSe3kjyAGmjltHN1O4i4yvjvXjDZhWhZSY%3D
>mp;res
>> erved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 3/3] drm/amdgpu:Limit the resolution for virtual_display

2021-01-05 Thread Alex Deucher
On Tue, Jan 5, 2021 at 3:37 AM Emily.Deng  wrote:
>
> Limit the resolution not bigger than 16384, which means
> dev->mode_info.num_crtc * common_modes[i].w not bigger than 16384.
>
> Signed-off-by: Emily.Deng 
> ---
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 2b16c8faca34..c23d37b02fd7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -319,6 +319,7 @@ dce_virtual_encoder(struct drm_connector *connector)
>  static int dce_virtual_get_modes(struct drm_connector *connector)
>  {
> struct drm_device *dev = connector->dev;
> +   struct amdgpu_device *adev = dev->dev_private;
> struct drm_display_mode *mode = NULL;
> unsigned i;
> static const struct mode_size {
> @@ -350,8 +351,10 @@ static int dce_virtual_get_modes(struct drm_connector 
> *connector)
> };
>
> for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
> -   mode = drm_cvt_mode(dev, common_modes[i].w, 
> common_modes[i].h, 60, false, false, false);
> -   drm_mode_probed_add(connector, mode);
> +   if (adev->mode_info.num_crtc <= 4 ||  common_modes[i].w <= 
> 2560) {

You are also limiting the number of crtcs here.  Intended?  Won't this
break 5 or 6 crtc configs?

Alex

> +   mode = drm_cvt_mode(dev, common_modes[i].w, 
> common_modes[i].h, 60, false, false, false);
> +   drm_mode_probed_add(connector, mode);
> +   }
> }
>
> return 0;
> --
> 2.25.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