From: Harry Wentland <harry.wentland@amd.com>
To: Tomohito Esaki <etom@igel.co.jp>, dri-devel@lists.freedesktop.org
Cc: "Simon Ser" <contact@emersion.fr>,
"David Airlie" <airlied@linux.ie>,
nouveau@lists.freedesktop.org,
"Michel Dänzer" <mdaenzer@redhat.com>,
amd-gfx@lists.freedesktop.org, "Lee Jones" <lee.jones@linaro.org>,
"Rob Clark" <robdclark@chromium.org>,
"Takanari Hayama" <taki@igel.co.jp>,
"Daniel Stone" <daniel@fooishbar.org>,
"Ben Skeggs" <bskeggs@redhat.com>,
"Evan Quan" <evan.quan@amd.com>, "Petr Mladek" <pmladek@suse.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Abhinav Kumar" <abhinavk@codeaurora.org>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Sean Paul" <seanpaul@chromium.org>,
"Maxime Ripard" <mripard@kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Mark Yacoub" <markyacoub@chromium.org>,
"Qingqing Zhuo" <qingqing.zhuo@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
linux-kernel@vger.kernel.org, "Daniel Vetter" <daniel@ffwll.ch>,
"Bas Nieuwenhuizen" <bas@basnieuwenhuizen.nl>,
"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
"Damian Hobson-Garcia" <dhobsong@igel.co.jp>,
"Christian König" <christian.koenig@amd.com>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>
Subject: Re: [Nouveau] [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config
Date: Fri, 14 Jan 2022 09:43:08 -0500 [thread overview]
Message-ID: <b58b4288-8220-8ab8-3972-6371cdc4e34a@amd.com> (raw)
In-Reply-To: <20220114101753.24996-2-etom@igel.co.jp>
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:
> *
next prev parent reply other threads:[~2022-01-14 14:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 10:17 [Nouveau] [RFC PATCH v3 0/3] Add support modifiers for drivers whose planes only support linear layout Tomohito Esaki
2022-01-14 10:17 ` [Nouveau] [RFC PATCH v3 1/3] drm: introduce fb_modifiers_not_supported flag in mode_config Tomohito Esaki
2022-01-14 14:43 ` Harry Wentland [this message]
2022-01-23 22:50 ` Laurent Pinchart
2022-01-25 5:19 ` Esaki Tomohito
2022-01-14 10:17 ` [Nouveau] [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout Tomohito Esaki
2022-01-14 14:16 ` Andy Shevchenko
2022-01-14 15:07 ` Simon Ser
2022-01-14 15:17 ` Andy Shevchenko
2022-01-14 15:42 ` Simon Ser
2022-01-14 16:06 ` Andy Shevchenko
2022-01-17 5:15 ` Esaki Tomohito
2022-01-18 9:53 ` Andy Shevchenko
2022-01-19 2:35 ` Esaki Tomohito
2022-01-19 19:17 ` Andy Shevchenko
2022-01-23 22:37 ` Laurent Pinchart
2022-01-14 10:17 ` [Nouveau] [RFC PATCH v3 3/3] drm: remove allow_fb_modifiers Tomohito Esaki
2022-01-23 22:44 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b58b4288-8220-8ab8-3972-6371cdc4e34a@amd.com \
--to=harry.wentland@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=abhinavk@codeaurora.org \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bas@basnieuwenhuizen.nl \
--cc=bskeggs@redhat.com \
--cc=christian.koenig@amd.com \
--cc=contact@emersion.fr \
--cc=daniel@ffwll.ch \
--cc=daniel@fooishbar.org \
--cc=dhobsong@igel.co.jp \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=etom@igel.co.jp \
--cc=evan.quan@amd.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=markyacoub@chromium.org \
--cc=mdaenzer@redhat.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=pmladek@suse.com \
--cc=qingqing.zhuo@amd.com \
--cc=robdclark@chromium.org \
--cc=sakari.ailus@linux.intel.com \
--cc=seanpaul@chromium.org \
--cc=taki@igel.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).