All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v3 0/3] Add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 10:17 ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
	Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Andy Shevchenko, Petr Mladek, Sakari Ailus, Lee Jones,
	Abhinav Kumar, Dmitry Baryshkov, Rob Clark, amd-gfx,
	linux-kernel, nouveau, Daniel Stone, Laurent Pinchart,
	Tomohito Esaki, Damian Hobson-Garcia, Takanari Hayama

Some drivers whose planes only support linear layout fb do not support format
modifiers.
These drivers should support modifiers, however the DRM core should handle this
rather than open-coding in every driver.

In this patch series, these drivers expose format modifiers based on the
following suggestion[1].

On Thu, Nov 18, 2021 at 01:02:11PM +0000, Daniel Stone wrote:
> I think the best way forward here is:
>   - add a new mode_config.cannot_support_modifiers flag, and enable
> this in radeon (plus any other drivers in the same boat)
>   - change drm_universal_plane_init() to advertise the LINEAR modifier
> when NULL is passed as the modifier list (including installing a
> default .format_mod_supported hook)
>   - remove the mode_config.allow_fb_modifiers hook and always
> advertise modifier support, unless
> mode_config.cannot_support_modifiers is set


[1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/20190509054518.10781-1-etom@igel.co.jp/#24602575

v3:
* change the order as follows:
   1. add fb_modifiers_not_supported flag
   2. add default modifiers
   3. remove allow_fb_modifiers flag
* add a conditional disable in amdgpu_dm_plane_init()

v2: https://www.spinics.net/lists/dri-devel/msg328939.html
* rebase to the latest master branch (5.16.0+) + "drm/plane: Make format_mod_supported truly optional" patch [2]
  [2] https://patchwork.freedesktop.org/patch/467940/?series=98255&rev=3

v1: https://www.spinics.net/lists/dri-devel/msg327352.html
* The initial patch set

Tomohito Esaki (3):
  drm: introduce fb_modifiers_not_supported flag in mode_config
  drm: add support modifiers for drivers whose planes only support
    linear layout
  drm: remove allow_fb_modifiers

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  6 ++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  2 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
 drivers/gpu/drm/drm_framebuffer.c             |  6 ++---
 drivers/gpu/drm/drm_ioctl.c                   |  2 +-
 drivers/gpu/drm/drm_plane.c                   | 22 +++++++++----------
 drivers/gpu/drm/nouveau/nouveau_display.c     |  6 +++--
 drivers/gpu/drm/radeon/radeon_display.c       |  2 ++
 .../gpu/drm/selftests/test-drm_framebuffer.c  |  1 -
 include/drm/drm_mode_config.h                 | 18 +++++----------
 include/drm/drm_plane.h                       |  3 +++
 14 files changed, 43 insertions(+), 33 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 0/3] Add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 10:17 ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Lee Jones,
	Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx, Ben Skeggs,
	Petr Mladek, Sakari Ailus, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Andy Shevchenko, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Alex Deucher, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

Some drivers whose planes only support linear layout fb do not support format
modifiers.
These drivers should support modifiers, however the DRM core should handle this
rather than open-coding in every driver.

In this patch series, these drivers expose format modifiers based on the
following suggestion[1].

On Thu, Nov 18, 2021 at 01:02:11PM +0000, Daniel Stone wrote:
> I think the best way forward here is:
>   - add a new mode_config.cannot_support_modifiers flag, and enable
> this in radeon (plus any other drivers in the same boat)
>   - change drm_universal_plane_init() to advertise the LINEAR modifier
> when NULL is passed as the modifier list (including installing a
> default .format_mod_supported hook)
>   - remove the mode_config.allow_fb_modifiers hook and always
> advertise modifier support, unless
> mode_config.cannot_support_modifiers is set


[1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/20190509054518.10781-1-etom@igel.co.jp/#24602575

v3:
* change the order as follows:
   1. add fb_modifiers_not_supported flag
   2. add default modifiers
   3. remove allow_fb_modifiers flag
* add a conditional disable in amdgpu_dm_plane_init()

v2: https://www.spinics.net/lists/dri-devel/msg328939.html
* rebase to the latest master branch (5.16.0+) + "drm/plane: Make format_mod_supported truly optional" patch [2]
  [2] https://patchwork.freedesktop.org/patch/467940/?series=98255&rev=3

v1: https://www.spinics.net/lists/dri-devel/msg327352.html
* The initial patch set

Tomohito Esaki (3):
  drm: introduce fb_modifiers_not_supported flag in mode_config
  drm: add support modifiers for drivers whose planes only support
    linear layout
  drm: remove allow_fb_modifiers

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  6 ++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  2 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
 drivers/gpu/drm/drm_framebuffer.c             |  6 ++---
 drivers/gpu/drm/drm_ioctl.c                   |  2 +-
 drivers/gpu/drm/drm_plane.c                   | 22 +++++++++----------
 drivers/gpu/drm/nouveau/nouveau_display.c     |  6 +++--
 drivers/gpu/drm/radeon/radeon_display.c       |  2 ++
 .../gpu/drm/selftests/test-drm_framebuffer.c  |  1 -
 include/drm/drm_mode_config.h                 | 18 +++++----------
 include/drm/drm_plane.h                       |  3 +++
 14 files changed, 43 insertions(+), 33 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 0/3] Add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 10:17 ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Daniel Stone,
	Lee Jones, Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Simon Ser, Alex Deucher,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

Some drivers whose planes only support linear layout fb do not support format
modifiers.
These drivers should support modifiers, however the DRM core should handle this
rather than open-coding in every driver.

In this patch series, these drivers expose format modifiers based on the
following suggestion[1].

On Thu, Nov 18, 2021 at 01:02:11PM +0000, Daniel Stone wrote:
> I think the best way forward here is:
>   - add a new mode_config.cannot_support_modifiers flag, and enable
> this in radeon (plus any other drivers in the same boat)
>   - change drm_universal_plane_init() to advertise the LINEAR modifier
> when NULL is passed as the modifier list (including installing a
> default .format_mod_supported hook)
>   - remove the mode_config.allow_fb_modifiers hook and always
> advertise modifier support, unless
> mode_config.cannot_support_modifiers is set


[1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/20190509054518.10781-1-etom@igel.co.jp/#24602575

v3:
* change the order as follows:
   1. add fb_modifiers_not_supported flag
   2. add default modifiers
   3. remove allow_fb_modifiers flag
* add a conditional disable in amdgpu_dm_plane_init()

v2: https://www.spinics.net/lists/dri-devel/msg328939.html
* rebase to the latest master branch (5.16.0+) + "drm/plane: Make format_mod_supported truly optional" patch [2]
  [2] https://patchwork.freedesktop.org/patch/467940/?series=98255&rev=3

v1: https://www.spinics.net/lists/dri-devel/msg327352.html
* The initial patch set

Tomohito Esaki (3):
  drm: introduce fb_modifiers_not_supported flag in mode_config
  drm: add support modifiers for drivers whose planes only support
    linear layout
  drm: remove allow_fb_modifiers

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  6 ++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  2 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
 drivers/gpu/drm/drm_framebuffer.c             |  6 ++---
 drivers/gpu/drm/drm_ioctl.c                   |  2 +-
 drivers/gpu/drm/drm_plane.c                   | 22 +++++++++----------
 drivers/gpu/drm/nouveau/nouveau_display.c     |  6 +++--
 drivers/gpu/drm/radeon/radeon_display.c       |  2 ++
 .../gpu/drm/selftests/test-drm_framebuffer.c  |  1 -
 include/drm/drm_mode_config.h                 | 18 +++++----------
 include/drm/drm_plane.h                       |  3 +++
 14 files changed, 43 insertions(+), 33 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 72+ messages in thread

* [Nouveau] [RFC PATCH v3 0/3] Add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 10:17 ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Daniel Stone,
	Lee Jones, Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Simon Ser, Alex Deucher, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

Some drivers whose planes only support linear layout fb do not support format
modifiers.
These drivers should support modifiers, however the DRM core should handle this
rather than open-coding in every driver.

In this patch series, these drivers expose format modifiers based on the
following suggestion[1].

On Thu, Nov 18, 2021 at 01:02:11PM +0000, Daniel Stone wrote:
> I think the best way forward here is:
>   - add a new mode_config.cannot_support_modifiers flag, and enable
> this in radeon (plus any other drivers in the same boat)
>   - change drm_universal_plane_init() to advertise the LINEAR modifier
> when NULL is passed as the modifier list (including installing a
> default .format_mod_supported hook)
>   - remove the mode_config.allow_fb_modifiers hook and always
> advertise modifier support, unless
> mode_config.cannot_support_modifiers is set


[1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/20190509054518.10781-1-etom@igel.co.jp/#24602575

v3:
* change the order as follows:
   1. add fb_modifiers_not_supported flag
   2. add default modifiers
   3. remove allow_fb_modifiers flag
* add a conditional disable in amdgpu_dm_plane_init()

v2: https://www.spinics.net/lists/dri-devel/msg328939.html
* rebase to the latest master branch (5.16.0+) + "drm/plane: Make format_mod_supported truly optional" patch [2]
  [2] https://patchwork.freedesktop.org/patch/467940/?series=98255&rev=3

v1: https://www.spinics.net/lists/dri-devel/msg327352.html
* The initial patch set

Tomohito Esaki (3):
  drm: introduce fb_modifiers_not_supported flag in mode_config
  drm: add support modifiers for drivers whose planes only support
    linear layout
  drm: remove allow_fb_modifiers

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  6 ++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  2 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
 drivers/gpu/drm/drm_framebuffer.c             |  6 ++---
 drivers/gpu/drm/drm_ioctl.c                   |  2 +-
 drivers/gpu/drm/drm_plane.c                   | 22 +++++++++----------
 drivers/gpu/drm/nouveau/nouveau_display.c     |  6 +++--
 drivers/gpu/drm/radeon/radeon_display.c       |  2 ++
 .../gpu/drm/selftests/test-drm_framebuffer.c  |  1 -
 include/drm/drm_mode_config.h                 | 18 +++++----------
 include/drm/drm_plane.h                       |  3 +++
 14 files changed, 43 insertions(+), 33 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
  2022-01-14 10:17 ` Tomohito Esaki
  (?)
  (?)
@ 2022-01-14 10:17   ` Tomohito Esaki
  -1 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
	Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Andy Shevchenko, Petr Mladek, Sakari Ailus, Lee Jones,
	Abhinav Kumar, Dmitry Baryshkov, Rob Clark, amd-gfx,
	linux-kernel, nouveau, Daniel Stone, Laurent Pinchart,
	Tomohito Esaki, Damian Hobson-Garcia, Takanari Hayama

If only linear modifier is advertised, since there are many drivers that
only linear supported, the DRM core should handle this rather than
open-coding in every driver. However, there are legacy drivers such as
radeon that do not support modifiers but infer the actual layout of the
underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
introduced for these legacy drivers, and allow_fb_modifiers is replaced
with this new flag.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
 drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
 drivers/gpu/drm/drm_ioctl.c                       |  2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
 drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
 include/drm/drm_mode_config.h                     | 10 ++++++++++
 11 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 82011e75ed85..edbb30d47b8c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
 	int ret;
 	unsigned int i, block_width, block_height, block_size_log2;
 
-	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
+	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
 		return 0;
 
 	for (i = 0; i < format_info->num_planes; ++i) {
@@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
 	if (ret)
 		return ret;
 
-	if (!dev->mode_config.allow_fb_modifiers) {
+	if (dev->mode_config.fb_modifiers_not_supported) {
 		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
 			      "GFX9+ requires FB check based on format modifier\n");
 		ret = check_tiling_flags_gfx6(rfb);
@@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
 			return ret;
 	}
 
-	if (dev->mode_config.allow_fb_modifiers &&
+	if (!dev->mode_config.fb_modifiers_not_supported &&
 	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
 		ret = convert_tiling_flags_to_modifier(rfb);
 		if (ret) {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index d1570a462a51..fb61c0814115 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 18a7b3bd633b..17942a11366d 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index c7803dc2b2d5..2ec99ec8e1a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.max_height = 16384;
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 8318ee8339f1..de11fbe5aba2 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 2f0b14f8f833..61cb41766fae 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 	if (res)
 		return res;
 
+	if (modifiers == NULL)
+		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
+
 	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
 				       &dm_plane_funcs, formats, num_formats,
 				       modifiers, plane->type, NULL);
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 07f5abc875e9..4562a8b86579 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
 	}
 
 	if (r->flags & DRM_MODE_FB_MODIFIERS &&
-	    !dev->mode_config.allow_fb_modifiers) {
+	    dev->mode_config.fb_modifiers_not_supported) {
 		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
 		return ERR_PTR(-EINVAL);
 	}
@@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
 	r->pixel_format = fb->format->format;
 
 	r->flags = 0;
-	if (dev->mode_config.allow_fb_modifiers)
+	if (!dev->mode_config.fb_modifiers_not_supported)
 		r->flags |= DRM_MODE_FB_MODIFIERS;
 
 	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
@@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
 	for (i = 0; i < fb->format->num_planes; i++) {
 		r->pitches[i] = fb->pitches[i];
 		r->offsets[i] = fb->offsets[i];
-		if (dev->mode_config.allow_fb_modifiers)
+		if (!dev->mode_config.fb_modifiers_not_supported)
 			r->modifier[i] = fb->modifier;
 	}
 
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8b8744dcf691..51fcf1298023 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 			req->value = 64;
 		break;
 	case DRM_CAP_ADDFB2_MODIFIERS:
-		req->value = dev->mode_config.allow_fb_modifiers;
+		req->value = !dev->mode_config.fb_modifiers_not_supported;
 		break;
 	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
 		req->value = 1;
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 2b460835a438..2cd0932b3d68 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
 				     &disp->disp);
 		if (ret == 0) {
 			nouveau_display_create_properties(dev);
-			if (disp->disp.object.oclass < NV50_DISP)
+			if (disp->disp.object.oclass < NV50_DISP) {
+				dev->mode_config.fb_modifiers_not_supported = true;
 				ret = nv04_display_create(dev);
-			else
+			} else {
 				ret = nv50_display_create(dev);
+			}
 		}
 	} else {
 		ret = 0;
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 573154268d43..b9a07677a71e 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
 	rdev->ddev->mode_config.preferred_depth = 24;
 	rdev->ddev->mode_config.prefer_shadow = 1;
 
+	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
+
 	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
 
 	ret = radeon_modeset_create_props(rdev);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 91ca575a78de..da82f45351c7 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -933,6 +933,16 @@ struct drm_mode_config {
 	 */
 	bool allow_fb_modifiers;
 
+	/**
+	 * @fb_modifiers_not_supported:
+	 *
+	 * This flag is for legacy drivers such as radeon that do not support
+	 * modifiers but infer the actual layout of the underlying buffer.
+	 * Generally, each drivers must support modifiers, this flag should not
+	 * be set.
+	 */
+	bool fb_modifiers_not_supported;
+
 	/**
 	 * @normalize_zpos:
 	 *
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-14 10:17   ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Lee Jones,
	Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx, Ben Skeggs,
	Petr Mladek, Sakari Ailus, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Andy Shevchenko, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Alex Deucher, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

If only linear modifier is advertised, since there are many drivers that
only linear supported, the DRM core should handle this rather than
open-coding in every driver. However, there are legacy drivers such as
radeon that do not support modifiers but infer the actual layout of the
underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
introduced for these legacy drivers, and allow_fb_modifiers is replaced
with this new flag.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
 drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
 drivers/gpu/drm/drm_ioctl.c                       |  2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
 drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
 include/drm/drm_mode_config.h                     | 10 ++++++++++
 11 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 82011e75ed85..edbb30d47b8c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
 	int ret;
 	unsigned int i, block_width, block_height, block_size_log2;
 
-	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
+	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
 		return 0;
 
 	for (i = 0; i < format_info->num_planes; ++i) {
@@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
 	if (ret)
 		return ret;
 
-	if (!dev->mode_config.allow_fb_modifiers) {
+	if (dev->mode_config.fb_modifiers_not_supported) {
 		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
 			      "GFX9+ requires FB check based on format modifier\n");
 		ret = check_tiling_flags_gfx6(rfb);
@@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
 			return ret;
 	}
 
-	if (dev->mode_config.allow_fb_modifiers &&
+	if (!dev->mode_config.fb_modifiers_not_supported &&
 	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
 		ret = convert_tiling_flags_to_modifier(rfb);
 		if (ret) {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index d1570a462a51..fb61c0814115 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 18a7b3bd633b..17942a11366d 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index c7803dc2b2d5..2ec99ec8e1a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.max_height = 16384;
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 8318ee8339f1..de11fbe5aba2 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 2f0b14f8f833..61cb41766fae 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 	if (res)
 		return res;
 
+	if (modifiers == NULL)
+		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
+
 	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
 				       &dm_plane_funcs, formats, num_formats,
 				       modifiers, plane->type, NULL);
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 07f5abc875e9..4562a8b86579 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
 	}
 
 	if (r->flags & DRM_MODE_FB_MODIFIERS &&
-	    !dev->mode_config.allow_fb_modifiers) {
+	    dev->mode_config.fb_modifiers_not_supported) {
 		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
 		return ERR_PTR(-EINVAL);
 	}
@@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
 	r->pixel_format = fb->format->format;
 
 	r->flags = 0;
-	if (dev->mode_config.allow_fb_modifiers)
+	if (!dev->mode_config.fb_modifiers_not_supported)
 		r->flags |= DRM_MODE_FB_MODIFIERS;
 
 	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
@@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
 	for (i = 0; i < fb->format->num_planes; i++) {
 		r->pitches[i] = fb->pitches[i];
 		r->offsets[i] = fb->offsets[i];
-		if (dev->mode_config.allow_fb_modifiers)
+		if (!dev->mode_config.fb_modifiers_not_supported)
 			r->modifier[i] = fb->modifier;
 	}
 
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8b8744dcf691..51fcf1298023 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 			req->value = 64;
 		break;
 	case DRM_CAP_ADDFB2_MODIFIERS:
-		req->value = dev->mode_config.allow_fb_modifiers;
+		req->value = !dev->mode_config.fb_modifiers_not_supported;
 		break;
 	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
 		req->value = 1;
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 2b460835a438..2cd0932b3d68 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
 				     &disp->disp);
 		if (ret == 0) {
 			nouveau_display_create_properties(dev);
-			if (disp->disp.object.oclass < NV50_DISP)
+			if (disp->disp.object.oclass < NV50_DISP) {
+				dev->mode_config.fb_modifiers_not_supported = true;
 				ret = nv04_display_create(dev);
-			else
+			} else {
 				ret = nv50_display_create(dev);
+			}
 		}
 	} else {
 		ret = 0;
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 573154268d43..b9a07677a71e 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
 	rdev->ddev->mode_config.preferred_depth = 24;
 	rdev->ddev->mode_config.prefer_shadow = 1;
 
+	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
+
 	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
 
 	ret = radeon_modeset_create_props(rdev);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 91ca575a78de..da82f45351c7 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -933,6 +933,16 @@ struct drm_mode_config {
 	 */
 	bool allow_fb_modifiers;
 
+	/**
+	 * @fb_modifiers_not_supported:
+	 *
+	 * This flag is for legacy drivers such as radeon that do not support
+	 * modifiers but infer the actual layout of the underlying buffer.
+	 * Generally, each drivers must support modifiers, this flag should not
+	 * be set.
+	 */
+	bool fb_modifiers_not_supported;
+
 	/**
 	 * @normalize_zpos:
 	 *
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-14 10:17   ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Daniel Stone,
	Lee Jones, Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Simon Ser, Alex Deucher,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

If only linear modifier is advertised, since there are many drivers that
only linear supported, the DRM core should handle this rather than
open-coding in every driver. However, there are legacy drivers such as
radeon that do not support modifiers but infer the actual layout of the
underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
introduced for these legacy drivers, and allow_fb_modifiers is replaced
with this new flag.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
 drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
 drivers/gpu/drm/drm_ioctl.c                       |  2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
 drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
 include/drm/drm_mode_config.h                     | 10 ++++++++++
 11 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 82011e75ed85..edbb30d47b8c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
 	int ret;
 	unsigned int i, block_width, block_height, block_size_log2;
 
-	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
+	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
 		return 0;
 
 	for (i = 0; i < format_info->num_planes; ++i) {
@@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
 	if (ret)
 		return ret;
 
-	if (!dev->mode_config.allow_fb_modifiers) {
+	if (dev->mode_config.fb_modifiers_not_supported) {
 		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
 			      "GFX9+ requires FB check based on format modifier\n");
 		ret = check_tiling_flags_gfx6(rfb);
@@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
 			return ret;
 	}
 
-	if (dev->mode_config.allow_fb_modifiers &&
+	if (!dev->mode_config.fb_modifiers_not_supported &&
 	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
 		ret = convert_tiling_flags_to_modifier(rfb);
 		if (ret) {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index d1570a462a51..fb61c0814115 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 18a7b3bd633b..17942a11366d 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index c7803dc2b2d5..2ec99ec8e1a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.max_height = 16384;
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 8318ee8339f1..de11fbe5aba2 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 2f0b14f8f833..61cb41766fae 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 	if (res)
 		return res;
 
+	if (modifiers == NULL)
+		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
+
 	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
 				       &dm_plane_funcs, formats, num_formats,
 				       modifiers, plane->type, NULL);
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 07f5abc875e9..4562a8b86579 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
 	}
 
 	if (r->flags & DRM_MODE_FB_MODIFIERS &&
-	    !dev->mode_config.allow_fb_modifiers) {
+	    dev->mode_config.fb_modifiers_not_supported) {
 		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
 		return ERR_PTR(-EINVAL);
 	}
@@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
 	r->pixel_format = fb->format->format;
 
 	r->flags = 0;
-	if (dev->mode_config.allow_fb_modifiers)
+	if (!dev->mode_config.fb_modifiers_not_supported)
 		r->flags |= DRM_MODE_FB_MODIFIERS;
 
 	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
@@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
 	for (i = 0; i < fb->format->num_planes; i++) {
 		r->pitches[i] = fb->pitches[i];
 		r->offsets[i] = fb->offsets[i];
-		if (dev->mode_config.allow_fb_modifiers)
+		if (!dev->mode_config.fb_modifiers_not_supported)
 			r->modifier[i] = fb->modifier;
 	}
 
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8b8744dcf691..51fcf1298023 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 			req->value = 64;
 		break;
 	case DRM_CAP_ADDFB2_MODIFIERS:
-		req->value = dev->mode_config.allow_fb_modifiers;
+		req->value = !dev->mode_config.fb_modifiers_not_supported;
 		break;
 	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
 		req->value = 1;
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 2b460835a438..2cd0932b3d68 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
 				     &disp->disp);
 		if (ret == 0) {
 			nouveau_display_create_properties(dev);
-			if (disp->disp.object.oclass < NV50_DISP)
+			if (disp->disp.object.oclass < NV50_DISP) {
+				dev->mode_config.fb_modifiers_not_supported = true;
 				ret = nv04_display_create(dev);
-			else
+			} else {
 				ret = nv50_display_create(dev);
+			}
 		}
 	} else {
 		ret = 0;
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 573154268d43..b9a07677a71e 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
 	rdev->ddev->mode_config.preferred_depth = 24;
 	rdev->ddev->mode_config.prefer_shadow = 1;
 
+	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
+
 	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
 
 	ret = radeon_modeset_create_props(rdev);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 91ca575a78de..da82f45351c7 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -933,6 +933,16 @@ struct drm_mode_config {
 	 */
 	bool allow_fb_modifiers;
 
+	/**
+	 * @fb_modifiers_not_supported:
+	 *
+	 * This flag is for legacy drivers such as radeon that do not support
+	 * modifiers but infer the actual layout of the underlying buffer.
+	 * Generally, each drivers must support modifiers, this flag should not
+	 * be set.
+	 */
+	bool fb_modifiers_not_supported;
+
 	/**
 	 * @normalize_zpos:
 	 *
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Nouveau] [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-14 10:17   ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Daniel Stone,
	Lee Jones, Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Simon Ser, Alex Deucher, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

If only linear modifier is advertised, since there are many drivers that
only linear supported, the DRM core should handle this rather than
open-coding in every driver. However, there are legacy drivers such as
radeon that do not support modifiers but infer the actual layout of the
underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
introduced for these legacy drivers, and allow_fb_modifiers is replaced
with this new flag.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
 drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
 drivers/gpu/drm/drm_ioctl.c                       |  2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
 drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
 include/drm/drm_mode_config.h                     | 10 ++++++++++
 11 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 82011e75ed85..edbb30d47b8c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
 	int ret;
 	unsigned int i, block_width, block_height, block_size_log2;
 
-	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
+	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
 		return 0;
 
 	for (i = 0; i < format_info->num_planes; ++i) {
@@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
 	if (ret)
 		return ret;
 
-	if (!dev->mode_config.allow_fb_modifiers) {
+	if (dev->mode_config.fb_modifiers_not_supported) {
 		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
 			      "GFX9+ requires FB check based on format modifier\n");
 		ret = check_tiling_flags_gfx6(rfb);
@@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
 			return ret;
 	}
 
-	if (dev->mode_config.allow_fb_modifiers &&
+	if (!dev->mode_config.fb_modifiers_not_supported &&
 	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
 		ret = convert_tiling_flags_to_modifier(rfb);
 		if (ret) {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index d1570a462a51..fb61c0814115 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 18a7b3bd633b..17942a11366d 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index c7803dc2b2d5..2ec99ec8e1a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.max_height = 16384;
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 8318ee8339f1..de11fbe5aba2 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
 	adev_to_drm(adev)->mode_config.preferred_depth = 24;
 	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
+	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
+
 	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
 	r = amdgpu_display_modeset_create_props(adev);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 2f0b14f8f833..61cb41766fae 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 	if (res)
 		return res;
 
+	if (modifiers == NULL)
+		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
+
 	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
 				       &dm_plane_funcs, formats, num_formats,
 				       modifiers, plane->type, NULL);
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 07f5abc875e9..4562a8b86579 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
 	}
 
 	if (r->flags & DRM_MODE_FB_MODIFIERS &&
-	    !dev->mode_config.allow_fb_modifiers) {
+	    dev->mode_config.fb_modifiers_not_supported) {
 		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
 		return ERR_PTR(-EINVAL);
 	}
@@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
 	r->pixel_format = fb->format->format;
 
 	r->flags = 0;
-	if (dev->mode_config.allow_fb_modifiers)
+	if (!dev->mode_config.fb_modifiers_not_supported)
 		r->flags |= DRM_MODE_FB_MODIFIERS;
 
 	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
@@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
 	for (i = 0; i < fb->format->num_planes; i++) {
 		r->pitches[i] = fb->pitches[i];
 		r->offsets[i] = fb->offsets[i];
-		if (dev->mode_config.allow_fb_modifiers)
+		if (!dev->mode_config.fb_modifiers_not_supported)
 			r->modifier[i] = fb->modifier;
 	}
 
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8b8744dcf691..51fcf1298023 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 			req->value = 64;
 		break;
 	case DRM_CAP_ADDFB2_MODIFIERS:
-		req->value = dev->mode_config.allow_fb_modifiers;
+		req->value = !dev->mode_config.fb_modifiers_not_supported;
 		break;
 	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
 		req->value = 1;
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 2b460835a438..2cd0932b3d68 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
 				     &disp->disp);
 		if (ret == 0) {
 			nouveau_display_create_properties(dev);
-			if (disp->disp.object.oclass < NV50_DISP)
+			if (disp->disp.object.oclass < NV50_DISP) {
+				dev->mode_config.fb_modifiers_not_supported = true;
 				ret = nv04_display_create(dev);
-			else
+			} else {
 				ret = nv50_display_create(dev);
+			}
 		}
 	} else {
 		ret = 0;
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 573154268d43..b9a07677a71e 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
 	rdev->ddev->mode_config.preferred_depth = 24;
 	rdev->ddev->mode_config.prefer_shadow = 1;
 
+	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
+
 	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
 
 	ret = radeon_modeset_create_props(rdev);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 91ca575a78de..da82f45351c7 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -933,6 +933,16 @@ struct drm_mode_config {
 	 */
 	bool allow_fb_modifiers;
 
+	/**
+	 * @fb_modifiers_not_supported:
+	 *
+	 * This flag is for legacy drivers such as radeon that do not support
+	 * modifiers but infer the actual layout of the underlying buffer.
+	 * Generally, each drivers must support modifiers, this flag should not
+	 * be set.
+	 */
+	bool fb_modifiers_not_supported;
+
 	/**
 	 * @normalize_zpos:
 	 *
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-14 10:17 ` Tomohito Esaki
  (?)
  (?)
@ 2022-01-14 10:17   ` Tomohito Esaki
  -1 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
	Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Andy Shevchenko, Petr Mladek, Sakari Ailus, Lee Jones,
	Abhinav Kumar, Dmitry Baryshkov, Rob Clark, amd-gfx,
	linux-kernel, nouveau, Daniel Stone, Laurent Pinchart,
	Tomohito Esaki, Damian Hobson-Garcia, Takanari Hayama

The LINEAR modifier is advertised as default if a driver doesn't specify
modifiers.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/drm_plane.c | 15 ++++++++++++---
 include/drm/drm_plane.h     |  3 +++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index deeec60a3315..5aa7e241971e 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -237,6 +237,10 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 				      const char *name, va_list ap)
 {
 	struct drm_mode_config *config = &dev->mode_config;
+	const uint64_t default_modifiers[] = {
+		DRM_FORMAT_MOD_LINEAR,
+		DRM_FORMAT_MOD_INVALID
+	};
 	unsigned int format_modifier_count = 0;
 	int ret;
 
@@ -277,6 +281,11 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 
 		while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
 			format_modifier_count++;
+	} else {
+		if (!dev->mode_config.fb_modifiers_not_supported) {
+			format_modifiers = default_modifiers;
+			format_modifier_count = 1;
+		}
 	}
 
 	/* autoset the cap and check for consistency across all planes */
@@ -341,7 +350,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		drm_object_attach_property(&plane->base, config->prop_src_h, 0);
 	}
 
-	if (config->allow_fb_modifiers)
+	if (format_modifier_count)
 		create_in_format_blob(dev, plane);
 
 	return 0;
@@ -368,8 +377,8 @@ static int __drm_universal_plane_init(struct drm_device *dev,
  * drm_universal_plane_init() to let the DRM managed resource infrastructure
  * take care of cleanup and deallocation.
  *
- * Drivers supporting modifiers must set @format_modifiers on all their planes,
- * even those that only support DRM_FORMAT_MOD_LINEAR.
+ * For drivers supporting modifiers, all planes will advertise
+ * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.
  *
  * Returns:
  * Zero on success, error code on failure.
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 0c1102dc4d88..cad641b1f797 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -803,6 +803,9 @@ void *__drmm_universal_plane_alloc(struct drm_device *dev,
  *
  * The @drm_plane_funcs.destroy hook must be NULL.
  *
+ * For drivers supporting modifiers, all planes will advertise
+ * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.
+ *
  * Returns:
  * Pointer to new plane, or ERR_PTR on failure.
  */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 10:17   ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Lee Jones,
	Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx, Ben Skeggs,
	Petr Mladek, Sakari Ailus, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Andy Shevchenko, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Alex Deucher, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

The LINEAR modifier is advertised as default if a driver doesn't specify
modifiers.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/drm_plane.c | 15 ++++++++++++---
 include/drm/drm_plane.h     |  3 +++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index deeec60a3315..5aa7e241971e 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -237,6 +237,10 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 				      const char *name, va_list ap)
 {
 	struct drm_mode_config *config = &dev->mode_config;
+	const uint64_t default_modifiers[] = {
+		DRM_FORMAT_MOD_LINEAR,
+		DRM_FORMAT_MOD_INVALID
+	};
 	unsigned int format_modifier_count = 0;
 	int ret;
 
@@ -277,6 +281,11 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 
 		while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
 			format_modifier_count++;
+	} else {
+		if (!dev->mode_config.fb_modifiers_not_supported) {
+			format_modifiers = default_modifiers;
+			format_modifier_count = 1;
+		}
 	}
 
 	/* autoset the cap and check for consistency across all planes */
@@ -341,7 +350,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		drm_object_attach_property(&plane->base, config->prop_src_h, 0);
 	}
 
-	if (config->allow_fb_modifiers)
+	if (format_modifier_count)
 		create_in_format_blob(dev, plane);
 
 	return 0;
@@ -368,8 +377,8 @@ static int __drm_universal_plane_init(struct drm_device *dev,
  * drm_universal_plane_init() to let the DRM managed resource infrastructure
  * take care of cleanup and deallocation.
  *
- * Drivers supporting modifiers must set @format_modifiers on all their planes,
- * even those that only support DRM_FORMAT_MOD_LINEAR.
+ * For drivers supporting modifiers, all planes will advertise
+ * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.
  *
  * Returns:
  * Zero on success, error code on failure.
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 0c1102dc4d88..cad641b1f797 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -803,6 +803,9 @@ void *__drmm_universal_plane_alloc(struct drm_device *dev,
  *
  * The @drm_plane_funcs.destroy hook must be NULL.
  *
+ * For drivers supporting modifiers, all planes will advertise
+ * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.
+ *
  * Returns:
  * Pointer to new plane, or ERR_PTR on failure.
  */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 10:17   ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Daniel Stone,
	Lee Jones, Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Simon Ser, Alex Deucher,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

The LINEAR modifier is advertised as default if a driver doesn't specify
modifiers.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/drm_plane.c | 15 ++++++++++++---
 include/drm/drm_plane.h     |  3 +++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index deeec60a3315..5aa7e241971e 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -237,6 +237,10 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 				      const char *name, va_list ap)
 {
 	struct drm_mode_config *config = &dev->mode_config;
+	const uint64_t default_modifiers[] = {
+		DRM_FORMAT_MOD_LINEAR,
+		DRM_FORMAT_MOD_INVALID
+	};
 	unsigned int format_modifier_count = 0;
 	int ret;
 
@@ -277,6 +281,11 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 
 		while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
 			format_modifier_count++;
+	} else {
+		if (!dev->mode_config.fb_modifiers_not_supported) {
+			format_modifiers = default_modifiers;
+			format_modifier_count = 1;
+		}
 	}
 
 	/* autoset the cap and check for consistency across all planes */
@@ -341,7 +350,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		drm_object_attach_property(&plane->base, config->prop_src_h, 0);
 	}
 
-	if (config->allow_fb_modifiers)
+	if (format_modifier_count)
 		create_in_format_blob(dev, plane);
 
 	return 0;
@@ -368,8 +377,8 @@ static int __drm_universal_plane_init(struct drm_device *dev,
  * drm_universal_plane_init() to let the DRM managed resource infrastructure
  * take care of cleanup and deallocation.
  *
- * Drivers supporting modifiers must set @format_modifiers on all their planes,
- * even those that only support DRM_FORMAT_MOD_LINEAR.
+ * For drivers supporting modifiers, all planes will advertise
+ * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.
  *
  * Returns:
  * Zero on success, error code on failure.
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 0c1102dc4d88..cad641b1f797 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -803,6 +803,9 @@ void *__drmm_universal_plane_alloc(struct drm_device *dev,
  *
  * The @drm_plane_funcs.destroy hook must be NULL.
  *
+ * For drivers supporting modifiers, all planes will advertise
+ * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.
+ *
  * Returns:
  * Pointer to new plane, or ERR_PTR on failure.
  */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 10:17   ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Daniel Stone,
	Lee Jones, Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Simon Ser, Alex Deucher, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

The LINEAR modifier is advertised as default if a driver doesn't specify
modifiers.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/drm_plane.c | 15 ++++++++++++---
 include/drm/drm_plane.h     |  3 +++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index deeec60a3315..5aa7e241971e 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -237,6 +237,10 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 				      const char *name, va_list ap)
 {
 	struct drm_mode_config *config = &dev->mode_config;
+	const uint64_t default_modifiers[] = {
+		DRM_FORMAT_MOD_LINEAR,
+		DRM_FORMAT_MOD_INVALID
+	};
 	unsigned int format_modifier_count = 0;
 	int ret;
 
@@ -277,6 +281,11 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 
 		while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
 			format_modifier_count++;
+	} else {
+		if (!dev->mode_config.fb_modifiers_not_supported) {
+			format_modifiers = default_modifiers;
+			format_modifier_count = 1;
+		}
 	}
 
 	/* autoset the cap and check for consistency across all planes */
@@ -341,7 +350,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		drm_object_attach_property(&plane->base, config->prop_src_h, 0);
 	}
 
-	if (config->allow_fb_modifiers)
+	if (format_modifier_count)
 		create_in_format_blob(dev, plane);
 
 	return 0;
@@ -368,8 +377,8 @@ static int __drm_universal_plane_init(struct drm_device *dev,
  * drm_universal_plane_init() to let the DRM managed resource infrastructure
  * take care of cleanup and deallocation.
  *
- * Drivers supporting modifiers must set @format_modifiers on all their planes,
- * even those that only support DRM_FORMAT_MOD_LINEAR.
+ * For drivers supporting modifiers, all planes will advertise
+ * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.
  *
  * Returns:
  * Zero on success, error code on failure.
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 0c1102dc4d88..cad641b1f797 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -803,6 +803,9 @@ void *__drmm_universal_plane_alloc(struct drm_device *dev,
  *
  * The @drm_plane_funcs.destroy hook must be NULL.
  *
+ * For drivers supporting modifiers, all planes will advertise
+ * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.
+ *
  * Returns:
  * Pointer to new plane, or ERR_PTR on failure.
  */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers
  2022-01-14 10:17 ` Tomohito Esaki
  (?)
  (?)
@ 2022-01-14 10:17   ` Tomohito Esaki
  -1 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
	Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Andy Shevchenko, Petr Mladek, Sakari Ailus, Lee Jones,
	Abhinav Kumar, Dmitry Baryshkov, Rob Clark, amd-gfx,
	linux-kernel, nouveau, Daniel Stone, Laurent Pinchart,
	Tomohito Esaki, Damian Hobson-Garcia, Takanari Hayama

The allow_fb_modifiers flag is unnecessary since it has been replaced
with cannot_support_modifiers flag.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/drm_plane.c                      |  9 ---------
 drivers/gpu/drm/selftests/test-drm_framebuffer.c |  1 -
 include/drm/drm_mode_config.h                    | 16 ----------------
 3 files changed, 26 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 5aa7e241971e..89a3d044ab59 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -288,15 +288,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		}
 	}
 
-	/* autoset the cap and check for consistency across all planes */
-	if (format_modifier_count) {
-		drm_WARN_ON(dev, !config->allow_fb_modifiers &&
-			    !list_empty(&config->plane_list));
-		config->allow_fb_modifiers = true;
-	} else {
-		drm_WARN_ON(dev, config->allow_fb_modifiers);
-	}
-
 	plane->modifier_count = format_modifier_count;
 	plane->modifiers = kmalloc_array(format_modifier_count,
 					 sizeof(format_modifiers[0]),
diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
index 61b44d3a6a61..f6d66285c5fc 100644
--- a/drivers/gpu/drm/selftests/test-drm_framebuffer.c
+++ b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
@@ -323,7 +323,6 @@ static struct drm_device mock_drm_device = {
 		.max_width = MAX_WIDTH,
 		.min_height = MIN_HEIGHT,
 		.max_height = MAX_HEIGHT,
-		.allow_fb_modifiers = true,
 		.funcs = &mock_config_funcs,
 	},
 };
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index da82f45351c7..5001bda9f9af 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -917,22 +917,6 @@ struct drm_mode_config {
 	 */
 	bool async_page_flip;
 
-	/**
-	 * @allow_fb_modifiers:
-	 *
-	 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call.
-	 * Note that drivers should not set this directly, it is automatically
-	 * set in drm_universal_plane_init().
-	 *
-	 * IMPORTANT:
-	 *
-	 * If this is set the driver must fill out the full implicit modifier
-	 * information in their &drm_mode_config_funcs.fb_create hook for legacy
-	 * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is
-	 * broken for modifier aware userspace.
-	 */
-	bool allow_fb_modifiers;
-
 	/**
 	 * @fb_modifiers_not_supported:
 	 *
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers
@ 2022-01-14 10:17   ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Lee Jones,
	Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx, Ben Skeggs,
	Petr Mladek, Sakari Ailus, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Andy Shevchenko, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Alex Deucher, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

The allow_fb_modifiers flag is unnecessary since it has been replaced
with cannot_support_modifiers flag.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/drm_plane.c                      |  9 ---------
 drivers/gpu/drm/selftests/test-drm_framebuffer.c |  1 -
 include/drm/drm_mode_config.h                    | 16 ----------------
 3 files changed, 26 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 5aa7e241971e..89a3d044ab59 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -288,15 +288,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		}
 	}
 
-	/* autoset the cap and check for consistency across all planes */
-	if (format_modifier_count) {
-		drm_WARN_ON(dev, !config->allow_fb_modifiers &&
-			    !list_empty(&config->plane_list));
-		config->allow_fb_modifiers = true;
-	} else {
-		drm_WARN_ON(dev, config->allow_fb_modifiers);
-	}
-
 	plane->modifier_count = format_modifier_count;
 	plane->modifiers = kmalloc_array(format_modifier_count,
 					 sizeof(format_modifiers[0]),
diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
index 61b44d3a6a61..f6d66285c5fc 100644
--- a/drivers/gpu/drm/selftests/test-drm_framebuffer.c
+++ b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
@@ -323,7 +323,6 @@ static struct drm_device mock_drm_device = {
 		.max_width = MAX_WIDTH,
 		.min_height = MIN_HEIGHT,
 		.max_height = MAX_HEIGHT,
-		.allow_fb_modifiers = true,
 		.funcs = &mock_config_funcs,
 	},
 };
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index da82f45351c7..5001bda9f9af 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -917,22 +917,6 @@ struct drm_mode_config {
 	 */
 	bool async_page_flip;
 
-	/**
-	 * @allow_fb_modifiers:
-	 *
-	 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call.
-	 * Note that drivers should not set this directly, it is automatically
-	 * set in drm_universal_plane_init().
-	 *
-	 * IMPORTANT:
-	 *
-	 * If this is set the driver must fill out the full implicit modifier
-	 * information in their &drm_mode_config_funcs.fb_create hook for legacy
-	 * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is
-	 * broken for modifier aware userspace.
-	 */
-	bool allow_fb_modifiers;
-
 	/**
 	 * @fb_modifiers_not_supported:
 	 *
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers
@ 2022-01-14 10:17   ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Daniel Stone,
	Lee Jones, Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Simon Ser, Alex Deucher,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

The allow_fb_modifiers flag is unnecessary since it has been replaced
with cannot_support_modifiers flag.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/drm_plane.c                      |  9 ---------
 drivers/gpu/drm/selftests/test-drm_framebuffer.c |  1 -
 include/drm/drm_mode_config.h                    | 16 ----------------
 3 files changed, 26 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 5aa7e241971e..89a3d044ab59 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -288,15 +288,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		}
 	}
 
-	/* autoset the cap and check for consistency across all planes */
-	if (format_modifier_count) {
-		drm_WARN_ON(dev, !config->allow_fb_modifiers &&
-			    !list_empty(&config->plane_list));
-		config->allow_fb_modifiers = true;
-	} else {
-		drm_WARN_ON(dev, config->allow_fb_modifiers);
-	}
-
 	plane->modifier_count = format_modifier_count;
 	plane->modifiers = kmalloc_array(format_modifier_count,
 					 sizeof(format_modifiers[0]),
diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
index 61b44d3a6a61..f6d66285c5fc 100644
--- a/drivers/gpu/drm/selftests/test-drm_framebuffer.c
+++ b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
@@ -323,7 +323,6 @@ static struct drm_device mock_drm_device = {
 		.max_width = MAX_WIDTH,
 		.min_height = MIN_HEIGHT,
 		.max_height = MAX_HEIGHT,
-		.allow_fb_modifiers = true,
 		.funcs = &mock_config_funcs,
 	},
 };
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index da82f45351c7..5001bda9f9af 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -917,22 +917,6 @@ struct drm_mode_config {
 	 */
 	bool async_page_flip;
 
-	/**
-	 * @allow_fb_modifiers:
-	 *
-	 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call.
-	 * Note that drivers should not set this directly, it is automatically
-	 * set in drm_universal_plane_init().
-	 *
-	 * IMPORTANT:
-	 *
-	 * If this is set the driver must fill out the full implicit modifier
-	 * information in their &drm_mode_config_funcs.fb_create hook for legacy
-	 * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is
-	 * broken for modifier aware userspace.
-	 */
-	bool allow_fb_modifiers;
-
 	/**
 	 * @fb_modifiers_not_supported:
 	 *
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* [Nouveau] [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers
@ 2022-01-14 10:17   ` Tomohito Esaki
  0 siblings, 0 replies; 72+ messages in thread
From: Tomohito Esaki @ 2022-01-14 10:17 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Daniel Stone,
	Lee Jones, Tomohito Esaki, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Simon Ser, Alex Deucher, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

The allow_fb_modifiers flag is unnecessary since it has been replaced
with cannot_support_modifiers flag.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
---
 drivers/gpu/drm/drm_plane.c                      |  9 ---------
 drivers/gpu/drm/selftests/test-drm_framebuffer.c |  1 -
 include/drm/drm_mode_config.h                    | 16 ----------------
 3 files changed, 26 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 5aa7e241971e..89a3d044ab59 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -288,15 +288,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		}
 	}
 
-	/* autoset the cap and check for consistency across all planes */
-	if (format_modifier_count) {
-		drm_WARN_ON(dev, !config->allow_fb_modifiers &&
-			    !list_empty(&config->plane_list));
-		config->allow_fb_modifiers = true;
-	} else {
-		drm_WARN_ON(dev, config->allow_fb_modifiers);
-	}
-
 	plane->modifier_count = format_modifier_count;
 	plane->modifiers = kmalloc_array(format_modifier_count,
 					 sizeof(format_modifiers[0]),
diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
index 61b44d3a6a61..f6d66285c5fc 100644
--- a/drivers/gpu/drm/selftests/test-drm_framebuffer.c
+++ b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
@@ -323,7 +323,6 @@ static struct drm_device mock_drm_device = {
 		.max_width = MAX_WIDTH,
 		.min_height = MIN_HEIGHT,
 		.max_height = MAX_HEIGHT,
-		.allow_fb_modifiers = true,
 		.funcs = &mock_config_funcs,
 	},
 };
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index da82f45351c7..5001bda9f9af 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -917,22 +917,6 @@ struct drm_mode_config {
 	 */
 	bool async_page_flip;
 
-	/**
-	 * @allow_fb_modifiers:
-	 *
-	 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call.
-	 * Note that drivers should not set this directly, it is automatically
-	 * set in drm_universal_plane_init().
-	 *
-	 * IMPORTANT:
-	 *
-	 * If this is set the driver must fill out the full implicit modifier
-	 * information in their &drm_mode_config_funcs.fb_create hook for legacy
-	 * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is
-	 * broken for modifier aware userspace.
-	 */
-	bool allow_fb_modifiers;
-
 	/**
 	 * @fb_modifiers_not_supported:
 	 *
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-14 10:17   ` Tomohito Esaki
  (?)
  (?)
@ 2022-01-14 14:16     ` Andy Shevchenko
  -1 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 14:16 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: dri-devel, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Petr Mladek, Sakari Ailus, Lee Jones, Abhinav Kumar,
	Dmitry Baryshkov, Rob Clark, amd-gfx, linux-kernel, nouveau,
	Daniel Stone, Laurent Pinchart, Damian Hobson-Garcia,
	Takanari Hayama

On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> The LINEAR modifier is advertised as default if a driver doesn't specify
> modifiers.

...

> +	const uint64_t default_modifiers[] = {
> +		DRM_FORMAT_MOD_LINEAR,
> +		DRM_FORMAT_MOD_INVALID

+ Comma?

> +	};

Why not enum?


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 14:16     ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 14:16 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Simon Ser,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> The LINEAR modifier is advertised as default if a driver doesn't specify
> modifiers.

...

> +	const uint64_t default_modifiers[] = {
> +		DRM_FORMAT_MOD_LINEAR,
> +		DRM_FORMAT_MOD_INVALID

+ Comma?

> +	};

Why not enum?


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 14:16     ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 14:16 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Rob Clark, Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Alex Deucher, Sean Paul, Evan Quan,
	Mark Yacoub, Qingqing Zhuo, Pan, Xinhui, linux-kernel,
	Thomas Zimmermann, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> The LINEAR modifier is advertised as default if a driver doesn't specify
> modifiers.

...

> +	const uint64_t default_modifiers[] = {
> +		DRM_FORMAT_MOD_LINEAR,
> +		DRM_FORMAT_MOD_INVALID

+ Comma?

> +	};

Why not enum?


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 14:16     ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 14:16 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Simon Ser, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> The LINEAR modifier is advertised as default if a driver doesn't specify
> modifiers.

...

> +	const uint64_t default_modifiers[] = {
> +		DRM_FORMAT_MOD_LINEAR,
> +		DRM_FORMAT_MOD_INVALID

+ Comma?

> +	};

Why not enum?


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
  2022-01-14 10:17   ` Tomohito Esaki
  (?)
  (?)
@ 2022-01-14 14:43     ` Harry Wentland
  -1 siblings, 0 replies; 72+ messages in thread
From: Harry Wentland @ 2022-01-14 14:43 UTC (permalink / raw)
  To: Tomohito Esaki, dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, Daniel Stone,
	Lee Jones, Rob Clark, Evan Quan, amd-gfx, Ben Skeggs,
	Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen, Maarten Lankhorst,
	Abhinav Kumar, Dmitry Baryshkov, Takanari Hayama, Sean Paul,
	Maxime Ripard, Daniel Vetter, Andy Shevchenko, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Simon Ser, Alex Deucher, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On 2022-01-14 05:17, Tomohito Esaki wrote:
> If only linear modifier is advertised, since there are many drivers that
> only linear supported, the DRM core should handle this rather than
> open-coding in every driver. However, there are legacy drivers such as
> radeon that do not support modifiers but infer the actual layout of the
> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
> introduced for these legacy drivers, and allow_fb_modifiers is replaced
> with this new flag.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>

Acked-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>  drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>  drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>  drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>  include/drm/drm_mode_config.h                     | 10 ++++++++++
>  11 files changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 82011e75ed85..edbb30d47b8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>  	int ret;
>  	unsigned int i, block_width, block_height, block_size_log2;
>  
> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>  		return 0;
>  
>  	for (i = 0; i < format_info->num_planes; ++i) {
> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> -	if (!dev->mode_config.allow_fb_modifiers) {
> +	if (dev->mode_config.fb_modifiers_not_supported) {
>  		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>  			      "GFX9+ requires FB check based on format modifier\n");
>  		ret = check_tiling_flags_gfx6(rfb);
> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  			return ret;
>  	}
>  
> -	if (dev->mode_config.allow_fb_modifiers &&
> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>  	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>  		ret = convert_tiling_flags_to_modifier(rfb);
>  		if (ret) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index d1570a462a51..fb61c0814115 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 18a7b3bd633b..17942a11366d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index c7803dc2b2d5..2ec99ec8e1a3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.max_height = 16384;
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 8318ee8339f1..de11fbe5aba2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 2f0b14f8f833..61cb41766fae 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  	if (res)
>  		return res;
>  
> +	if (modifiers == NULL)
> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>  				       &dm_plane_funcs, formats, num_formats,
>  				       modifiers, plane->type, NULL);
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 07f5abc875e9..4562a8b86579 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>  	}
>  
>  	if (r->flags & DRM_MODE_FB_MODIFIERS &&
> -	    !dev->mode_config.allow_fb_modifiers) {
> +	    dev->mode_config.fb_modifiers_not_supported) {
>  		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	r->pixel_format = fb->format->format;
>  
>  	r->flags = 0;
> -	if (dev->mode_config.allow_fb_modifiers)
> +	if (!dev->mode_config.fb_modifiers_not_supported)
>  		r->flags |= DRM_MODE_FB_MODIFIERS;
>  
>  	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	for (i = 0; i < fb->format->num_planes; i++) {
>  		r->pitches[i] = fb->pitches[i];
>  		r->offsets[i] = fb->offsets[i];
> -		if (dev->mode_config.allow_fb_modifiers)
> +		if (!dev->mode_config.fb_modifiers_not_supported)
>  			r->modifier[i] = fb->modifier;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8b8744dcf691..51fcf1298023 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  			req->value = 64;
>  		break;
>  	case DRM_CAP_ADDFB2_MODIFIERS:
> -		req->value = dev->mode_config.allow_fb_modifiers;
> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>  		break;
>  	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>  		req->value = 1;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 2b460835a438..2cd0932b3d68 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>  				     &disp->disp);
>  		if (ret == 0) {
>  			nouveau_display_create_properties(dev);
> -			if (disp->disp.object.oclass < NV50_DISP)
> +			if (disp->disp.object.oclass < NV50_DISP) {
> +				dev->mode_config.fb_modifiers_not_supported = true;
>  				ret = nv04_display_create(dev);
> -			else
> +			} else {
>  				ret = nv50_display_create(dev);
> +			}
>  		}
>  	} else {
>  		ret = 0;
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 573154268d43..b9a07677a71e 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>  	rdev->ddev->mode_config.preferred_depth = 24;
>  	rdev->ddev->mode_config.prefer_shadow = 1;
>  
> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
> +
>  	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>  
>  	ret = radeon_modeset_create_props(rdev);
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 91ca575a78de..da82f45351c7 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -933,6 +933,16 @@ struct drm_mode_config {
>  	 */
>  	bool allow_fb_modifiers;
>  
> +	/**
> +	 * @fb_modifiers_not_supported:
> +	 *
> +	 * This flag is for legacy drivers such as radeon that do not support
> +	 * modifiers but infer the actual layout of the underlying buffer.
> +	 * Generally, each drivers must support modifiers, this flag should not
> +	 * be set.
> +	 */
> +	bool fb_modifiers_not_supported;
> +
>  	/**
>  	 * @normalize_zpos:
>  	 *


^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-14 14:43     ` Harry Wentland
  0 siblings, 0 replies; 72+ messages in thread
From: Harry Wentland @ 2022-01-14 14:43 UTC (permalink / raw)
  To: Tomohito Esaki, dri-devel
  Cc: Simon Ser, David Airlie, nouveau, Michel Dänzer, amd-gfx,
	Lee Jones, Rob Clark, Takanari Hayama, Daniel Stone, Ben Skeggs,
	Evan Quan, Petr Mladek, Sakari Ailus, Maarten Lankhorst,
	Abhinav Kumar, Alex Deucher, Sean Paul, Maxime Ripard,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Daniel Vetter, Bas Nieuwenhuizen, Dmitry Baryshkov,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

On 2022-01-14 05:17, Tomohito Esaki wrote:
> If only linear modifier is advertised, since there are many drivers that
> only linear supported, the DRM core should handle this rather than
> open-coding in every driver. However, there are legacy drivers such as
> radeon that do not support modifiers but infer the actual layout of the
> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
> introduced for these legacy drivers, and allow_fb_modifiers is replaced
> with this new flag.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>

Acked-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>  drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>  drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>  drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>  include/drm/drm_mode_config.h                     | 10 ++++++++++
>  11 files changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 82011e75ed85..edbb30d47b8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>  	int ret;
>  	unsigned int i, block_width, block_height, block_size_log2;
>  
> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>  		return 0;
>  
>  	for (i = 0; i < format_info->num_planes; ++i) {
> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> -	if (!dev->mode_config.allow_fb_modifiers) {
> +	if (dev->mode_config.fb_modifiers_not_supported) {
>  		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>  			      "GFX9+ requires FB check based on format modifier\n");
>  		ret = check_tiling_flags_gfx6(rfb);
> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  			return ret;
>  	}
>  
> -	if (dev->mode_config.allow_fb_modifiers &&
> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>  	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>  		ret = convert_tiling_flags_to_modifier(rfb);
>  		if (ret) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index d1570a462a51..fb61c0814115 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 18a7b3bd633b..17942a11366d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index c7803dc2b2d5..2ec99ec8e1a3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.max_height = 16384;
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 8318ee8339f1..de11fbe5aba2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 2f0b14f8f833..61cb41766fae 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  	if (res)
>  		return res;
>  
> +	if (modifiers == NULL)
> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>  				       &dm_plane_funcs, formats, num_formats,
>  				       modifiers, plane->type, NULL);
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 07f5abc875e9..4562a8b86579 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>  	}
>  
>  	if (r->flags & DRM_MODE_FB_MODIFIERS &&
> -	    !dev->mode_config.allow_fb_modifiers) {
> +	    dev->mode_config.fb_modifiers_not_supported) {
>  		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	r->pixel_format = fb->format->format;
>  
>  	r->flags = 0;
> -	if (dev->mode_config.allow_fb_modifiers)
> +	if (!dev->mode_config.fb_modifiers_not_supported)
>  		r->flags |= DRM_MODE_FB_MODIFIERS;
>  
>  	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	for (i = 0; i < fb->format->num_planes; i++) {
>  		r->pitches[i] = fb->pitches[i];
>  		r->offsets[i] = fb->offsets[i];
> -		if (dev->mode_config.allow_fb_modifiers)
> +		if (!dev->mode_config.fb_modifiers_not_supported)
>  			r->modifier[i] = fb->modifier;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8b8744dcf691..51fcf1298023 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  			req->value = 64;
>  		break;
>  	case DRM_CAP_ADDFB2_MODIFIERS:
> -		req->value = dev->mode_config.allow_fb_modifiers;
> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>  		break;
>  	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>  		req->value = 1;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 2b460835a438..2cd0932b3d68 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>  				     &disp->disp);
>  		if (ret == 0) {
>  			nouveau_display_create_properties(dev);
> -			if (disp->disp.object.oclass < NV50_DISP)
> +			if (disp->disp.object.oclass < NV50_DISP) {
> +				dev->mode_config.fb_modifiers_not_supported = true;
>  				ret = nv04_display_create(dev);
> -			else
> +			} else {
>  				ret = nv50_display_create(dev);
> +			}
>  		}
>  	} else {
>  		ret = 0;
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 573154268d43..b9a07677a71e 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>  	rdev->ddev->mode_config.preferred_depth = 24;
>  	rdev->ddev->mode_config.prefer_shadow = 1;
>  
> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
> +
>  	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>  
>  	ret = radeon_modeset_create_props(rdev);
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 91ca575a78de..da82f45351c7 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -933,6 +933,16 @@ struct drm_mode_config {
>  	 */
>  	bool allow_fb_modifiers;
>  
> +	/**
> +	 * @fb_modifiers_not_supported:
> +	 *
> +	 * This flag is for legacy drivers such as radeon that do not support
> +	 * modifiers but infer the actual layout of the underlying buffer.
> +	 * Generally, each drivers must support modifiers, this flag should not
> +	 * be set.
> +	 */
> +	bool fb_modifiers_not_supported;
> +
>  	/**
>  	 * @normalize_zpos:
>  	 *


^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-14 14:43     ` Harry Wentland
  0 siblings, 0 replies; 72+ messages in thread
From: Harry Wentland @ 2022-01-14 14:43 UTC (permalink / raw)
  To: Tomohito Esaki, dri-devel
  Cc: David Airlie, nouveau, Michel Dänzer, amd-gfx, Lee Jones,
	Rob Clark, Takanari Hayama, Ben Skeggs, Evan Quan, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Alex Deucher, Sean Paul,
	Andy Shevchenko, Thomas Zimmermann, Mark Yacoub, Qingqing Zhuo,
	Pan, Xinhui, linux-kernel, Dmitry Baryshkov,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

On 2022-01-14 05:17, Tomohito Esaki wrote:
> If only linear modifier is advertised, since there are many drivers that
> only linear supported, the DRM core should handle this rather than
> open-coding in every driver. However, there are legacy drivers such as
> radeon that do not support modifiers but infer the actual layout of the
> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
> introduced for these legacy drivers, and allow_fb_modifiers is replaced
> with this new flag.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>

Acked-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>  drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>  drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>  drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>  include/drm/drm_mode_config.h                     | 10 ++++++++++
>  11 files changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 82011e75ed85..edbb30d47b8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>  	int ret;
>  	unsigned int i, block_width, block_height, block_size_log2;
>  
> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>  		return 0;
>  
>  	for (i = 0; i < format_info->num_planes; ++i) {
> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> -	if (!dev->mode_config.allow_fb_modifiers) {
> +	if (dev->mode_config.fb_modifiers_not_supported) {
>  		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>  			      "GFX9+ requires FB check based on format modifier\n");
>  		ret = check_tiling_flags_gfx6(rfb);
> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  			return ret;
>  	}
>  
> -	if (dev->mode_config.allow_fb_modifiers &&
> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>  	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>  		ret = convert_tiling_flags_to_modifier(rfb);
>  		if (ret) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index d1570a462a51..fb61c0814115 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 18a7b3bd633b..17942a11366d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index c7803dc2b2d5..2ec99ec8e1a3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.max_height = 16384;
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 8318ee8339f1..de11fbe5aba2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 2f0b14f8f833..61cb41766fae 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  	if (res)
>  		return res;
>  
> +	if (modifiers == NULL)
> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>  				       &dm_plane_funcs, formats, num_formats,
>  				       modifiers, plane->type, NULL);
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 07f5abc875e9..4562a8b86579 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>  	}
>  
>  	if (r->flags & DRM_MODE_FB_MODIFIERS &&
> -	    !dev->mode_config.allow_fb_modifiers) {
> +	    dev->mode_config.fb_modifiers_not_supported) {
>  		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	r->pixel_format = fb->format->format;
>  
>  	r->flags = 0;
> -	if (dev->mode_config.allow_fb_modifiers)
> +	if (!dev->mode_config.fb_modifiers_not_supported)
>  		r->flags |= DRM_MODE_FB_MODIFIERS;
>  
>  	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	for (i = 0; i < fb->format->num_planes; i++) {
>  		r->pitches[i] = fb->pitches[i];
>  		r->offsets[i] = fb->offsets[i];
> -		if (dev->mode_config.allow_fb_modifiers)
> +		if (!dev->mode_config.fb_modifiers_not_supported)
>  			r->modifier[i] = fb->modifier;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8b8744dcf691..51fcf1298023 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  			req->value = 64;
>  		break;
>  	case DRM_CAP_ADDFB2_MODIFIERS:
> -		req->value = dev->mode_config.allow_fb_modifiers;
> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>  		break;
>  	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>  		req->value = 1;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 2b460835a438..2cd0932b3d68 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>  				     &disp->disp);
>  		if (ret == 0) {
>  			nouveau_display_create_properties(dev);
> -			if (disp->disp.object.oclass < NV50_DISP)
> +			if (disp->disp.object.oclass < NV50_DISP) {
> +				dev->mode_config.fb_modifiers_not_supported = true;
>  				ret = nv04_display_create(dev);
> -			else
> +			} else {
>  				ret = nv50_display_create(dev);
> +			}
>  		}
>  	} else {
>  		ret = 0;
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 573154268d43..b9a07677a71e 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>  	rdev->ddev->mode_config.preferred_depth = 24;
>  	rdev->ddev->mode_config.prefer_shadow = 1;
>  
> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
> +
>  	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>  
>  	ret = radeon_modeset_create_props(rdev);
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 91ca575a78de..da82f45351c7 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -933,6 +933,16 @@ struct drm_mode_config {
>  	 */
>  	bool allow_fb_modifiers;
>  
> +	/**
> +	 * @fb_modifiers_not_supported:
> +	 *
> +	 * This flag is for legacy drivers such as radeon that do not support
> +	 * modifiers but infer the actual layout of the underlying buffer.
> +	 * Generally, each drivers must support modifiers, this flag should not
> +	 * be set.
> +	 */
> +	bool fb_modifiers_not_supported;
> +
>  	/**
>  	 * @normalize_zpos:
>  	 *


^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-14 14:43     ` Harry Wentland
  0 siblings, 0 replies; 72+ messages in thread
From: Harry Wentland @ 2022-01-14 14:43 UTC (permalink / raw)
  To: Tomohito Esaki, dri-devel
  Cc: Simon Ser, David Airlie, nouveau, Michel Dänzer, amd-gfx,
	Lee Jones, Rob Clark, Takanari Hayama, Daniel Stone, Ben Skeggs,
	Evan Quan, Petr Mladek, Sakari Ailus, Maarten Lankhorst,
	Abhinav Kumar, Alex Deucher, Sean Paul, Maxime Ripard,
	Andy Shevchenko, Thomas Zimmermann, Mark Yacoub, Qingqing Zhuo,
	Pan, Xinhui, linux-kernel, Daniel Vetter, Bas Nieuwenhuizen,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

On 2022-01-14 05:17, Tomohito Esaki wrote:
> If only linear modifier is advertised, since there are many drivers that
> only linear supported, the DRM core should handle this rather than
> open-coding in every driver. However, there are legacy drivers such as
> radeon that do not support modifiers but infer the actual layout of the
> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
> introduced for these legacy drivers, and allow_fb_modifiers is replaced
> with this new flag.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>

Acked-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>  drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>  drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>  drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>  include/drm/drm_mode_config.h                     | 10 ++++++++++
>  11 files changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 82011e75ed85..edbb30d47b8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>  	int ret;
>  	unsigned int i, block_width, block_height, block_size_log2;
>  
> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>  		return 0;
>  
>  	for (i = 0; i < format_info->num_planes; ++i) {
> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> -	if (!dev->mode_config.allow_fb_modifiers) {
> +	if (dev->mode_config.fb_modifiers_not_supported) {
>  		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>  			      "GFX9+ requires FB check based on format modifier\n");
>  		ret = check_tiling_flags_gfx6(rfb);
> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  			return ret;
>  	}
>  
> -	if (dev->mode_config.allow_fb_modifiers &&
> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>  	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>  		ret = convert_tiling_flags_to_modifier(rfb);
>  		if (ret) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index d1570a462a51..fb61c0814115 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 18a7b3bd633b..17942a11366d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index c7803dc2b2d5..2ec99ec8e1a3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.max_height = 16384;
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 8318ee8339f1..de11fbe5aba2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 2f0b14f8f833..61cb41766fae 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  	if (res)
>  		return res;
>  
> +	if (modifiers == NULL)
> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>  				       &dm_plane_funcs, formats, num_formats,
>  				       modifiers, plane->type, NULL);
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 07f5abc875e9..4562a8b86579 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>  	}
>  
>  	if (r->flags & DRM_MODE_FB_MODIFIERS &&
> -	    !dev->mode_config.allow_fb_modifiers) {
> +	    dev->mode_config.fb_modifiers_not_supported) {
>  		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	r->pixel_format = fb->format->format;
>  
>  	r->flags = 0;
> -	if (dev->mode_config.allow_fb_modifiers)
> +	if (!dev->mode_config.fb_modifiers_not_supported)
>  		r->flags |= DRM_MODE_FB_MODIFIERS;
>  
>  	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	for (i = 0; i < fb->format->num_planes; i++) {
>  		r->pitches[i] = fb->pitches[i];
>  		r->offsets[i] = fb->offsets[i];
> -		if (dev->mode_config.allow_fb_modifiers)
> +		if (!dev->mode_config.fb_modifiers_not_supported)
>  			r->modifier[i] = fb->modifier;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8b8744dcf691..51fcf1298023 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  			req->value = 64;
>  		break;
>  	case DRM_CAP_ADDFB2_MODIFIERS:
> -		req->value = dev->mode_config.allow_fb_modifiers;
> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>  		break;
>  	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>  		req->value = 1;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 2b460835a438..2cd0932b3d68 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>  				     &disp->disp);
>  		if (ret == 0) {
>  			nouveau_display_create_properties(dev);
> -			if (disp->disp.object.oclass < NV50_DISP)
> +			if (disp->disp.object.oclass < NV50_DISP) {
> +				dev->mode_config.fb_modifiers_not_supported = true;
>  				ret = nv04_display_create(dev);
> -			else
> +			} else {
>  				ret = nv50_display_create(dev);
> +			}
>  		}
>  	} else {
>  		ret = 0;
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 573154268d43..b9a07677a71e 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>  	rdev->ddev->mode_config.preferred_depth = 24;
>  	rdev->ddev->mode_config.prefer_shadow = 1;
>  
> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
> +
>  	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>  
>  	ret = radeon_modeset_create_props(rdev);
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 91ca575a78de..da82f45351c7 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -933,6 +933,16 @@ struct drm_mode_config {
>  	 */
>  	bool allow_fb_modifiers;
>  
> +	/**
> +	 * @fb_modifiers_not_supported:
> +	 *
> +	 * This flag is for legacy drivers such as radeon that do not support
> +	 * modifiers but infer the actual layout of the underlying buffer.
> +	 * Generally, each drivers must support modifiers, this flag should not
> +	 * be set.
> +	 */
> +	bool fb_modifiers_not_supported;
> +
>  	/**
>  	 * @normalize_zpos:
>  	 *


^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-14 14:16     ` [Nouveau] " Andy Shevchenko
  (?)
  (?)
@ 2022-01-14 15:07       ` Simon Ser
  -1 siblings, 0 replies; 72+ messages in thread
From: Simon Ser @ 2022-01-14 15:07 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Tomohito Esaki, dri-devel, Alex Deucher, Christian König,
	Pan, Xinhui, David Airlie, Daniel Vetter, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Ben Skeggs, Michel Dänzer,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Petr Mladek, Sakari Ailus, Lee Jones, Abhinav Kumar,
	Dmitry Baryshkov, Rob Clark, amd-gfx, linux-kernel, nouveau,
	Daniel Stone, Laurent Pinchart, Damian Hobson-Garcia,
	Takanari Hayama

On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Why not enum?

There is no enum for DRM format modifiers.

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 15:07       ` Simon Ser
  0 siblings, 0 replies; 72+ messages in thread
From: Simon Ser @ 2022-01-14 15:07 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Tomohito Esaki, Rob Clark,
	Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek, Sakari Ailus,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Bas Nieuwenhuizen,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Why not enum?

There is no enum for DRM format modifiers.

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 15:07       ` Simon Ser
  0 siblings, 0 replies; 72+ messages in thread
From: Simon Ser @ 2022-01-14 15:07 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Tomohito Esaki, Rob Clark, Takanari Hayama, amd-gfx, Ben Skeggs,
	Petr Mladek, Sakari Ailus, Abhinav Kumar, Alex Deucher,
	Sean Paul, Evan Quan, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Dmitry Baryshkov,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Why not enum?

There is no enum for DRM format modifiers.

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 15:07       ` Simon Ser
  0 siblings, 0 replies; 72+ messages in thread
From: Simon Ser @ 2022-01-14 15:07 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Tomohito Esaki, Rob Clark,
	Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek, Sakari Ailus,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Bas Nieuwenhuizen, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Why not enum?

There is no enum for DRM format modifiers.

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-14 15:07       ` [Nouveau] " Simon Ser
  (?)
  (?)
@ 2022-01-14 15:17         ` Andy Shevchenko
  -1 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 15:17 UTC (permalink / raw)
  To: Simon Ser
  Cc: Tomohito Esaki, dri-devel, Alex Deucher, Christian König,
	Pan, Xinhui, David Airlie, Daniel Vetter, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Ben Skeggs, Michel Dänzer,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Petr Mladek, Sakari Ailus, Lee Jones, Abhinav Kumar,
	Dmitry Baryshkov, Rob Clark, amd-gfx, linux-kernel, nouveau,
	Daniel Stone, Laurent Pinchart, Damian Hobson-Garcia,
	Takanari Hayama

On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Why not enum?
> 
> There is no enum for DRM format modifiers.

I'm not sure how this prevents to use enum in the code instead of const u64.
Any specific reason for that?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 15:17         ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 15:17 UTC (permalink / raw)
  To: Simon Ser
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Tomohito Esaki, Rob Clark,
	Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek, Sakari Ailus,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Bas Nieuwenhuizen,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Why not enum?
> 
> There is no enum for DRM format modifiers.

I'm not sure how this prevents to use enum in the code instead of const u64.
Any specific reason for that?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 15:17         ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 15:17 UTC (permalink / raw)
  To: Simon Ser
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Tomohito Esaki, Rob Clark, Takanari Hayama, amd-gfx, Ben Skeggs,
	Petr Mladek, Sakari Ailus, Abhinav Kumar, Alex Deucher,
	Sean Paul, Evan Quan, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Dmitry Baryshkov,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Why not enum?
> 
> There is no enum for DRM format modifiers.

I'm not sure how this prevents to use enum in the code instead of const u64.
Any specific reason for that?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 15:17         ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 15:17 UTC (permalink / raw)
  To: Simon Ser
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Tomohito Esaki, Rob Clark,
	Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek, Sakari Ailus,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Bas Nieuwenhuizen, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Why not enum?
> 
> There is no enum for DRM format modifiers.

I'm not sure how this prevents to use enum in the code instead of const u64.
Any specific reason for that?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-14 15:17         ` [Nouveau] " Andy Shevchenko
  (?)
  (?)
@ 2022-01-14 15:42           ` Simon Ser
  -1 siblings, 0 replies; 72+ messages in thread
From: Simon Ser @ 2022-01-14 15:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Tomohito Esaki, dri-devel, Alex Deucher, Christian König,
	Pan, Xinhui, David Airlie, Daniel Vetter, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Ben Skeggs, Michel Dänzer,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Petr Mladek, Sakari Ailus, Lee Jones, Abhinav Kumar,
	Dmitry Baryshkov, Rob Clark, amd-gfx, linux-kernel, nouveau,
	Daniel Stone, Laurent Pinchart, Damian Hobson-Garcia,
	Takanari Hayama

On Friday, January 14th, 2022 at 16:17, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> > On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > Why not enum?
> >
> > There is no enum for DRM format modifiers.
>
> I'm not sure how this prevents to use enum in the code instead of const u64.
> Any specific reason for that?

I'm not sure how one would use an enum as the array item type, when there is no
defined enum type.

Moreover, all the rest of DRM uses uint64 for modifiers.

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 15:42           ` Simon Ser
  0 siblings, 0 replies; 72+ messages in thread
From: Simon Ser @ 2022-01-14 15:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Tomohito Esaki, Rob Clark,
	Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek, Sakari Ailus,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Bas Nieuwenhuizen,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

On Friday, January 14th, 2022 at 16:17, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> > On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > Why not enum?
> >
> > There is no enum for DRM format modifiers.
>
> I'm not sure how this prevents to use enum in the code instead of const u64.
> Any specific reason for that?

I'm not sure how one would use an enum as the array item type, when there is no
defined enum type.

Moreover, all the rest of DRM uses uint64 for modifiers.

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 15:42           ` Simon Ser
  0 siblings, 0 replies; 72+ messages in thread
From: Simon Ser @ 2022-01-14 15:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Tomohito Esaki, Rob Clark, Takanari Hayama, amd-gfx, Ben Skeggs,
	Petr Mladek, Sakari Ailus, Abhinav Kumar, Alex Deucher,
	Sean Paul, Evan Quan, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Dmitry Baryshkov,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

On Friday, January 14th, 2022 at 16:17, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> > On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > Why not enum?
> >
> > There is no enum for DRM format modifiers.
>
> I'm not sure how this prevents to use enum in the code instead of const u64.
> Any specific reason for that?

I'm not sure how one would use an enum as the array item type, when there is no
defined enum type.

Moreover, all the rest of DRM uses uint64 for modifiers.

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 15:42           ` Simon Ser
  0 siblings, 0 replies; 72+ messages in thread
From: Simon Ser @ 2022-01-14 15:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Tomohito Esaki, Rob Clark,
	Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek, Sakari Ailus,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Bas Nieuwenhuizen, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Friday, January 14th, 2022 at 16:17, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> > On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > Why not enum?
> >
> > There is no enum for DRM format modifiers.
>
> I'm not sure how this prevents to use enum in the code instead of const u64.
> Any specific reason for that?

I'm not sure how one would use an enum as the array item type, when there is no
defined enum type.

Moreover, all the rest of DRM uses uint64 for modifiers.

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-14 15:42           ` [Nouveau] " Simon Ser
  (?)
  (?)
@ 2022-01-14 16:06             ` Andy Shevchenko
  -1 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 16:06 UTC (permalink / raw)
  To: Simon Ser
  Cc: Tomohito Esaki, dri-devel, Alex Deucher, Christian König,
	Pan, Xinhui, David Airlie, Daniel Vetter, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Ben Skeggs, Michel Dänzer,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Petr Mladek, Sakari Ailus, Lee Jones, Abhinav Kumar,
	Dmitry Baryshkov, Rob Clark, amd-gfx, linux-kernel, nouveau,
	Daniel Stone, Laurent Pinchart, Damian Hobson-Garcia,
	Takanari Hayama

On Fri, Jan 14, 2022 at 03:42:54PM +0000, Simon Ser wrote:
> On Friday, January 14th, 2022 at 16:17, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> > > On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > > Why not enum?
> > >
> > > There is no enum for DRM format modifiers.
> >
> > I'm not sure how this prevents to use enum in the code instead of const u64.
> > Any specific reason for that?
> 
> I'm not sure how one would use an enum as the array item type, when there is no
> defined enum type.
> 
> Moreover, all the rest of DRM uses uint64 for modifiers.

Ah, I see now. This is an array that filled by predefined values.
Thanks for explanation.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 16:06             ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 16:06 UTC (permalink / raw)
  To: Simon Ser
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Tomohito Esaki, Rob Clark,
	Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek, Sakari Ailus,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Bas Nieuwenhuizen,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

On Fri, Jan 14, 2022 at 03:42:54PM +0000, Simon Ser wrote:
> On Friday, January 14th, 2022 at 16:17, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> > > On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > > Why not enum?
> > >
> > > There is no enum for DRM format modifiers.
> >
> > I'm not sure how this prevents to use enum in the code instead of const u64.
> > Any specific reason for that?
> 
> I'm not sure how one would use an enum as the array item type, when there is no
> defined enum type.
> 
> Moreover, all the rest of DRM uses uint64 for modifiers.

Ah, I see now. This is an array that filled by predefined values.
Thanks for explanation.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 16:06             ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 16:06 UTC (permalink / raw)
  To: Simon Ser
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Tomohito Esaki, Rob Clark, Takanari Hayama, amd-gfx, Ben Skeggs,
	Petr Mladek, Sakari Ailus, Abhinav Kumar, Alex Deucher,
	Sean Paul, Evan Quan, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Dmitry Baryshkov,
	Damian Hobson-Garcia, Christian König, Laurent Pinchart

On Fri, Jan 14, 2022 at 03:42:54PM +0000, Simon Ser wrote:
> On Friday, January 14th, 2022 at 16:17, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> > > On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > > Why not enum?
> > >
> > > There is no enum for DRM format modifiers.
> >
> > I'm not sure how this prevents to use enum in the code instead of const u64.
> > Any specific reason for that?
> 
> I'm not sure how one would use an enum as the array item type, when there is no
> defined enum type.
> 
> Moreover, all the rest of DRM uses uint64 for modifiers.

Ah, I see now. This is an array that filled by predefined values.
Thanks for explanation.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-14 16:06             ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-14 16:06 UTC (permalink / raw)
  To: Simon Ser
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Tomohito Esaki, Rob Clark,
	Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek, Sakari Ailus,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Bas Nieuwenhuizen, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Fri, Jan 14, 2022 at 03:42:54PM +0000, Simon Ser wrote:
> On Friday, January 14th, 2022 at 16:17, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > On Fri, Jan 14, 2022 at 03:07:21PM +0000, Simon Ser wrote:
> > > On Friday, January 14th, 2022 at 15:16, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > > Why not enum?
> > >
> > > There is no enum for DRM format modifiers.
> >
> > I'm not sure how this prevents to use enum in the code instead of const u64.
> > Any specific reason for that?
> 
> I'm not sure how one would use an enum as the array item type, when there is no
> defined enum type.
> 
> Moreover, all the rest of DRM uses uint64 for modifiers.

Ah, I see now. This is an array that filled by predefined values.
Thanks for explanation.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-14 14:16     ` [Nouveau] " Andy Shevchenko
  (?)
  (?)
@ 2022-01-17  5:15       ` Esaki Tomohito
  -1 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-17  5:15 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: dri-devel, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Petr Mladek, Sakari Ailus, Lee Jones, Abhinav Kumar,
	Dmitry Baryshkov, Rob Clark, amd-gfx, linux-kernel, nouveau,
	Daniel Stone, Laurent Pinchart, Damian Hobson-Garcia,
	Takanari Hayama

Thank you for your reviews.

On 2022/01/14 23:16, Andy Shevchenko wrote:
> On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
>> The LINEAR modifier is advertised as default if a driver doesn't specify
>> modifiers.
> 
> ...
> 
>> +	const uint64_t default_modifiers[] = {
>> +		DRM_FORMAT_MOD_LINEAR,
>> +		DRM_FORMAT_MOD_INVALID
> 
> + Comma?

There is no mention in the coding style about adding/removing a comma to 
the last element of an array. Is there a policy in drm driver?

I think the advantage of adding a comma to the last element of an array 
is that diff is only one line when an element is added to the end.
However since INVALID is always the last element in the modifiers array, 
I think it can be either in this case.
If there is a policy, I will match it.

Thanks,
Tomohito Esaki

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-17  5:15       ` Esaki Tomohito
  0 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-17  5:15 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Rob Clark, Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Alex Deucher, Sean Paul, Evan Quan,
	Mark Yacoub, Qingqing Zhuo, Pan, Xinhui, linux-kernel,
	Thomas Zimmermann, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

Thank you for your reviews.

On 2022/01/14 23:16, Andy Shevchenko wrote:
> On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
>> The LINEAR modifier is advertised as default if a driver doesn't specify
>> modifiers.
> 
> ...
> 
>> +	const uint64_t default_modifiers[] = {
>> +		DRM_FORMAT_MOD_LINEAR,
>> +		DRM_FORMAT_MOD_INVALID
> 
> + Comma?

There is no mention in the coding style about adding/removing a comma to 
the last element of an array. Is there a policy in drm driver?

I think the advantage of adding a comma to the last element of an array 
is that diff is only one line when an element is added to the end.
However since INVALID is always the last element in the modifiers array, 
I think it can be either in this case.
If there is a policy, I will match it.

Thanks,
Tomohito Esaki

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-17  5:15       ` Esaki Tomohito
  0 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-17  5:15 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Simon Ser, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

Thank you for your reviews.

On 2022/01/14 23:16, Andy Shevchenko wrote:
> On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
>> The LINEAR modifier is advertised as default if a driver doesn't specify
>> modifiers.
> 
> ...
> 
>> +	const uint64_t default_modifiers[] = {
>> +		DRM_FORMAT_MOD_LINEAR,
>> +		DRM_FORMAT_MOD_INVALID
> 
> + Comma?

There is no mention in the coding style about adding/removing a comma to 
the last element of an array. Is there a policy in drm driver?

I think the advantage of adding a comma to the last element of an array 
is that diff is only one line when an element is added to the end.
However since INVALID is always the last element in the modifiers array, 
I think it can be either in this case.
If there is a policy, I will match it.

Thanks,
Tomohito Esaki

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-17  5:15       ` Esaki Tomohito
  0 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-17  5:15 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Simon Ser,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

Thank you for your reviews.

On 2022/01/14 23:16, Andy Shevchenko wrote:
> On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
>> The LINEAR modifier is advertised as default if a driver doesn't specify
>> modifiers.
> 
> ...
> 
>> +	const uint64_t default_modifiers[] = {
>> +		DRM_FORMAT_MOD_LINEAR,
>> +		DRM_FORMAT_MOD_INVALID
> 
> + Comma?

There is no mention in the coding style about adding/removing a comma to 
the last element of an array. Is there a policy in drm driver?

I think the advantage of adding a comma to the last element of an array 
is that diff is only one line when an element is added to the end.
However since INVALID is always the last element in the modifiers array, 
I think it can be either in this case.
If there is a policy, I will match it.

Thanks,
Tomohito Esaki

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-17  5:15       ` Esaki Tomohito
  (?)
  (?)
@ 2022-01-18  9:53         ` Andy Shevchenko
  -1 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-18  9:53 UTC (permalink / raw)
  To: Esaki Tomohito
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Rob Clark, Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Alex Deucher, Sean Paul, Evan Quan,
	Mark Yacoub, Qingqing Zhuo, Pan, Xinhui, linux-kernel,
	Thomas Zimmermann, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
> On 2022/01/14 23:16, Andy Shevchenko wrote:
> > On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> > > The LINEAR modifier is advertised as default if a driver doesn't specify
> > > modifiers.
> > 
> > ...
> > 
> > > +	const uint64_t default_modifiers[] = {
> > > +		DRM_FORMAT_MOD_LINEAR,
> > > +		DRM_FORMAT_MOD_INVALID
> > 
> > + Comma?
> 
> There is no mention in the coding style about adding/removing a comma to the
> last element of an array. Is there a policy in drm driver?
> 
> I think the advantage of adding a comma to the last element of an array is
> that diff is only one line when an element is added to the end.
> However since INVALID is always the last element in the modifiers array, I
> think it can be either in this case.
> If there is a policy, I will match it.

Indeed, but there is a common sense. The idea behind (multi-line) definitions
that when next time somebody will add an element in the array, there are will
be:

a) no additional churn (like in case of this patch, if the item will be added
   at the bottom;

b) an element that may not be added behind the terminator, which will look
   weird.

That said, the question is if the element is terminator one or not, if not,
comma is better than no comma and vise versa.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-18  9:53         ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-18  9:53 UTC (permalink / raw)
  To: Esaki Tomohito
  Cc: dri-devel, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Petr Mladek, Sakari Ailus, Lee Jones, Abhinav Kumar,
	Dmitry Baryshkov, Rob Clark, amd-gfx, linux-kernel, nouveau,
	Daniel Stone, Laurent Pinchart, Damian Hobson-Garcia,
	Takanari Hayama

On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
> On 2022/01/14 23:16, Andy Shevchenko wrote:
> > On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> > > The LINEAR modifier is advertised as default if a driver doesn't specify
> > > modifiers.
> > 
> > ...
> > 
> > > +	const uint64_t default_modifiers[] = {
> > > +		DRM_FORMAT_MOD_LINEAR,
> > > +		DRM_FORMAT_MOD_INVALID
> > 
> > + Comma?
> 
> There is no mention in the coding style about adding/removing a comma to the
> last element of an array. Is there a policy in drm driver?
> 
> I think the advantage of adding a comma to the last element of an array is
> that diff is only one line when an element is added to the end.
> However since INVALID is always the last element in the modifiers array, I
> think it can be either in this case.
> If there is a policy, I will match it.

Indeed, but there is a common sense. The idea behind (multi-line) definitions
that when next time somebody will add an element in the array, there are will
be:

a) no additional churn (like in case of this patch, if the item will be added
   at the bottom;

b) an element that may not be added behind the terminator, which will look
   weird.

That said, the question is if the element is terminator one or not, if not,
comma is better than no comma and vise versa.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-18  9:53         ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-18  9:53 UTC (permalink / raw)
  To: Esaki Tomohito
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Simon Ser,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
> On 2022/01/14 23:16, Andy Shevchenko wrote:
> > On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> > > The LINEAR modifier is advertised as default if a driver doesn't specify
> > > modifiers.
> > 
> > ...
> > 
> > > +	const uint64_t default_modifiers[] = {
> > > +		DRM_FORMAT_MOD_LINEAR,
> > > +		DRM_FORMAT_MOD_INVALID
> > 
> > + Comma?
> 
> There is no mention in the coding style about adding/removing a comma to the
> last element of an array. Is there a policy in drm driver?
> 
> I think the advantage of adding a comma to the last element of an array is
> that diff is only one line when an element is added to the end.
> However since INVALID is always the last element in the modifiers array, I
> think it can be either in this case.
> If there is a policy, I will match it.

Indeed, but there is a common sense. The idea behind (multi-line) definitions
that when next time somebody will add an element in the array, there are will
be:

a) no additional churn (like in case of this patch, if the item will be added
   at the bottom;

b) an element that may not be added behind the terminator, which will look
   weird.

That said, the question is if the element is terminator one or not, if not,
comma is better than no comma and vise versa.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-18  9:53         ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-18  9:53 UTC (permalink / raw)
  To: Esaki Tomohito
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Simon Ser, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
> On 2022/01/14 23:16, Andy Shevchenko wrote:
> > On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> > > The LINEAR modifier is advertised as default if a driver doesn't specify
> > > modifiers.
> > 
> > ...
> > 
> > > +	const uint64_t default_modifiers[] = {
> > > +		DRM_FORMAT_MOD_LINEAR,
> > > +		DRM_FORMAT_MOD_INVALID
> > 
> > + Comma?
> 
> There is no mention in the coding style about adding/removing a comma to the
> last element of an array. Is there a policy in drm driver?
> 
> I think the advantage of adding a comma to the last element of an array is
> that diff is only one line when an element is added to the end.
> However since INVALID is always the last element in the modifiers array, I
> think it can be either in this case.
> If there is a policy, I will match it.

Indeed, but there is a common sense. The idea behind (multi-line) definitions
that when next time somebody will add an element in the array, there are will
be:

a) no additional churn (like in case of this patch, if the item will be added
   at the bottom;

b) an element that may not be added behind the terminator, which will look
   weird.

That said, the question is if the element is terminator one or not, if not,
comma is better than no comma and vise versa.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-18  9:53         ` Andy Shevchenko
  (?)
  (?)
@ 2022-01-19  2:35           ` Esaki Tomohito
  -1 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-19  2:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: dri-devel, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Petr Mladek, Sakari Ailus, Lee Jones, Abhinav Kumar,
	Dmitry Baryshkov, Rob Clark, amd-gfx, linux-kernel, nouveau,
	Daniel Stone, Laurent Pinchart, Damian Hobson-Garcia,
	Takanari Hayama

On 2022/01/18 18:53, Andy Shevchenko wrote:
> On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
>> On 2022/01/14 23:16, Andy Shevchenko wrote:
>>> On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
>>>> The LINEAR modifier is advertised as default if a driver doesn't specify
>>>> modifiers.
>>>
>>> ...
>>>
>>>> +	const uint64_t default_modifiers[] = {
>>>> +		DRM_FORMAT_MOD_LINEAR,
>>>> +		DRM_FORMAT_MOD_INVALID
>>>
>>> + Comma?
>>
>> There is no mention in the coding style about adding/removing a comma to the
>> last element of an array. Is there a policy in drm driver?
>>
>> I think the advantage of adding a comma to the last element of an array is
>> that diff is only one line when an element is added to the end.
>> However since INVALID is always the last element in the modifiers array, I
>> think it can be either in this case.
>> If there is a policy, I will match it.
> 
> Indeed, but there is a common sense. The idea behind (multi-line) definitions
> that when next time somebody will add an element in the array, there are will
> be:
> 
> a) no additional churn (like in case of this patch, if the item will be added
>     at the bottom;
> 
> b) an element that may not be added behind the terminator, which will look
>     weird.
> 
> That said, the question is if the element is terminator one or not, if not,
> comma is better than no comma and vise versa.
> 

Ah I see. In this case, DRM_FORMAT_MOD_INVALID is terminator, so it
should not have a comma.

Thanks
Tomohito Esaki

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-19  2:35           ` Esaki Tomohito
  0 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-19  2:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Rob Clark, Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Alex Deucher, Sean Paul, Evan Quan,
	Mark Yacoub, Qingqing Zhuo, Pan, Xinhui, linux-kernel,
	Thomas Zimmermann, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On 2022/01/18 18:53, Andy Shevchenko wrote:
> On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
>> On 2022/01/14 23:16, Andy Shevchenko wrote:
>>> On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
>>>> The LINEAR modifier is advertised as default if a driver doesn't specify
>>>> modifiers.
>>>
>>> ...
>>>
>>>> +	const uint64_t default_modifiers[] = {
>>>> +		DRM_FORMAT_MOD_LINEAR,
>>>> +		DRM_FORMAT_MOD_INVALID
>>>
>>> + Comma?
>>
>> There is no mention in the coding style about adding/removing a comma to the
>> last element of an array. Is there a policy in drm driver?
>>
>> I think the advantage of adding a comma to the last element of an array is
>> that diff is only one line when an element is added to the end.
>> However since INVALID is always the last element in the modifiers array, I
>> think it can be either in this case.
>> If there is a policy, I will match it.
> 
> Indeed, but there is a common sense. The idea behind (multi-line) definitions
> that when next time somebody will add an element in the array, there are will
> be:
> 
> a) no additional churn (like in case of this patch, if the item will be added
>     at the bottom;
> 
> b) an element that may not be added behind the terminator, which will look
>     weird.
> 
> That said, the question is if the element is terminator one or not, if not,
> comma is better than no comma and vise versa.
> 

Ah I see. In this case, DRM_FORMAT_MOD_INVALID is terminator, so it
should not have a comma.

Thanks
Tomohito Esaki

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-19  2:35           ` Esaki Tomohito
  0 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-19  2:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Simon Ser, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On 2022/01/18 18:53, Andy Shevchenko wrote:
> On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
>> On 2022/01/14 23:16, Andy Shevchenko wrote:
>>> On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
>>>> The LINEAR modifier is advertised as default if a driver doesn't specify
>>>> modifiers.
>>>
>>> ...
>>>
>>>> +	const uint64_t default_modifiers[] = {
>>>> +		DRM_FORMAT_MOD_LINEAR,
>>>> +		DRM_FORMAT_MOD_INVALID
>>>
>>> + Comma?
>>
>> There is no mention in the coding style about adding/removing a comma to the
>> last element of an array. Is there a policy in drm driver?
>>
>> I think the advantage of adding a comma to the last element of an array is
>> that diff is only one line when an element is added to the end.
>> However since INVALID is always the last element in the modifiers array, I
>> think it can be either in this case.
>> If there is a policy, I will match it.
> 
> Indeed, but there is a common sense. The idea behind (multi-line) definitions
> that when next time somebody will add an element in the array, there are will
> be:
> 
> a) no additional churn (like in case of this patch, if the item will be added
>     at the bottom;
> 
> b) an element that may not be added behind the terminator, which will look
>     weird.
> 
> That said, the question is if the element is terminator one or not, if not,
> comma is better than no comma and vise versa.
> 

Ah I see. In this case, DRM_FORMAT_MOD_INVALID is terminator, so it
should not have a comma.

Thanks
Tomohito Esaki

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-19  2:35           ` Esaki Tomohito
  0 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-19  2:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Simon Ser,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

On 2022/01/18 18:53, Andy Shevchenko wrote:
> On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
>> On 2022/01/14 23:16, Andy Shevchenko wrote:
>>> On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
>>>> The LINEAR modifier is advertised as default if a driver doesn't specify
>>>> modifiers.
>>>
>>> ...
>>>
>>>> +	const uint64_t default_modifiers[] = {
>>>> +		DRM_FORMAT_MOD_LINEAR,
>>>> +		DRM_FORMAT_MOD_INVALID
>>>
>>> + Comma?
>>
>> There is no mention in the coding style about adding/removing a comma to the
>> last element of an array. Is there a policy in drm driver?
>>
>> I think the advantage of adding a comma to the last element of an array is
>> that diff is only one line when an element is added to the end.
>> However since INVALID is always the last element in the modifiers array, I
>> think it can be either in this case.
>> If there is a policy, I will match it.
> 
> Indeed, but there is a common sense. The idea behind (multi-line) definitions
> that when next time somebody will add an element in the array, there are will
> be:
> 
> a) no additional churn (like in case of this patch, if the item will be added
>     at the bottom;
> 
> b) an element that may not be added behind the terminator, which will look
>     weird.
> 
> That said, the question is if the element is terminator one or not, if not,
> comma is better than no comma and vise versa.
> 

Ah I see. In this case, DRM_FORMAT_MOD_INVALID is terminator, so it
should not have a comma.

Thanks
Tomohito Esaki

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-19  2:35           ` Esaki Tomohito
  (?)
  (?)
@ 2022-01-19 19:17             ` Andy Shevchenko
  -1 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:17 UTC (permalink / raw)
  To: Esaki Tomohito
  Cc: dri-devel, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Petr Mladek, Sakari Ailus, Lee Jones, Abhinav Kumar,
	Dmitry Baryshkov, Rob Clark, amd-gfx, linux-kernel, nouveau,
	Daniel Stone, Laurent Pinchart, Damian Hobson-Garcia,
	Takanari Hayama

On Wed, Jan 19, 2022 at 11:35:22AM +0900, Esaki Tomohito wrote:
> On 2022/01/18 18:53, Andy Shevchenko wrote:
> > On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
> > > On 2022/01/14 23:16, Andy Shevchenko wrote:
> > > > On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> > > > > The LINEAR modifier is advertised as default if a driver doesn't specify
> > > > > modifiers.
> > > > 
> > > > ...
> > > > 
> > > > > +	const uint64_t default_modifiers[] = {
> > > > > +		DRM_FORMAT_MOD_LINEAR,
> > > > > +		DRM_FORMAT_MOD_INVALID
> > > > 
> > > > + Comma?
> > > 
> > > There is no mention in the coding style about adding/removing a comma to the
> > > last element of an array. Is there a policy in drm driver?
> > > 
> > > I think the advantage of adding a comma to the last element of an array is
> > > that diff is only one line when an element is added to the end.
> > > However since INVALID is always the last element in the modifiers array, I
> > > think it can be either in this case.
> > > If there is a policy, I will match it.
> > 
> > Indeed, but there is a common sense. The idea behind (multi-line) definitions
> > that when next time somebody will add an element in the array, there are will
> > be:
> > 
> > a) no additional churn (like in case of this patch, if the item will be added
> >     at the bottom;
> > 
> > b) an element that may not be added behind the terminator, which will look
> >     weird.
> > 
> > That said, the question is if the element is terminator one or not, if not,
> > comma is better than no comma and vise versa.
> 
> Ah I see. In this case, DRM_FORMAT_MOD_INVALID is terminator, so it
> should not have a comma.

Thanks for pointing this out. In this case we are good and any new item, AFAIU,
must be added before _INVALID one.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-19 19:17             ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:17 UTC (permalink / raw)
  To: Esaki Tomohito
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Simon Ser,
	Dmitry Baryshkov, Damian Hobson-Garcia, Christian König,
	Laurent Pinchart

On Wed, Jan 19, 2022 at 11:35:22AM +0900, Esaki Tomohito wrote:
> On 2022/01/18 18:53, Andy Shevchenko wrote:
> > On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
> > > On 2022/01/14 23:16, Andy Shevchenko wrote:
> > > > On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> > > > > The LINEAR modifier is advertised as default if a driver doesn't specify
> > > > > modifiers.
> > > > 
> > > > ...
> > > > 
> > > > > +	const uint64_t default_modifiers[] = {
> > > > > +		DRM_FORMAT_MOD_LINEAR,
> > > > > +		DRM_FORMAT_MOD_INVALID
> > > > 
> > > > + Comma?
> > > 
> > > There is no mention in the coding style about adding/removing a comma to the
> > > last element of an array. Is there a policy in drm driver?
> > > 
> > > I think the advantage of adding a comma to the last element of an array is
> > > that diff is only one line when an element is added to the end.
> > > However since INVALID is always the last element in the modifiers array, I
> > > think it can be either in this case.
> > > If there is a policy, I will match it.
> > 
> > Indeed, but there is a common sense. The idea behind (multi-line) definitions
> > that when next time somebody will add an element in the array, there are will
> > be:
> > 
> > a) no additional churn (like in case of this patch, if the item will be added
> >     at the bottom;
> > 
> > b) an element that may not be added behind the terminator, which will look
> >     weird.
> > 
> > That said, the question is if the element is terminator one or not, if not,
> > comma is better than no comma and vise versa.
> 
> Ah I see. In this case, DRM_FORMAT_MOD_INVALID is terminator, so it
> should not have a comma.

Thanks for pointing this out. In this case we are good and any new item, AFAIU,
must be added before _INVALID one.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-19 19:17             ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:17 UTC (permalink / raw)
  To: Esaki Tomohito
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Rob Clark, Takanari Hayama, amd-gfx, Ben Skeggs, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Alex Deucher, Sean Paul, Evan Quan,
	Mark Yacoub, Qingqing Zhuo, Pan, Xinhui, linux-kernel,
	Thomas Zimmermann, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Wed, Jan 19, 2022 at 11:35:22AM +0900, Esaki Tomohito wrote:
> On 2022/01/18 18:53, Andy Shevchenko wrote:
> > On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
> > > On 2022/01/14 23:16, Andy Shevchenko wrote:
> > > > On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> > > > > The LINEAR modifier is advertised as default if a driver doesn't specify
> > > > > modifiers.
> > > > 
> > > > ...
> > > > 
> > > > > +	const uint64_t default_modifiers[] = {
> > > > > +		DRM_FORMAT_MOD_LINEAR,
> > > > > +		DRM_FORMAT_MOD_INVALID
> > > > 
> > > > + Comma?
> > > 
> > > There is no mention in the coding style about adding/removing a comma to the
> > > last element of an array. Is there a policy in drm driver?
> > > 
> > > I think the advantage of adding a comma to the last element of an array is
> > > that diff is only one line when an element is added to the end.
> > > However since INVALID is always the last element in the modifiers array, I
> > > think it can be either in this case.
> > > If there is a policy, I will match it.
> > 
> > Indeed, but there is a common sense. The idea behind (multi-line) definitions
> > that when next time somebody will add an element in the array, there are will
> > be:
> > 
> > a) no additional churn (like in case of this patch, if the item will be added
> >     at the bottom;
> > 
> > b) an element that may not be added behind the terminator, which will look
> >     weird.
> > 
> > That said, the question is if the element is terminator one or not, if not,
> > comma is better than no comma and vise versa.
> 
> Ah I see. In this case, DRM_FORMAT_MOD_INVALID is terminator, so it
> should not have a comma.

Thanks for pointing this out. In this case we are good and any new item, AFAIU,
must be added before _INVALID one.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-19 19:17             ` Andy Shevchenko
  0 siblings, 0 replies; 72+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:17 UTC (permalink / raw)
  To: Esaki Tomohito
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Takanari Hayama, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Alex Deucher, Sean Paul,
	Maxime Ripard, Daniel Vetter, Evan Quan, Mark Yacoub,
	Qingqing Zhuo, Pan, Xinhui, linux-kernel, Thomas Zimmermann,
	Simon Ser, Dmitry Baryshkov, Damian Hobson-Garcia,
	Christian König, Laurent Pinchart

On Wed, Jan 19, 2022 at 11:35:22AM +0900, Esaki Tomohito wrote:
> On 2022/01/18 18:53, Andy Shevchenko wrote:
> > On Mon, Jan 17, 2022 at 02:15:48PM +0900, Esaki Tomohito wrote:
> > > On 2022/01/14 23:16, Andy Shevchenko wrote:
> > > > On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> > > > > The LINEAR modifier is advertised as default if a driver doesn't specify
> > > > > modifiers.
> > > > 
> > > > ...
> > > > 
> > > > > +	const uint64_t default_modifiers[] = {
> > > > > +		DRM_FORMAT_MOD_LINEAR,
> > > > > +		DRM_FORMAT_MOD_INVALID
> > > > 
> > > > + Comma?
> > > 
> > > There is no mention in the coding style about adding/removing a comma to the
> > > last element of an array. Is there a policy in drm driver?
> > > 
> > > I think the advantage of adding a comma to the last element of an array is
> > > that diff is only one line when an element is added to the end.
> > > However since INVALID is always the last element in the modifiers array, I
> > > think it can be either in this case.
> > > If there is a policy, I will match it.
> > 
> > Indeed, but there is a common sense. The idea behind (multi-line) definitions
> > that when next time somebody will add an element in the array, there are will
> > be:
> > 
> > a) no additional churn (like in case of this patch, if the item will be added
> >     at the bottom;
> > 
> > b) an element that may not be added behind the terminator, which will look
> >     weird.
> > 
> > That said, the question is if the element is terminator one or not, if not,
> > comma is better than no comma and vise versa.
> 
> Ah I see. In this case, DRM_FORMAT_MOD_INVALID is terminator, so it
> should not have a comma.

Thanks for pointing this out. In this case we are good and any new item, AFAIU,
must be added before _INVALID one.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
  2022-01-14 10:17   ` Tomohito Esaki
  (?)
  (?)
@ 2022-01-23 22:37     ` Laurent Pinchart
  -1 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:37 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: dri-devel, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Andy Shevchenko, Petr Mladek, Sakari Ailus, Lee Jones,
	Abhinav Kumar, Dmitry Baryshkov, Rob Clark, amd-gfx,
	linux-kernel, nouveau, Daniel Stone, Damian Hobson-Garcia,
	Takanari Hayama

Hello Esaki-san,

Thank you for the patch.

On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> The LINEAR modifier is advertised as default if a driver doesn't specify
> modifiers.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/drm_plane.c | 15 ++++++++++++---
>  include/drm/drm_plane.h     |  3 +++
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index deeec60a3315..5aa7e241971e 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -237,6 +237,10 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  				      const char *name, va_list ap)
>  {
>  	struct drm_mode_config *config = &dev->mode_config;
> +	const uint64_t default_modifiers[] = {

This can be static.

> +		DRM_FORMAT_MOD_LINEAR,
> +		DRM_FORMAT_MOD_INVALID

No need for a terminator here. The terminator is needed in the
format_modifiers array passed to this function, to count the number of
elements, but the default_modifiers is used with a hard-coded count.

> +	};
>  	unsigned int format_modifier_count = 0;
>  	int ret;
>  
> @@ -277,6 +281,11 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  
>  		while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
>  			format_modifier_count++;
> +	} else {
> +		if (!dev->mode_config.fb_modifiers_not_supported) {
> +			format_modifiers = default_modifiers;
> +			format_modifier_count = 1;

You can use

			format_modifier_count = ARRAY_SIZE(default_modifiers);

> +		}
>  	}
>  
>  	/* autoset the cap and check for consistency across all planes */
> @@ -341,7 +350,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		drm_object_attach_property(&plane->base, config->prop_src_h, 0);
>  	}
>  
> -	if (config->allow_fb_modifiers)
> +	if (format_modifier_count)
>  		create_in_format_blob(dev, plane);
>  
>  	return 0;
> @@ -368,8 +377,8 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>   * drm_universal_plane_init() to let the DRM managed resource infrastructure
>   * take care of cleanup and deallocation.
>   *
> - * Drivers supporting modifiers must set @format_modifiers on all their planes,
> - * even those that only support DRM_FORMAT_MOD_LINEAR.
> + * For drivers supporting modifiers, all planes will advertise
> + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.

I'd write this a bit differently:

 * Drivers that only support the DRM_FORMAT_MOD_LINEAR modifier support may set
 * @format_modifiers to NULL. The plane will advertise the linear modifier.

As fb_modifiers_not_supported is only for a few legacy drivers, I
wouldn't even mention it here, it would only obfuscate things.

>   *
>   * Returns:
>   * Zero on success, error code on failure.
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 0c1102dc4d88..cad641b1f797 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -803,6 +803,9 @@ void *__drmm_universal_plane_alloc(struct drm_device *dev,
>   *
>   * The @drm_plane_funcs.destroy hook must be NULL.
>   *
> + * For drivers supporting modifiers, all planes will advertise
> + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.

Same here.

With these small issues addressed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> + *
>   * Returns:
>   * Pointer to new plane, or ERR_PTR on failure.
>   */

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-23 22:37     ` Laurent Pinchart
  0 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:37 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Simon Ser, Alex Deucher, Damian Hobson-Garcia,
	Christian König

Hello Esaki-san,

Thank you for the patch.

On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> The LINEAR modifier is advertised as default if a driver doesn't specify
> modifiers.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/drm_plane.c | 15 ++++++++++++---
>  include/drm/drm_plane.h     |  3 +++
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index deeec60a3315..5aa7e241971e 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -237,6 +237,10 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  				      const char *name, va_list ap)
>  {
>  	struct drm_mode_config *config = &dev->mode_config;
> +	const uint64_t default_modifiers[] = {

This can be static.

> +		DRM_FORMAT_MOD_LINEAR,
> +		DRM_FORMAT_MOD_INVALID

No need for a terminator here. The terminator is needed in the
format_modifiers array passed to this function, to count the number of
elements, but the default_modifiers is used with a hard-coded count.

> +	};
>  	unsigned int format_modifier_count = 0;
>  	int ret;
>  
> @@ -277,6 +281,11 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  
>  		while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
>  			format_modifier_count++;
> +	} else {
> +		if (!dev->mode_config.fb_modifiers_not_supported) {
> +			format_modifiers = default_modifiers;
> +			format_modifier_count = 1;

You can use

			format_modifier_count = ARRAY_SIZE(default_modifiers);

> +		}
>  	}
>  
>  	/* autoset the cap and check for consistency across all planes */
> @@ -341,7 +350,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		drm_object_attach_property(&plane->base, config->prop_src_h, 0);
>  	}
>  
> -	if (config->allow_fb_modifiers)
> +	if (format_modifier_count)
>  		create_in_format_blob(dev, plane);
>  
>  	return 0;
> @@ -368,8 +377,8 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>   * drm_universal_plane_init() to let the DRM managed resource infrastructure
>   * take care of cleanup and deallocation.
>   *
> - * Drivers supporting modifiers must set @format_modifiers on all their planes,
> - * even those that only support DRM_FORMAT_MOD_LINEAR.
> + * For drivers supporting modifiers, all planes will advertise
> + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.

I'd write this a bit differently:

 * Drivers that only support the DRM_FORMAT_MOD_LINEAR modifier support may set
 * @format_modifiers to NULL. The plane will advertise the linear modifier.

As fb_modifiers_not_supported is only for a few legacy drivers, I
wouldn't even mention it here, it would only obfuscate things.

>   *
>   * Returns:
>   * Zero on success, error code on failure.
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 0c1102dc4d88..cad641b1f797 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -803,6 +803,9 @@ void *__drmm_universal_plane_alloc(struct drm_device *dev,
>   *
>   * The @drm_plane_funcs.destroy hook must be NULL.
>   *
> + * For drivers supporting modifiers, all planes will advertise
> + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.

Same here.

With these small issues addressed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> + *
>   * Returns:
>   * Pointer to new plane, or ERR_PTR on failure.
>   */

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-23 22:37     ` Laurent Pinchart
  0 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:37 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Rob Clark, Evan Quan, amd-gfx, Ben Skeggs, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Dmitry Baryshkov, Takanari Hayama,
	Sean Paul, Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan,
	Xinhui, linux-kernel, Thomas Zimmermann, Alex Deucher,
	Damian Hobson-Garcia, Christian König

Hello Esaki-san,

Thank you for the patch.

On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> The LINEAR modifier is advertised as default if a driver doesn't specify
> modifiers.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/drm_plane.c | 15 ++++++++++++---
>  include/drm/drm_plane.h     |  3 +++
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index deeec60a3315..5aa7e241971e 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -237,6 +237,10 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  				      const char *name, va_list ap)
>  {
>  	struct drm_mode_config *config = &dev->mode_config;
> +	const uint64_t default_modifiers[] = {

This can be static.

> +		DRM_FORMAT_MOD_LINEAR,
> +		DRM_FORMAT_MOD_INVALID

No need for a terminator here. The terminator is needed in the
format_modifiers array passed to this function, to count the number of
elements, but the default_modifiers is used with a hard-coded count.

> +	};
>  	unsigned int format_modifier_count = 0;
>  	int ret;
>  
> @@ -277,6 +281,11 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  
>  		while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
>  			format_modifier_count++;
> +	} else {
> +		if (!dev->mode_config.fb_modifiers_not_supported) {
> +			format_modifiers = default_modifiers;
> +			format_modifier_count = 1;

You can use

			format_modifier_count = ARRAY_SIZE(default_modifiers);

> +		}
>  	}
>  
>  	/* autoset the cap and check for consistency across all planes */
> @@ -341,7 +350,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		drm_object_attach_property(&plane->base, config->prop_src_h, 0);
>  	}
>  
> -	if (config->allow_fb_modifiers)
> +	if (format_modifier_count)
>  		create_in_format_blob(dev, plane);
>  
>  	return 0;
> @@ -368,8 +377,8 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>   * drm_universal_plane_init() to let the DRM managed resource infrastructure
>   * take care of cleanup and deallocation.
>   *
> - * Drivers supporting modifiers must set @format_modifiers on all their planes,
> - * even those that only support DRM_FORMAT_MOD_LINEAR.
> + * For drivers supporting modifiers, all planes will advertise
> + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.

I'd write this a bit differently:

 * Drivers that only support the DRM_FORMAT_MOD_LINEAR modifier support may set
 * @format_modifiers to NULL. The plane will advertise the linear modifier.

As fb_modifiers_not_supported is only for a few legacy drivers, I
wouldn't even mention it here, it would only obfuscate things.

>   *
>   * Returns:
>   * Zero on success, error code on failure.
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 0c1102dc4d88..cad641b1f797 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -803,6 +803,9 @@ void *__drmm_universal_plane_alloc(struct drm_device *dev,
>   *
>   * The @drm_plane_funcs.destroy hook must be NULL.
>   *
> + * For drivers supporting modifiers, all planes will advertise
> + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.

Same here.

With these small issues addressed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> + *
>   * Returns:
>   * Pointer to new plane, or ERR_PTR on failure.
>   */

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout
@ 2022-01-23 22:37     ` Laurent Pinchart
  0 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:37 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Simon Ser, Alex Deucher,
	Damian Hobson-Garcia, Christian König

Hello Esaki-san,

Thank you for the patch.

On Fri, Jan 14, 2022 at 07:17:52PM +0900, Tomohito Esaki wrote:
> The LINEAR modifier is advertised as default if a driver doesn't specify
> modifiers.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/drm_plane.c | 15 ++++++++++++---
>  include/drm/drm_plane.h     |  3 +++
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index deeec60a3315..5aa7e241971e 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -237,6 +237,10 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  				      const char *name, va_list ap)
>  {
>  	struct drm_mode_config *config = &dev->mode_config;
> +	const uint64_t default_modifiers[] = {

This can be static.

> +		DRM_FORMAT_MOD_LINEAR,
> +		DRM_FORMAT_MOD_INVALID

No need for a terminator here. The terminator is needed in the
format_modifiers array passed to this function, to count the number of
elements, but the default_modifiers is used with a hard-coded count.

> +	};
>  	unsigned int format_modifier_count = 0;
>  	int ret;
>  
> @@ -277,6 +281,11 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  
>  		while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
>  			format_modifier_count++;
> +	} else {
> +		if (!dev->mode_config.fb_modifiers_not_supported) {
> +			format_modifiers = default_modifiers;
> +			format_modifier_count = 1;

You can use

			format_modifier_count = ARRAY_SIZE(default_modifiers);

> +		}
>  	}
>  
>  	/* autoset the cap and check for consistency across all planes */
> @@ -341,7 +350,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		drm_object_attach_property(&plane->base, config->prop_src_h, 0);
>  	}
>  
> -	if (config->allow_fb_modifiers)
> +	if (format_modifier_count)
>  		create_in_format_blob(dev, plane);
>  
>  	return 0;
> @@ -368,8 +377,8 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>   * drm_universal_plane_init() to let the DRM managed resource infrastructure
>   * take care of cleanup and deallocation.
>   *
> - * Drivers supporting modifiers must set @format_modifiers on all their planes,
> - * even those that only support DRM_FORMAT_MOD_LINEAR.
> + * For drivers supporting modifiers, all planes will advertise
> + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.

I'd write this a bit differently:

 * Drivers that only support the DRM_FORMAT_MOD_LINEAR modifier support may set
 * @format_modifiers to NULL. The plane will advertise the linear modifier.

As fb_modifiers_not_supported is only for a few legacy drivers, I
wouldn't even mention it here, it would only obfuscate things.

>   *
>   * Returns:
>   * Zero on success, error code on failure.
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 0c1102dc4d88..cad641b1f797 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -803,6 +803,9 @@ void *__drmm_universal_plane_alloc(struct drm_device *dev,
>   *
>   * The @drm_plane_funcs.destroy hook must be NULL.
>   *
> + * For drivers supporting modifiers, all planes will advertise
> + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set.

Same here.

With these small issues addressed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> + *
>   * Returns:
>   * Pointer to new plane, or ERR_PTR on failure.
>   */

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers
  2022-01-14 10:17   ` Tomohito Esaki
  (?)
  (?)
@ 2022-01-23 22:44     ` Laurent Pinchart
  -1 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:44 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: dri-devel, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Andy Shevchenko, Petr Mladek, Sakari Ailus, Lee Jones,
	Abhinav Kumar, Dmitry Baryshkov, Rob Clark, amd-gfx,
	linux-kernel, nouveau, Daniel Stone, Damian Hobson-Garcia,
	Takanari Hayama

Hello Esaki-san,

Thank you for the patch.

On Fri, Jan 14, 2022 at 07:17:53PM +0900, Tomohito Esaki wrote:
> The allow_fb_modifiers flag is unnecessary since it has been replaced
> with cannot_support_modifiers flag.

The new flag is fb_modifiers_not_supported, not
cannot_support_modifiers.

> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/drm_plane.c                      |  9 ---------
>  drivers/gpu/drm/selftests/test-drm_framebuffer.c |  1 -
>  include/drm/drm_mode_config.h                    | 16 ----------------
>  3 files changed, 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 5aa7e241971e..89a3d044ab59 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -288,15 +288,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		}
>  	}
>  
> -	/* autoset the cap and check for consistency across all planes */
> -	if (format_modifier_count) {
> -		drm_WARN_ON(dev, !config->allow_fb_modifiers &&
> -			    !list_empty(&config->plane_list));
> -		config->allow_fb_modifiers = true;
> -	} else {
> -		drm_WARN_ON(dev, config->allow_fb_modifiers);
> -	}
> -

Shouldn't we keep a sanity check to ensure that drivers setting
fb_modifiers_not_supported do not pass modifiers ?

	drm_WARN_ON(dev, config->fb_modifiers_not_supported &&
		    format_modifier_count);

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  	plane->modifier_count = format_modifier_count;
>  	plane->modifiers = kmalloc_array(format_modifier_count,
>  					 sizeof(format_modifiers[0]),
> diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> index 61b44d3a6a61..f6d66285c5fc 100644
> --- a/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> +++ b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> @@ -323,7 +323,6 @@ static struct drm_device mock_drm_device = {
>  		.max_width = MAX_WIDTH,
>  		.min_height = MIN_HEIGHT,
>  		.max_height = MAX_HEIGHT,
> -		.allow_fb_modifiers = true,
>  		.funcs = &mock_config_funcs,
>  	},
>  };
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index da82f45351c7..5001bda9f9af 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -917,22 +917,6 @@ struct drm_mode_config {
>  	 */
>  	bool async_page_flip;
>  
> -	/**
> -	 * @allow_fb_modifiers:
> -	 *
> -	 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call.
> -	 * Note that drivers should not set this directly, it is automatically
> -	 * set in drm_universal_plane_init().
> -	 *
> -	 * IMPORTANT:
> -	 *
> -	 * If this is set the driver must fill out the full implicit modifier
> -	 * information in their &drm_mode_config_funcs.fb_create hook for legacy
> -	 * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is
> -	 * broken for modifier aware userspace.
> -	 */
> -	bool allow_fb_modifiers;
> -
>  	/**
>  	 * @fb_modifiers_not_supported:
>  	 *

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers
@ 2022-01-23 22:44     ` Laurent Pinchart
  0 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:44 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Simon Ser, Alex Deucher, Damian Hobson-Garcia,
	Christian König

Hello Esaki-san,

Thank you for the patch.

On Fri, Jan 14, 2022 at 07:17:53PM +0900, Tomohito Esaki wrote:
> The allow_fb_modifiers flag is unnecessary since it has been replaced
> with cannot_support_modifiers flag.

The new flag is fb_modifiers_not_supported, not
cannot_support_modifiers.

> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/drm_plane.c                      |  9 ---------
>  drivers/gpu/drm/selftests/test-drm_framebuffer.c |  1 -
>  include/drm/drm_mode_config.h                    | 16 ----------------
>  3 files changed, 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 5aa7e241971e..89a3d044ab59 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -288,15 +288,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		}
>  	}
>  
> -	/* autoset the cap and check for consistency across all planes */
> -	if (format_modifier_count) {
> -		drm_WARN_ON(dev, !config->allow_fb_modifiers &&
> -			    !list_empty(&config->plane_list));
> -		config->allow_fb_modifiers = true;
> -	} else {
> -		drm_WARN_ON(dev, config->allow_fb_modifiers);
> -	}
> -

Shouldn't we keep a sanity check to ensure that drivers setting
fb_modifiers_not_supported do not pass modifiers ?

	drm_WARN_ON(dev, config->fb_modifiers_not_supported &&
		    format_modifier_count);

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  	plane->modifier_count = format_modifier_count;
>  	plane->modifiers = kmalloc_array(format_modifier_count,
>  					 sizeof(format_modifiers[0]),
> diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> index 61b44d3a6a61..f6d66285c5fc 100644
> --- a/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> +++ b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> @@ -323,7 +323,6 @@ static struct drm_device mock_drm_device = {
>  		.max_width = MAX_WIDTH,
>  		.min_height = MIN_HEIGHT,
>  		.max_height = MAX_HEIGHT,
> -		.allow_fb_modifiers = true,
>  		.funcs = &mock_config_funcs,
>  	},
>  };
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index da82f45351c7..5001bda9f9af 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -917,22 +917,6 @@ struct drm_mode_config {
>  	 */
>  	bool async_page_flip;
>  
> -	/**
> -	 * @allow_fb_modifiers:
> -	 *
> -	 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call.
> -	 * Note that drivers should not set this directly, it is automatically
> -	 * set in drm_universal_plane_init().
> -	 *
> -	 * IMPORTANT:
> -	 *
> -	 * If this is set the driver must fill out the full implicit modifier
> -	 * information in their &drm_mode_config_funcs.fb_create hook for legacy
> -	 * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is
> -	 * broken for modifier aware userspace.
> -	 */
> -	bool allow_fb_modifiers;
> -
>  	/**
>  	 * @fb_modifiers_not_supported:
>  	 *

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers
@ 2022-01-23 22:44     ` Laurent Pinchart
  0 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:44 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Rob Clark, Evan Quan, amd-gfx, Ben Skeggs, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Dmitry Baryshkov, Takanari Hayama,
	Sean Paul, Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan,
	Xinhui, linux-kernel, Thomas Zimmermann, Alex Deucher,
	Damian Hobson-Garcia, Christian König

Hello Esaki-san,

Thank you for the patch.

On Fri, Jan 14, 2022 at 07:17:53PM +0900, Tomohito Esaki wrote:
> The allow_fb_modifiers flag is unnecessary since it has been replaced
> with cannot_support_modifiers flag.

The new flag is fb_modifiers_not_supported, not
cannot_support_modifiers.

> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/drm_plane.c                      |  9 ---------
>  drivers/gpu/drm/selftests/test-drm_framebuffer.c |  1 -
>  include/drm/drm_mode_config.h                    | 16 ----------------
>  3 files changed, 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 5aa7e241971e..89a3d044ab59 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -288,15 +288,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		}
>  	}
>  
> -	/* autoset the cap and check for consistency across all planes */
> -	if (format_modifier_count) {
> -		drm_WARN_ON(dev, !config->allow_fb_modifiers &&
> -			    !list_empty(&config->plane_list));
> -		config->allow_fb_modifiers = true;
> -	} else {
> -		drm_WARN_ON(dev, config->allow_fb_modifiers);
> -	}
> -

Shouldn't we keep a sanity check to ensure that drivers setting
fb_modifiers_not_supported do not pass modifiers ?

	drm_WARN_ON(dev, config->fb_modifiers_not_supported &&
		    format_modifier_count);

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  	plane->modifier_count = format_modifier_count;
>  	plane->modifiers = kmalloc_array(format_modifier_count,
>  					 sizeof(format_modifiers[0]),
> diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> index 61b44d3a6a61..f6d66285c5fc 100644
> --- a/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> +++ b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> @@ -323,7 +323,6 @@ static struct drm_device mock_drm_device = {
>  		.max_width = MAX_WIDTH,
>  		.min_height = MIN_HEIGHT,
>  		.max_height = MAX_HEIGHT,
> -		.allow_fb_modifiers = true,
>  		.funcs = &mock_config_funcs,
>  	},
>  };
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index da82f45351c7..5001bda9f9af 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -917,22 +917,6 @@ struct drm_mode_config {
>  	 */
>  	bool async_page_flip;
>  
> -	/**
> -	 * @allow_fb_modifiers:
> -	 *
> -	 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call.
> -	 * Note that drivers should not set this directly, it is automatically
> -	 * set in drm_universal_plane_init().
> -	 *
> -	 * IMPORTANT:
> -	 *
> -	 * If this is set the driver must fill out the full implicit modifier
> -	 * information in their &drm_mode_config_funcs.fb_create hook for legacy
> -	 * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is
> -	 * broken for modifier aware userspace.
> -	 */
> -	bool allow_fb_modifiers;
> -
>  	/**
>  	 * @fb_modifiers_not_supported:
>  	 *

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers
@ 2022-01-23 22:44     ` Laurent Pinchart
  0 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:44 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Simon Ser, Alex Deucher,
	Damian Hobson-Garcia, Christian König

Hello Esaki-san,

Thank you for the patch.

On Fri, Jan 14, 2022 at 07:17:53PM +0900, Tomohito Esaki wrote:
> The allow_fb_modifiers flag is unnecessary since it has been replaced
> with cannot_support_modifiers flag.

The new flag is fb_modifiers_not_supported, not
cannot_support_modifiers.

> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/drm_plane.c                      |  9 ---------
>  drivers/gpu/drm/selftests/test-drm_framebuffer.c |  1 -
>  include/drm/drm_mode_config.h                    | 16 ----------------
>  3 files changed, 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 5aa7e241971e..89a3d044ab59 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -288,15 +288,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		}
>  	}
>  
> -	/* autoset the cap and check for consistency across all planes */
> -	if (format_modifier_count) {
> -		drm_WARN_ON(dev, !config->allow_fb_modifiers &&
> -			    !list_empty(&config->plane_list));
> -		config->allow_fb_modifiers = true;
> -	} else {
> -		drm_WARN_ON(dev, config->allow_fb_modifiers);
> -	}
> -

Shouldn't we keep a sanity check to ensure that drivers setting
fb_modifiers_not_supported do not pass modifiers ?

	drm_WARN_ON(dev, config->fb_modifiers_not_supported &&
		    format_modifier_count);

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  	plane->modifier_count = format_modifier_count;
>  	plane->modifiers = kmalloc_array(format_modifier_count,
>  					 sizeof(format_modifiers[0]),
> diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> index 61b44d3a6a61..f6d66285c5fc 100644
> --- a/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> +++ b/drivers/gpu/drm/selftests/test-drm_framebuffer.c
> @@ -323,7 +323,6 @@ static struct drm_device mock_drm_device = {
>  		.max_width = MAX_WIDTH,
>  		.min_height = MIN_HEIGHT,
>  		.max_height = MAX_HEIGHT,
> -		.allow_fb_modifiers = true,
>  		.funcs = &mock_config_funcs,
>  	},
>  };
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index da82f45351c7..5001bda9f9af 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -917,22 +917,6 @@ struct drm_mode_config {
>  	 */
>  	bool async_page_flip;
>  
> -	/**
> -	 * @allow_fb_modifiers:
> -	 *
> -	 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call.
> -	 * Note that drivers should not set this directly, it is automatically
> -	 * set in drm_universal_plane_init().
> -	 *
> -	 * IMPORTANT:
> -	 *
> -	 * If this is set the driver must fill out the full implicit modifier
> -	 * information in their &drm_mode_config_funcs.fb_create hook for legacy
> -	 * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is
> -	 * broken for modifier aware userspace.
> -	 */
> -	bool allow_fb_modifiers;
> -
>  	/**
>  	 * @fb_modifiers_not_supported:
>  	 *

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
  2022-01-14 10:17   ` Tomohito Esaki
  (?)
  (?)
@ 2022-01-23 22:50     ` Laurent Pinchart
  -1 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:50 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: dri-devel, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Andy Shevchenko, Petr Mladek, Sakari Ailus, Lee Jones,
	Abhinav Kumar, Dmitry Baryshkov, Rob Clark, amd-gfx,
	linux-kernel, nouveau, Daniel Stone, Damian Hobson-Garcia,
	Takanari Hayama

Hello Esaki-san,

On Fri, Jan 14, 2022 at 07:17:51PM +0900, Tomohito Esaki wrote:
> If only linear modifier is advertised, since there are many drivers that
> only linear supported, the DRM core should handle this rather than
> open-coding in every driver. However, there are legacy drivers such as
> radeon that do not support modifiers but infer the actual layout of the
> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
> introduced for these legacy drivers, and allow_fb_modifiers is replaced
> with this new flag.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>  drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>  drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>  drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>  include/drm/drm_mode_config.h                     | 10 ++++++++++
>  11 files changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 82011e75ed85..edbb30d47b8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>  	int ret;
>  	unsigned int i, block_width, block_height, block_size_log2;
>  
> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>  		return 0;
>  
>  	for (i = 0; i < format_info->num_planes; ++i) {
> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> -	if (!dev->mode_config.allow_fb_modifiers) {
> +	if (dev->mode_config.fb_modifiers_not_supported) {
>  		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>  			      "GFX9+ requires FB check based on format modifier\n");
>  		ret = check_tiling_flags_gfx6(rfb);
> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  			return ret;
>  	}
>  
> -	if (dev->mode_config.allow_fb_modifiers &&
> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>  	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>  		ret = convert_tiling_flags_to_modifier(rfb);
>  		if (ret) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index d1570a462a51..fb61c0814115 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 18a7b3bd633b..17942a11366d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index c7803dc2b2d5..2ec99ec8e1a3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.max_height = 16384;
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 8318ee8339f1..de11fbe5aba2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 2f0b14f8f833..61cb41766fae 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  	if (res)
>  		return res;
>  
> +	if (modifiers == NULL)
> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>  				       &dm_plane_funcs, formats, num_formats,
>  				       modifiers, plane->type, NULL);
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 07f5abc875e9..4562a8b86579 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>  	}
>  
>  	if (r->flags & DRM_MODE_FB_MODIFIERS &&
> -	    !dev->mode_config.allow_fb_modifiers) {
> +	    dev->mode_config.fb_modifiers_not_supported) {
>  		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	r->pixel_format = fb->format->format;
>  
>  	r->flags = 0;
> -	if (dev->mode_config.allow_fb_modifiers)
> +	if (!dev->mode_config.fb_modifiers_not_supported)
>  		r->flags |= DRM_MODE_FB_MODIFIERS;
>  
>  	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	for (i = 0; i < fb->format->num_planes; i++) {
>  		r->pitches[i] = fb->pitches[i];
>  		r->offsets[i] = fb->offsets[i];
> -		if (dev->mode_config.allow_fb_modifiers)
> +		if (!dev->mode_config.fb_modifiers_not_supported)
>  			r->modifier[i] = fb->modifier;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8b8744dcf691..51fcf1298023 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  			req->value = 64;
>  		break;
>  	case DRM_CAP_ADDFB2_MODIFIERS:
> -		req->value = dev->mode_config.allow_fb_modifiers;
> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>  		break;
>  	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>  		req->value = 1;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 2b460835a438..2cd0932b3d68 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>  				     &disp->disp);
>  		if (ret == 0) {
>  			nouveau_display_create_properties(dev);
> -			if (disp->disp.object.oclass < NV50_DISP)
> +			if (disp->disp.object.oclass < NV50_DISP) {
> +				dev->mode_config.fb_modifiers_not_supported = true;
>  				ret = nv04_display_create(dev);
> -			else
> +			} else {
>  				ret = nv50_display_create(dev);
> +			}
>  		}
>  	} else {
>  		ret = 0;
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 573154268d43..b9a07677a71e 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>  	rdev->ddev->mode_config.preferred_depth = 24;
>  	rdev->ddev->mode_config.prefer_shadow = 1;
>  
> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
> +
>  	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>  
>  	ret = radeon_modeset_create_props(rdev);
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 91ca575a78de..da82f45351c7 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -933,6 +933,16 @@ struct drm_mode_config {
>  	 */
>  	bool allow_fb_modifiers;
>  
> +	/**
> +	 * @fb_modifiers_not_supported:
> +	 *
> +	 * This flag is for legacy drivers such as radeon that do not support
> +	 * modifiers but infer the actual layout of the underlying buffer.
> +	 * Generally, each drivers must support modifiers, this flag should not
> +	 * be set.

I'd write it a bit differently, to explain what the flag does:

	 * When this flag is set, the DRM device will not expose modifier
	 * support to userspace. This is only used by legacy drivers (such as
	 * radeon) that infer the buffer layout through heuristics without using
	 * modifiers. New drivers shall not set fhis flag.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +	 */
> +	bool fb_modifiers_not_supported;
> +
>  	/**
>  	 * @normalize_zpos:
>  	 *

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-23 22:50     ` Laurent Pinchart
  0 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:50 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Simon Ser, Alex Deucher, Damian Hobson-Garcia,
	Christian König

Hello Esaki-san,

On Fri, Jan 14, 2022 at 07:17:51PM +0900, Tomohito Esaki wrote:
> If only linear modifier is advertised, since there are many drivers that
> only linear supported, the DRM core should handle this rather than
> open-coding in every driver. However, there are legacy drivers such as
> radeon that do not support modifiers but infer the actual layout of the
> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
> introduced for these legacy drivers, and allow_fb_modifiers is replaced
> with this new flag.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>  drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>  drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>  drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>  include/drm/drm_mode_config.h                     | 10 ++++++++++
>  11 files changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 82011e75ed85..edbb30d47b8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>  	int ret;
>  	unsigned int i, block_width, block_height, block_size_log2;
>  
> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>  		return 0;
>  
>  	for (i = 0; i < format_info->num_planes; ++i) {
> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> -	if (!dev->mode_config.allow_fb_modifiers) {
> +	if (dev->mode_config.fb_modifiers_not_supported) {
>  		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>  			      "GFX9+ requires FB check based on format modifier\n");
>  		ret = check_tiling_flags_gfx6(rfb);
> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  			return ret;
>  	}
>  
> -	if (dev->mode_config.allow_fb_modifiers &&
> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>  	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>  		ret = convert_tiling_flags_to_modifier(rfb);
>  		if (ret) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index d1570a462a51..fb61c0814115 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 18a7b3bd633b..17942a11366d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index c7803dc2b2d5..2ec99ec8e1a3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.max_height = 16384;
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 8318ee8339f1..de11fbe5aba2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 2f0b14f8f833..61cb41766fae 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  	if (res)
>  		return res;
>  
> +	if (modifiers == NULL)
> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>  				       &dm_plane_funcs, formats, num_formats,
>  				       modifiers, plane->type, NULL);
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 07f5abc875e9..4562a8b86579 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>  	}
>  
>  	if (r->flags & DRM_MODE_FB_MODIFIERS &&
> -	    !dev->mode_config.allow_fb_modifiers) {
> +	    dev->mode_config.fb_modifiers_not_supported) {
>  		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	r->pixel_format = fb->format->format;
>  
>  	r->flags = 0;
> -	if (dev->mode_config.allow_fb_modifiers)
> +	if (!dev->mode_config.fb_modifiers_not_supported)
>  		r->flags |= DRM_MODE_FB_MODIFIERS;
>  
>  	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	for (i = 0; i < fb->format->num_planes; i++) {
>  		r->pitches[i] = fb->pitches[i];
>  		r->offsets[i] = fb->offsets[i];
> -		if (dev->mode_config.allow_fb_modifiers)
> +		if (!dev->mode_config.fb_modifiers_not_supported)
>  			r->modifier[i] = fb->modifier;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8b8744dcf691..51fcf1298023 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  			req->value = 64;
>  		break;
>  	case DRM_CAP_ADDFB2_MODIFIERS:
> -		req->value = dev->mode_config.allow_fb_modifiers;
> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>  		break;
>  	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>  		req->value = 1;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 2b460835a438..2cd0932b3d68 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>  				     &disp->disp);
>  		if (ret == 0) {
>  			nouveau_display_create_properties(dev);
> -			if (disp->disp.object.oclass < NV50_DISP)
> +			if (disp->disp.object.oclass < NV50_DISP) {
> +				dev->mode_config.fb_modifiers_not_supported = true;
>  				ret = nv04_display_create(dev);
> -			else
> +			} else {
>  				ret = nv50_display_create(dev);
> +			}
>  		}
>  	} else {
>  		ret = 0;
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 573154268d43..b9a07677a71e 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>  	rdev->ddev->mode_config.preferred_depth = 24;
>  	rdev->ddev->mode_config.prefer_shadow = 1;
>  
> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
> +
>  	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>  
>  	ret = radeon_modeset_create_props(rdev);
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 91ca575a78de..da82f45351c7 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -933,6 +933,16 @@ struct drm_mode_config {
>  	 */
>  	bool allow_fb_modifiers;
>  
> +	/**
> +	 * @fb_modifiers_not_supported:
> +	 *
> +	 * This flag is for legacy drivers such as radeon that do not support
> +	 * modifiers but infer the actual layout of the underlying buffer.
> +	 * Generally, each drivers must support modifiers, this flag should not
> +	 * be set.

I'd write it a bit differently, to explain what the flag does:

	 * When this flag is set, the DRM device will not expose modifier
	 * support to userspace. This is only used by legacy drivers (such as
	 * radeon) that infer the buffer layout through heuristics without using
	 * modifiers. New drivers shall not set fhis flag.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +	 */
> +	bool fb_modifiers_not_supported;
> +
>  	/**
>  	 * @normalize_zpos:
>  	 *

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-23 22:50     ` Laurent Pinchart
  0 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:50 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Rob Clark, Evan Quan, amd-gfx, Ben Skeggs, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Dmitry Baryshkov, Takanari Hayama,
	Sean Paul, Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan,
	Xinhui, linux-kernel, Thomas Zimmermann, Alex Deucher,
	Damian Hobson-Garcia, Christian König

Hello Esaki-san,

On Fri, Jan 14, 2022 at 07:17:51PM +0900, Tomohito Esaki wrote:
> If only linear modifier is advertised, since there are many drivers that
> only linear supported, the DRM core should handle this rather than
> open-coding in every driver. However, there are legacy drivers such as
> radeon that do not support modifiers but infer the actual layout of the
> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
> introduced for these legacy drivers, and allow_fb_modifiers is replaced
> with this new flag.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>  drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>  drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>  drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>  include/drm/drm_mode_config.h                     | 10 ++++++++++
>  11 files changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 82011e75ed85..edbb30d47b8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>  	int ret;
>  	unsigned int i, block_width, block_height, block_size_log2;
>  
> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>  		return 0;
>  
>  	for (i = 0; i < format_info->num_planes; ++i) {
> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> -	if (!dev->mode_config.allow_fb_modifiers) {
> +	if (dev->mode_config.fb_modifiers_not_supported) {
>  		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>  			      "GFX9+ requires FB check based on format modifier\n");
>  		ret = check_tiling_flags_gfx6(rfb);
> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  			return ret;
>  	}
>  
> -	if (dev->mode_config.allow_fb_modifiers &&
> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>  	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>  		ret = convert_tiling_flags_to_modifier(rfb);
>  		if (ret) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index d1570a462a51..fb61c0814115 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 18a7b3bd633b..17942a11366d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index c7803dc2b2d5..2ec99ec8e1a3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.max_height = 16384;
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 8318ee8339f1..de11fbe5aba2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 2f0b14f8f833..61cb41766fae 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  	if (res)
>  		return res;
>  
> +	if (modifiers == NULL)
> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>  				       &dm_plane_funcs, formats, num_formats,
>  				       modifiers, plane->type, NULL);
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 07f5abc875e9..4562a8b86579 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>  	}
>  
>  	if (r->flags & DRM_MODE_FB_MODIFIERS &&
> -	    !dev->mode_config.allow_fb_modifiers) {
> +	    dev->mode_config.fb_modifiers_not_supported) {
>  		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	r->pixel_format = fb->format->format;
>  
>  	r->flags = 0;
> -	if (dev->mode_config.allow_fb_modifiers)
> +	if (!dev->mode_config.fb_modifiers_not_supported)
>  		r->flags |= DRM_MODE_FB_MODIFIERS;
>  
>  	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	for (i = 0; i < fb->format->num_planes; i++) {
>  		r->pitches[i] = fb->pitches[i];
>  		r->offsets[i] = fb->offsets[i];
> -		if (dev->mode_config.allow_fb_modifiers)
> +		if (!dev->mode_config.fb_modifiers_not_supported)
>  			r->modifier[i] = fb->modifier;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8b8744dcf691..51fcf1298023 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  			req->value = 64;
>  		break;
>  	case DRM_CAP_ADDFB2_MODIFIERS:
> -		req->value = dev->mode_config.allow_fb_modifiers;
> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>  		break;
>  	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>  		req->value = 1;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 2b460835a438..2cd0932b3d68 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>  				     &disp->disp);
>  		if (ret == 0) {
>  			nouveau_display_create_properties(dev);
> -			if (disp->disp.object.oclass < NV50_DISP)
> +			if (disp->disp.object.oclass < NV50_DISP) {
> +				dev->mode_config.fb_modifiers_not_supported = true;
>  				ret = nv04_display_create(dev);
> -			else
> +			} else {
>  				ret = nv50_display_create(dev);
> +			}
>  		}
>  	} else {
>  		ret = 0;
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 573154268d43..b9a07677a71e 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>  	rdev->ddev->mode_config.preferred_depth = 24;
>  	rdev->ddev->mode_config.prefer_shadow = 1;
>  
> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
> +
>  	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>  
>  	ret = radeon_modeset_create_props(rdev);
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 91ca575a78de..da82f45351c7 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -933,6 +933,16 @@ struct drm_mode_config {
>  	 */
>  	bool allow_fb_modifiers;
>  
> +	/**
> +	 * @fb_modifiers_not_supported:
> +	 *
> +	 * This flag is for legacy drivers such as radeon that do not support
> +	 * modifiers but infer the actual layout of the underlying buffer.
> +	 * Generally, each drivers must support modifiers, this flag should not
> +	 * be set.

I'd write it a bit differently, to explain what the flag does:

	 * When this flag is set, the DRM device will not expose modifier
	 * support to userspace. This is only used by legacy drivers (such as
	 * radeon) that infer the buffer layout through heuristics without using
	 * modifiers. New drivers shall not set fhis flag.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +	 */
> +	bool fb_modifiers_not_supported;
> +
>  	/**
>  	 * @normalize_zpos:
>  	 *

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-23 22:50     ` Laurent Pinchart
  0 siblings, 0 replies; 72+ messages in thread
From: Laurent Pinchart @ 2022-01-23 22:50 UTC (permalink / raw)
  To: Tomohito Esaki
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Simon Ser, Alex Deucher,
	Damian Hobson-Garcia, Christian König

Hello Esaki-san,

On Fri, Jan 14, 2022 at 07:17:51PM +0900, Tomohito Esaki wrote:
> If only linear modifier is advertised, since there are many drivers that
> only linear supported, the DRM core should handle this rather than
> open-coding in every driver. However, there are legacy drivers such as
> radeon that do not support modifiers but infer the actual layout of the
> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
> introduced for these legacy drivers, and allow_fb_modifiers is replaced
> with this new flag.
> 
> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>  drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>  drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>  drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>  include/drm/drm_mode_config.h                     | 10 ++++++++++
>  11 files changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 82011e75ed85..edbb30d47b8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>  	int ret;
>  	unsigned int i, block_width, block_height, block_size_log2;
>  
> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>  		return 0;
>  
>  	for (i = 0; i < format_info->num_planes; ++i) {
> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> -	if (!dev->mode_config.allow_fb_modifiers) {
> +	if (dev->mode_config.fb_modifiers_not_supported) {
>  		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>  			      "GFX9+ requires FB check based on format modifier\n");
>  		ret = check_tiling_flags_gfx6(rfb);
> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>  			return ret;
>  	}
>  
> -	if (dev->mode_config.allow_fb_modifiers &&
> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>  	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>  		ret = convert_tiling_flags_to_modifier(rfb);
>  		if (ret) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index d1570a462a51..fb61c0814115 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 18a7b3bd633b..17942a11366d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index c7803dc2b2d5..2ec99ec8e1a3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.max_height = 16384;
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 8318ee8339f1..de11fbe5aba2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>  	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>  	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>  
> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>  
>  	r = amdgpu_display_modeset_create_props(adev);
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 2f0b14f8f833..61cb41766fae 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  	if (res)
>  		return res;
>  
> +	if (modifiers == NULL)
> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
> +
>  	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>  				       &dm_plane_funcs, formats, num_formats,
>  				       modifiers, plane->type, NULL);
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 07f5abc875e9..4562a8b86579 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>  	}
>  
>  	if (r->flags & DRM_MODE_FB_MODIFIERS &&
> -	    !dev->mode_config.allow_fb_modifiers) {
> +	    dev->mode_config.fb_modifiers_not_supported) {
>  		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	r->pixel_format = fb->format->format;
>  
>  	r->flags = 0;
> -	if (dev->mode_config.allow_fb_modifiers)
> +	if (!dev->mode_config.fb_modifiers_not_supported)
>  		r->flags |= DRM_MODE_FB_MODIFIERS;
>  
>  	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  	for (i = 0; i < fb->format->num_planes; i++) {
>  		r->pitches[i] = fb->pitches[i];
>  		r->offsets[i] = fb->offsets[i];
> -		if (dev->mode_config.allow_fb_modifiers)
> +		if (!dev->mode_config.fb_modifiers_not_supported)
>  			r->modifier[i] = fb->modifier;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8b8744dcf691..51fcf1298023 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  			req->value = 64;
>  		break;
>  	case DRM_CAP_ADDFB2_MODIFIERS:
> -		req->value = dev->mode_config.allow_fb_modifiers;
> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>  		break;
>  	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>  		req->value = 1;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 2b460835a438..2cd0932b3d68 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>  				     &disp->disp);
>  		if (ret == 0) {
>  			nouveau_display_create_properties(dev);
> -			if (disp->disp.object.oclass < NV50_DISP)
> +			if (disp->disp.object.oclass < NV50_DISP) {
> +				dev->mode_config.fb_modifiers_not_supported = true;
>  				ret = nv04_display_create(dev);
> -			else
> +			} else {
>  				ret = nv50_display_create(dev);
> +			}
>  		}
>  	} else {
>  		ret = 0;
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 573154268d43..b9a07677a71e 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>  	rdev->ddev->mode_config.preferred_depth = 24;
>  	rdev->ddev->mode_config.prefer_shadow = 1;
>  
> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
> +
>  	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>  
>  	ret = radeon_modeset_create_props(rdev);
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 91ca575a78de..da82f45351c7 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -933,6 +933,16 @@ struct drm_mode_config {
>  	 */
>  	bool allow_fb_modifiers;
>  
> +	/**
> +	 * @fb_modifiers_not_supported:
> +	 *
> +	 * This flag is for legacy drivers such as radeon that do not support
> +	 * modifiers but infer the actual layout of the underlying buffer.
> +	 * Generally, each drivers must support modifiers, this flag should not
> +	 * be set.

I'd write it a bit differently, to explain what the flag does:

	 * When this flag is set, the DRM device will not expose modifier
	 * support to userspace. This is only used by legacy drivers (such as
	 * radeon) that infer the buffer layout through heuristics without using
	 * modifiers. New drivers shall not set fhis flag.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +	 */
> +	bool fb_modifiers_not_supported;
> +
>  	/**
>  	 * @normalize_zpos:
>  	 *

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
  2022-01-23 22:50     ` [Nouveau] " Laurent Pinchart
  (?)
  (?)
@ 2022-01-25  5:19       ` Esaki Tomohito
  -1 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-25  5:19 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer, Lee Jones,
	Rob Clark, Evan Quan, amd-gfx, Ben Skeggs, Petr Mladek,
	Sakari Ailus, Abhinav Kumar, Dmitry Baryshkov, Takanari Hayama,
	Sean Paul, Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan,
	Xinhui, linux-kernel, Thomas Zimmermann, Alex Deucher,
	Damian Hobson-Garcia, Christian König

Hello Laurent-san

Thank you for your reviews and advices.

I'll fix this patch series following your advice.

Thanks,
Esaki

On 2022/01/24 7:50, Laurent Pinchart wrote:
> Hello Esaki-san,
> 
> On Fri, Jan 14, 2022 at 07:17:51PM +0900, Tomohito Esaki wrote:
>> If only linear modifier is advertised, since there are many drivers that
>> only linear supported, the DRM core should handle this rather than
>> open-coding in every driver. However, there are legacy drivers such as
>> radeon that do not support modifiers but infer the actual layout of the
>> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
>> introduced for these legacy drivers, and allow_fb_modifiers is replaced
>> with this new flag.
>>
>> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>>   drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>>   drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>>   drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>   drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>>   drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>>   drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>>   drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>>   drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>>   include/drm/drm_mode_config.h                     | 10 ++++++++++
>>   11 files changed, 33 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 82011e75ed85..edbb30d47b8c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>>   	int ret;
>>   	unsigned int i, block_width, block_height, block_size_log2;
>>   
>> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
>> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>>   		return 0;
>>   
>>   	for (i = 0; i < format_info->num_planes; ++i) {
>> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>>   	if (ret)
>>   		return ret;
>>   
>> -	if (!dev->mode_config.allow_fb_modifiers) {
>> +	if (dev->mode_config.fb_modifiers_not_supported) {
>>   		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>>   			      "GFX9+ requires FB check based on format modifier\n");
>>   		ret = check_tiling_flags_gfx6(rfb);
>> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>>   			return ret;
>>   	}
>>   
>> -	if (dev->mode_config.allow_fb_modifiers &&
>> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>>   	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>>   		ret = convert_tiling_flags_to_modifier(rfb);
>>   		if (ret) {
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index d1570a462a51..fb61c0814115 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 18a7b3bd633b..17942a11366d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index c7803dc2b2d5..2ec99ec8e1a3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.max_height = 16384;
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index 8318ee8339f1..de11fbe5aba2 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 2f0b14f8f833..61cb41766fae 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>>   	if (res)
>>   		return res;
>>   
>> +	if (modifiers == NULL)
>> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>>   				       &dm_plane_funcs, formats, num_formats,
>>   				       modifiers, plane->type, NULL);
>> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
>> index 07f5abc875e9..4562a8b86579 100644
>> --- a/drivers/gpu/drm/drm_framebuffer.c
>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>>   	}
>>   
>>   	if (r->flags & DRM_MODE_FB_MODIFIERS &&
>> -	    !dev->mode_config.allow_fb_modifiers) {
>> +	    dev->mode_config.fb_modifiers_not_supported) {
>>   		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>>   		return ERR_PTR(-EINVAL);
>>   	}
>> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>>   	r->pixel_format = fb->format->format;
>>   
>>   	r->flags = 0;
>> -	if (dev->mode_config.allow_fb_modifiers)
>> +	if (!dev->mode_config.fb_modifiers_not_supported)
>>   		r->flags |= DRM_MODE_FB_MODIFIERS;
>>   
>>   	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
>> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>>   	for (i = 0; i < fb->format->num_planes; i++) {
>>   		r->pitches[i] = fb->pitches[i];
>>   		r->offsets[i] = fb->offsets[i];
>> -		if (dev->mode_config.allow_fb_modifiers)
>> +		if (!dev->mode_config.fb_modifiers_not_supported)
>>   			r->modifier[i] = fb->modifier;
>>   	}
>>   
>> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
>> index 8b8744dcf691..51fcf1298023 100644
>> --- a/drivers/gpu/drm/drm_ioctl.c
>> +++ b/drivers/gpu/drm/drm_ioctl.c
>> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>>   			req->value = 64;
>>   		break;
>>   	case DRM_CAP_ADDFB2_MODIFIERS:
>> -		req->value = dev->mode_config.allow_fb_modifiers;
>> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>>   		break;
>>   	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>>   		req->value = 1;
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
>> index 2b460835a438..2cd0932b3d68 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
>> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>>   				     &disp->disp);
>>   		if (ret == 0) {
>>   			nouveau_display_create_properties(dev);
>> -			if (disp->disp.object.oclass < NV50_DISP)
>> +			if (disp->disp.object.oclass < NV50_DISP) {
>> +				dev->mode_config.fb_modifiers_not_supported = true;
>>   				ret = nv04_display_create(dev);
>> -			else
>> +			} else {
>>   				ret = nv50_display_create(dev);
>> +			}
>>   		}
>>   	} else {
>>   		ret = 0;
>> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
>> index 573154268d43..b9a07677a71e 100644
>> --- a/drivers/gpu/drm/radeon/radeon_display.c
>> +++ b/drivers/gpu/drm/radeon/radeon_display.c
>> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>>   	rdev->ddev->mode_config.preferred_depth = 24;
>>   	rdev->ddev->mode_config.prefer_shadow = 1;
>>   
>> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>>   
>>   	ret = radeon_modeset_create_props(rdev);
>> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
>> index 91ca575a78de..da82f45351c7 100644
>> --- a/include/drm/drm_mode_config.h
>> +++ b/include/drm/drm_mode_config.h
>> @@ -933,6 +933,16 @@ struct drm_mode_config {
>>   	 */
>>   	bool allow_fb_modifiers;
>>   
>> +	/**
>> +	 * @fb_modifiers_not_supported:
>> +	 *
>> +	 * This flag is for legacy drivers such as radeon that do not support
>> +	 * modifiers but infer the actual layout of the underlying buffer.
>> +	 * Generally, each drivers must support modifiers, this flag should not
>> +	 * be set.
> 
> I'd write it a bit differently, to explain what the flag does:
> 
> 	 * When this flag is set, the DRM device will not expose modifier
> 	 * support to userspace. This is only used by legacy drivers (such as
> 	 * radeon) that infer the buffer layout through heuristics without using
> 	 * modifiers. New drivers shall not set fhis flag.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> +	 */
>> +	bool fb_modifiers_not_supported;
>> +
>>   	/**
>>   	 * @normalize_zpos:
>>   	 *
> 

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-25  5:19       ` Esaki Tomohito
  0 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-25  5:19 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Thomas Zimmermann, Simon Ser, Alex Deucher,
	Damian Hobson-Garcia, Christian König

Hello Laurent-san

Thank you for your reviews and advices.

I'll fix this patch series following your advice.

Thanks,
Esaki

On 2022/01/24 7:50, Laurent Pinchart wrote:
> Hello Esaki-san,
> 
> On Fri, Jan 14, 2022 at 07:17:51PM +0900, Tomohito Esaki wrote:
>> If only linear modifier is advertised, since there are many drivers that
>> only linear supported, the DRM core should handle this rather than
>> open-coding in every driver. However, there are legacy drivers such as
>> radeon that do not support modifiers but infer the actual layout of the
>> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
>> introduced for these legacy drivers, and allow_fb_modifiers is replaced
>> with this new flag.
>>
>> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>>   drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>>   drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>>   drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>   drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>>   drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>>   drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>>   drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>>   drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>>   include/drm/drm_mode_config.h                     | 10 ++++++++++
>>   11 files changed, 33 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 82011e75ed85..edbb30d47b8c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>>   	int ret;
>>   	unsigned int i, block_width, block_height, block_size_log2;
>>   
>> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
>> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>>   		return 0;
>>   
>>   	for (i = 0; i < format_info->num_planes; ++i) {
>> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>>   	if (ret)
>>   		return ret;
>>   
>> -	if (!dev->mode_config.allow_fb_modifiers) {
>> +	if (dev->mode_config.fb_modifiers_not_supported) {
>>   		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>>   			      "GFX9+ requires FB check based on format modifier\n");
>>   		ret = check_tiling_flags_gfx6(rfb);
>> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>>   			return ret;
>>   	}
>>   
>> -	if (dev->mode_config.allow_fb_modifiers &&
>> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>>   	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>>   		ret = convert_tiling_flags_to_modifier(rfb);
>>   		if (ret) {
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index d1570a462a51..fb61c0814115 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 18a7b3bd633b..17942a11366d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index c7803dc2b2d5..2ec99ec8e1a3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.max_height = 16384;
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index 8318ee8339f1..de11fbe5aba2 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 2f0b14f8f833..61cb41766fae 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>>   	if (res)
>>   		return res;
>>   
>> +	if (modifiers == NULL)
>> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>>   				       &dm_plane_funcs, formats, num_formats,
>>   				       modifiers, plane->type, NULL);
>> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
>> index 07f5abc875e9..4562a8b86579 100644
>> --- a/drivers/gpu/drm/drm_framebuffer.c
>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>>   	}
>>   
>>   	if (r->flags & DRM_MODE_FB_MODIFIERS &&
>> -	    !dev->mode_config.allow_fb_modifiers) {
>> +	    dev->mode_config.fb_modifiers_not_supported) {
>>   		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>>   		return ERR_PTR(-EINVAL);
>>   	}
>> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>>   	r->pixel_format = fb->format->format;
>>   
>>   	r->flags = 0;
>> -	if (dev->mode_config.allow_fb_modifiers)
>> +	if (!dev->mode_config.fb_modifiers_not_supported)
>>   		r->flags |= DRM_MODE_FB_MODIFIERS;
>>   
>>   	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
>> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>>   	for (i = 0; i < fb->format->num_planes; i++) {
>>   		r->pitches[i] = fb->pitches[i];
>>   		r->offsets[i] = fb->offsets[i];
>> -		if (dev->mode_config.allow_fb_modifiers)
>> +		if (!dev->mode_config.fb_modifiers_not_supported)
>>   			r->modifier[i] = fb->modifier;
>>   	}
>>   
>> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
>> index 8b8744dcf691..51fcf1298023 100644
>> --- a/drivers/gpu/drm/drm_ioctl.c
>> +++ b/drivers/gpu/drm/drm_ioctl.c
>> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>>   			req->value = 64;
>>   		break;
>>   	case DRM_CAP_ADDFB2_MODIFIERS:
>> -		req->value = dev->mode_config.allow_fb_modifiers;
>> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>>   		break;
>>   	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>>   		req->value = 1;
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
>> index 2b460835a438..2cd0932b3d68 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
>> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>>   				     &disp->disp);
>>   		if (ret == 0) {
>>   			nouveau_display_create_properties(dev);
>> -			if (disp->disp.object.oclass < NV50_DISP)
>> +			if (disp->disp.object.oclass < NV50_DISP) {
>> +				dev->mode_config.fb_modifiers_not_supported = true;
>>   				ret = nv04_display_create(dev);
>> -			else
>> +			} else {
>>   				ret = nv50_display_create(dev);
>> +			}
>>   		}
>>   	} else {
>>   		ret = 0;
>> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
>> index 573154268d43..b9a07677a71e 100644
>> --- a/drivers/gpu/drm/radeon/radeon_display.c
>> +++ b/drivers/gpu/drm/radeon/radeon_display.c
>> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>>   	rdev->ddev->mode_config.preferred_depth = 24;
>>   	rdev->ddev->mode_config.prefer_shadow = 1;
>>   
>> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>>   
>>   	ret = radeon_modeset_create_props(rdev);
>> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
>> index 91ca575a78de..da82f45351c7 100644
>> --- a/include/drm/drm_mode_config.h
>> +++ b/include/drm/drm_mode_config.h
>> @@ -933,6 +933,16 @@ struct drm_mode_config {
>>   	 */
>>   	bool allow_fb_modifiers;
>>   
>> +	/**
>> +	 * @fb_modifiers_not_supported:
>> +	 *
>> +	 * This flag is for legacy drivers such as radeon that do not support
>> +	 * modifiers but infer the actual layout of the underlying buffer.
>> +	 * Generally, each drivers must support modifiers, this flag should not
>> +	 * be set.
> 
> I'd write it a bit differently, to explain what the flag does:
> 
> 	 * When this flag is set, the DRM device will not expose modifier
> 	 * support to userspace. This is only used by legacy drivers (such as
> 	 * radeon) that infer the buffer layout through heuristics without using
> 	 * modifiers. New drivers shall not set fhis flag.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> +	 */
>> +	bool fb_modifiers_not_supported;
>> +
>>   	/**
>>   	 * @normalize_zpos:
>>   	 *
> 

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-25  5:19       ` Esaki Tomohito
  0 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-25  5:19 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: dri-devel, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Ben Skeggs, Michel Dänzer, Simon Ser,
	Qingqing Zhuo, Bas Nieuwenhuizen, Mark Yacoub, Sean Paul,
	Evan Quan, Andy Shevchenko, Petr Mladek, Sakari Ailus, Lee Jones,
	Abhinav Kumar, Dmitry Baryshkov, Rob Clark, amd-gfx,
	linux-kernel, nouveau, Daniel Stone, Damian Hobson-Garcia,
	Takanari Hayama

Hello Laurent-san

Thank you for your reviews and advices.

I'll fix this patch series following your advice.

Thanks,
Esaki

On 2022/01/24 7:50, Laurent Pinchart wrote:
> Hello Esaki-san,
> 
> On Fri, Jan 14, 2022 at 07:17:51PM +0900, Tomohito Esaki wrote:
>> If only linear modifier is advertised, since there are many drivers that
>> only linear supported, the DRM core should handle this rather than
>> open-coding in every driver. However, there are legacy drivers such as
>> radeon that do not support modifiers but infer the actual layout of the
>> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
>> introduced for these legacy drivers, and allow_fb_modifiers is replaced
>> with this new flag.
>>
>> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>>   drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>>   drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>>   drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>   drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>>   drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>>   drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>>   drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>>   drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>>   include/drm/drm_mode_config.h                     | 10 ++++++++++
>>   11 files changed, 33 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 82011e75ed85..edbb30d47b8c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>>   	int ret;
>>   	unsigned int i, block_width, block_height, block_size_log2;
>>   
>> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
>> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>>   		return 0;
>>   
>>   	for (i = 0; i < format_info->num_planes; ++i) {
>> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>>   	if (ret)
>>   		return ret;
>>   
>> -	if (!dev->mode_config.allow_fb_modifiers) {
>> +	if (dev->mode_config.fb_modifiers_not_supported) {
>>   		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>>   			      "GFX9+ requires FB check based on format modifier\n");
>>   		ret = check_tiling_flags_gfx6(rfb);
>> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>>   			return ret;
>>   	}
>>   
>> -	if (dev->mode_config.allow_fb_modifiers &&
>> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>>   	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>>   		ret = convert_tiling_flags_to_modifier(rfb);
>>   		if (ret) {
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index d1570a462a51..fb61c0814115 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 18a7b3bd633b..17942a11366d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index c7803dc2b2d5..2ec99ec8e1a3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.max_height = 16384;
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index 8318ee8339f1..de11fbe5aba2 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 2f0b14f8f833..61cb41766fae 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>>   	if (res)
>>   		return res;
>>   
>> +	if (modifiers == NULL)
>> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>>   				       &dm_plane_funcs, formats, num_formats,
>>   				       modifiers, plane->type, NULL);
>> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
>> index 07f5abc875e9..4562a8b86579 100644
>> --- a/drivers/gpu/drm/drm_framebuffer.c
>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>>   	}
>>   
>>   	if (r->flags & DRM_MODE_FB_MODIFIERS &&
>> -	    !dev->mode_config.allow_fb_modifiers) {
>> +	    dev->mode_config.fb_modifiers_not_supported) {
>>   		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>>   		return ERR_PTR(-EINVAL);
>>   	}
>> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>>   	r->pixel_format = fb->format->format;
>>   
>>   	r->flags = 0;
>> -	if (dev->mode_config.allow_fb_modifiers)
>> +	if (!dev->mode_config.fb_modifiers_not_supported)
>>   		r->flags |= DRM_MODE_FB_MODIFIERS;
>>   
>>   	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
>> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>>   	for (i = 0; i < fb->format->num_planes; i++) {
>>   		r->pitches[i] = fb->pitches[i];
>>   		r->offsets[i] = fb->offsets[i];
>> -		if (dev->mode_config.allow_fb_modifiers)
>> +		if (!dev->mode_config.fb_modifiers_not_supported)
>>   			r->modifier[i] = fb->modifier;
>>   	}
>>   
>> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
>> index 8b8744dcf691..51fcf1298023 100644
>> --- a/drivers/gpu/drm/drm_ioctl.c
>> +++ b/drivers/gpu/drm/drm_ioctl.c
>> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>>   			req->value = 64;
>>   		break;
>>   	case DRM_CAP_ADDFB2_MODIFIERS:
>> -		req->value = dev->mode_config.allow_fb_modifiers;
>> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>>   		break;
>>   	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>>   		req->value = 1;
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
>> index 2b460835a438..2cd0932b3d68 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
>> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>>   				     &disp->disp);
>>   		if (ret == 0) {
>>   			nouveau_display_create_properties(dev);
>> -			if (disp->disp.object.oclass < NV50_DISP)
>> +			if (disp->disp.object.oclass < NV50_DISP) {
>> +				dev->mode_config.fb_modifiers_not_supported = true;
>>   				ret = nv04_display_create(dev);
>> -			else
>> +			} else {
>>   				ret = nv50_display_create(dev);
>> +			}
>>   		}
>>   	} else {
>>   		ret = 0;
>> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
>> index 573154268d43..b9a07677a71e 100644
>> --- a/drivers/gpu/drm/radeon/radeon_display.c
>> +++ b/drivers/gpu/drm/radeon/radeon_display.c
>> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>>   	rdev->ddev->mode_config.preferred_depth = 24;
>>   	rdev->ddev->mode_config.prefer_shadow = 1;
>>   
>> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>>   
>>   	ret = radeon_modeset_create_props(rdev);
>> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
>> index 91ca575a78de..da82f45351c7 100644
>> --- a/include/drm/drm_mode_config.h
>> +++ b/include/drm/drm_mode_config.h
>> @@ -933,6 +933,16 @@ struct drm_mode_config {
>>   	 */
>>   	bool allow_fb_modifiers;
>>   
>> +	/**
>> +	 * @fb_modifiers_not_supported:
>> +	 *
>> +	 * This flag is for legacy drivers such as radeon that do not support
>> +	 * modifiers but infer the actual layout of the underlying buffer.
>> +	 * Generally, each drivers must support modifiers, this flag should not
>> +	 * be set.
> 
> I'd write it a bit differently, to explain what the flag does:
> 
> 	 * When this flag is set, the DRM device will not expose modifier
> 	 * support to userspace. This is only used by legacy drivers (such as
> 	 * radeon) that infer the buffer layout through heuristics without using
> 	 * modifiers. New drivers shall not set fhis flag.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> +	 */
>> +	bool fb_modifiers_not_supported;
>> +
>>   	/**
>>   	 * @normalize_zpos:
>>   	 *
> 

^ permalink raw reply	[flat|nested] 72+ messages in thread

* Re: [Nouveau] [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
@ 2022-01-25  5:19       ` Esaki Tomohito
  0 siblings, 0 replies; 72+ messages in thread
From: Esaki Tomohito @ 2022-01-25  5:19 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: David Airlie, nouveau, dri-devel, Michel Dänzer,
	Daniel Stone, Lee Jones, Rob Clark, Evan Quan, amd-gfx,
	Ben Skeggs, Petr Mladek, Sakari Ailus, Bas Nieuwenhuizen,
	Maarten Lankhorst, Abhinav Kumar, Dmitry Baryshkov,
	Takanari Hayama, Sean Paul, Maxime Ripard, Daniel Vetter,
	Andy Shevchenko, Mark Yacoub, Qingqing Zhuo, Pan, Xinhui,
	linux-kernel, Simon Ser, Alex Deucher, Damian Hobson-Garcia,
	Christian König

Hello Laurent-san

Thank you for your reviews and advices.

I'll fix this patch series following your advice.

Thanks,
Esaki

On 2022/01/24 7:50, Laurent Pinchart wrote:
> Hello Esaki-san,
> 
> On Fri, Jan 14, 2022 at 07:17:51PM +0900, Tomohito Esaki wrote:
>> If only linear modifier is advertised, since there are many drivers that
>> only linear supported, the DRM core should handle this rather than
>> open-coding in every driver. However, there are legacy drivers such as
>> radeon that do not support modifiers but infer the actual layout of the
>> underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
>> introduced for these legacy drivers, and allow_fb_modifiers is replaced
>> with this new flag.
>>
>> Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       |  6 +++---
>>   drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  2 ++
>>   drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  2 ++
>>   drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>   drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  2 ++
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +++
>>   drivers/gpu/drm/drm_framebuffer.c                 |  6 +++---
>>   drivers/gpu/drm/drm_ioctl.c                       |  2 +-
>>   drivers/gpu/drm/nouveau/nouveau_display.c         |  6 ++++--
>>   drivers/gpu/drm/radeon/radeon_display.c           |  2 ++
>>   include/drm/drm_mode_config.h                     | 10 ++++++++++
>>   11 files changed, 33 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 82011e75ed85..edbb30d47b8c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -954,7 +954,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
>>   	int ret;
>>   	unsigned int i, block_width, block_height, block_size_log2;
>>   
>> -	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
>> +	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
>>   		return 0;
>>   
>>   	for (i = 0; i < format_info->num_planes; ++i) {
>> @@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>>   	if (ret)
>>   		return ret;
>>   
>> -	if (!dev->mode_config.allow_fb_modifiers) {
>> +	if (dev->mode_config.fb_modifiers_not_supported) {
>>   		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
>>   			      "GFX9+ requires FB check based on format modifier\n");
>>   		ret = check_tiling_flags_gfx6(rfb);
>> @@ -1149,7 +1149,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
>>   			return ret;
>>   	}
>>   
>> -	if (dev->mode_config.allow_fb_modifiers &&
>> +	if (!dev->mode_config.fb_modifiers_not_supported &&
>>   	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
>>   		ret = convert_tiling_flags_to_modifier(rfb);
>>   		if (ret) {
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index d1570a462a51..fb61c0814115 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 18a7b3bd633b..17942a11366d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index c7803dc2b2d5..2ec99ec8e1a3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.max_height = 16384;
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index 8318ee8339f1..de11fbe5aba2 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
>>   	adev_to_drm(adev)->mode_config.preferred_depth = 24;
>>   	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
>>   
>> +	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
>>   
>>   	r = amdgpu_display_modeset_create_props(adev);
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 2f0b14f8f833..61cb41766fae 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -7868,6 +7868,9 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>>   	if (res)
>>   		return res;
>>   
>> +	if (modifiers == NULL)
>> +		adev_to_drm(dm->adev)->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	res = drm_universal_plane_init(adev_to_drm(dm->adev), plane, possible_crtcs,
>>   				       &dm_plane_funcs, formats, num_formats,
>>   				       modifiers, plane->type, NULL);
>> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
>> index 07f5abc875e9..4562a8b86579 100644
>> --- a/drivers/gpu/drm/drm_framebuffer.c
>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>> @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>>   	}
>>   
>>   	if (r->flags & DRM_MODE_FB_MODIFIERS &&
>> -	    !dev->mode_config.allow_fb_modifiers) {
>> +	    dev->mode_config.fb_modifiers_not_supported) {
>>   		DRM_DEBUG_KMS("driver does not support fb modifiers\n");
>>   		return ERR_PTR(-EINVAL);
>>   	}
>> @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>>   	r->pixel_format = fb->format->format;
>>   
>>   	r->flags = 0;
>> -	if (dev->mode_config.allow_fb_modifiers)
>> +	if (!dev->mode_config.fb_modifiers_not_supported)
>>   		r->flags |= DRM_MODE_FB_MODIFIERS;
>>   
>>   	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
>> @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>>   	for (i = 0; i < fb->format->num_planes; i++) {
>>   		r->pitches[i] = fb->pitches[i];
>>   		r->offsets[i] = fb->offsets[i];
>> -		if (dev->mode_config.allow_fb_modifiers)
>> +		if (!dev->mode_config.fb_modifiers_not_supported)
>>   			r->modifier[i] = fb->modifier;
>>   	}
>>   
>> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
>> index 8b8744dcf691..51fcf1298023 100644
>> --- a/drivers/gpu/drm/drm_ioctl.c
>> +++ b/drivers/gpu/drm/drm_ioctl.c
>> @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>>   			req->value = 64;
>>   		break;
>>   	case DRM_CAP_ADDFB2_MODIFIERS:
>> -		req->value = dev->mode_config.allow_fb_modifiers;
>> +		req->value = !dev->mode_config.fb_modifiers_not_supported;
>>   		break;
>>   	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
>>   		req->value = 1;
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
>> index 2b460835a438..2cd0932b3d68 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
>> @@ -708,10 +708,12 @@ nouveau_display_create(struct drm_device *dev)
>>   				     &disp->disp);
>>   		if (ret == 0) {
>>   			nouveau_display_create_properties(dev);
>> -			if (disp->disp.object.oclass < NV50_DISP)
>> +			if (disp->disp.object.oclass < NV50_DISP) {
>> +				dev->mode_config.fb_modifiers_not_supported = true;
>>   				ret = nv04_display_create(dev);
>> -			else
>> +			} else {
>>   				ret = nv50_display_create(dev);
>> +			}
>>   		}
>>   	} else {
>>   		ret = 0;
>> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
>> index 573154268d43..b9a07677a71e 100644
>> --- a/drivers/gpu/drm/radeon/radeon_display.c
>> +++ b/drivers/gpu/drm/radeon/radeon_display.c
>> @@ -1596,6 +1596,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
>>   	rdev->ddev->mode_config.preferred_depth = 24;
>>   	rdev->ddev->mode_config.prefer_shadow = 1;
>>   
>> +	rdev->ddev->mode_config.fb_modifiers_not_supported = true;
>> +
>>   	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
>>   
>>   	ret = radeon_modeset_create_props(rdev);
>> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
>> index 91ca575a78de..da82f45351c7 100644
>> --- a/include/drm/drm_mode_config.h
>> +++ b/include/drm/drm_mode_config.h
>> @@ -933,6 +933,16 @@ struct drm_mode_config {
>>   	 */
>>   	bool allow_fb_modifiers;
>>   
>> +	/**
>> +	 * @fb_modifiers_not_supported:
>> +	 *
>> +	 * This flag is for legacy drivers such as radeon that do not support
>> +	 * modifiers but infer the actual layout of the underlying buffer.
>> +	 * Generally, each drivers must support modifiers, this flag should not
>> +	 * be set.
> 
> I'd write it a bit differently, to explain what the flag does:
> 
> 	 * When this flag is set, the DRM device will not expose modifier
> 	 * support to userspace. This is only used by legacy drivers (such as
> 	 * radeon) that infer the buffer layout through heuristics without using
> 	 * modifiers. New drivers shall not set fhis flag.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> +	 */
>> +	bool fb_modifiers_not_supported;
>> +
>>   	/**
>>   	 * @normalize_zpos:
>>   	 *
> 

^ permalink raw reply	[flat|nested] 72+ messages in thread

end of thread, other threads:[~2022-01-26 18:21 UTC | newest]

Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 10:17 [RFC PATCH v3 0/3] Add support modifiers for drivers whose planes only support linear layout Tomohito Esaki
2022-01-14 10:17 ` [Nouveau] " Tomohito Esaki
2022-01-14 10:17 ` Tomohito Esaki
2022-01-14 10:17 ` Tomohito Esaki
2022-01-14 10:17 ` [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config Tomohito Esaki
2022-01-14 10:17   ` [Nouveau] " Tomohito Esaki
2022-01-14 10:17   ` Tomohito Esaki
2022-01-14 10:17   ` Tomohito Esaki
2022-01-14 14:43   ` Harry Wentland
2022-01-14 14:43     ` Harry Wentland
2022-01-14 14:43     ` Harry Wentland
2022-01-14 14:43     ` [Nouveau] " Harry Wentland
2022-01-23 22:50   ` Laurent Pinchart
2022-01-23 22:50     ` Laurent Pinchart
2022-01-23 22:50     ` Laurent Pinchart
2022-01-23 22:50     ` [Nouveau] " Laurent Pinchart
2022-01-25  5:19     ` Esaki Tomohito
2022-01-25  5:19       ` [Nouveau] " Esaki Tomohito
2022-01-25  5:19       ` Esaki Tomohito
2022-01-25  5:19       ` Esaki Tomohito
2022-01-14 10:17 ` [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout Tomohito Esaki
2022-01-14 10:17   ` [Nouveau] " Tomohito Esaki
2022-01-14 10:17   ` Tomohito Esaki
2022-01-14 10:17   ` Tomohito Esaki
2022-01-14 14:16   ` Andy Shevchenko
2022-01-14 14:16     ` Andy Shevchenko
2022-01-14 14:16     ` Andy Shevchenko
2022-01-14 14:16     ` [Nouveau] " Andy Shevchenko
2022-01-14 15:07     ` Simon Ser
2022-01-14 15:07       ` Simon Ser
2022-01-14 15:07       ` Simon Ser
2022-01-14 15:07       ` [Nouveau] " Simon Ser
2022-01-14 15:17       ` Andy Shevchenko
2022-01-14 15:17         ` Andy Shevchenko
2022-01-14 15:17         ` Andy Shevchenko
2022-01-14 15:17         ` [Nouveau] " Andy Shevchenko
2022-01-14 15:42         ` Simon Ser
2022-01-14 15:42           ` Simon Ser
2022-01-14 15:42           ` Simon Ser
2022-01-14 15:42           ` [Nouveau] " Simon Ser
2022-01-14 16:06           ` Andy Shevchenko
2022-01-14 16:06             ` Andy Shevchenko
2022-01-14 16:06             ` Andy Shevchenko
2022-01-14 16:06             ` [Nouveau] " Andy Shevchenko
2022-01-17  5:15     ` Esaki Tomohito
2022-01-17  5:15       ` [Nouveau] " Esaki Tomohito
2022-01-17  5:15       ` Esaki Tomohito
2022-01-17  5:15       ` Esaki Tomohito
2022-01-18  9:53       ` Andy Shevchenko
2022-01-18  9:53         ` Andy Shevchenko
2022-01-18  9:53         ` [Nouveau] " Andy Shevchenko
2022-01-18  9:53         ` Andy Shevchenko
2022-01-19  2:35         ` Esaki Tomohito
2022-01-19  2:35           ` [Nouveau] " Esaki Tomohito
2022-01-19  2:35           ` Esaki Tomohito
2022-01-19  2:35           ` Esaki Tomohito
2022-01-19 19:17           ` Andy Shevchenko
2022-01-19 19:17             ` Andy Shevchenko
2022-01-19 19:17             ` Andy Shevchenko
2022-01-19 19:17             ` [Nouveau] " Andy Shevchenko
2022-01-23 22:37   ` Laurent Pinchart
2022-01-23 22:37     ` Laurent Pinchart
2022-01-23 22:37     ` Laurent Pinchart
2022-01-23 22:37     ` [Nouveau] " Laurent Pinchart
2022-01-14 10:17 ` [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers Tomohito Esaki
2022-01-14 10:17   ` [Nouveau] " Tomohito Esaki
2022-01-14 10:17   ` Tomohito Esaki
2022-01-14 10:17   ` Tomohito Esaki
2022-01-23 22:44   ` Laurent Pinchart
2022-01-23 22:44     ` Laurent Pinchart
2022-01-23 22:44     ` Laurent Pinchart
2022-01-23 22:44     ` [Nouveau] " Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.