From: Mark Yacoub <markyacoub@google.com> To: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Cc: Alex Deucher <alexander.deucher@amd.com>, Mark Yacoub <markyacoub@chromium.org>, ML dri-devel <dri-devel@lists.freedesktop.org>, amd-gfx mailing list <amd-gfx@lists.freedesktop.org> Subject: Re: [PATCH] drm/amdgpu: Ensure that the modifier requested is supported by plane. Date: Tue, 23 Mar 2021 11:34:09 -0400 [thread overview] Message-ID: <CAC0gqY4x-bLAfjswiPLjRJKxmOD+7TNWybAHjL4bPgpTmRGx5Q@mail.gmail.com> (raw) In-Reply-To: <CAP+8YyFb4ax0Z6Ev2=KpqF481kFyG_Br+WT=72dGK-tATXVrGg@mail.gmail.com> On Tue, Mar 23, 2021 at 11:08 AM Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> wrote: > > > > On Wed, Mar 10, 2021 at 5:14 PM Mark Yacoub <markyacoub@chromium.org> wrote: >> >> From: Mark Yacoub <markyacoub@google.com> >> >> On initializing the framebuffer, call drm_any_plane_has_format to do a >> check if the modifier is supported. drm_any_plane_has_format calls >> dm_plane_format_mod_supported which is extended to validate that the >> modifier is on the list of the plane's supported modifiers. >> >> The bug was caught using igt-gpu-tools test: kms_addfb_basic.addfb25-bad-modifier >> >> Tested on ChromeOS Zork by turning on the display, running an overlay >> test, and running a YT video. >> >> Cc: Alex Deucher <alexander.deucher@amd.com> >> Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> >> Signed-off-by: default avatarMark Yacoub <markyacoub@chromium.org> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 13 +++++++++++++ >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++ >> 2 files changed, 22 insertions(+) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c >> index afa5f8ad0f563..a947b5aa420d2 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c >> @@ -908,6 +908,19 @@ int amdgpu_display_gem_fb_verify_and_init( >> &amdgpu_fb_funcs); >> if (ret) >> goto err; >> + /* Verify that the modifier is supported. */ >> + if (!drm_any_plane_has_format(dev, mode_cmd->pixel_format, >> + mode_cmd->modifier[0])) { >> + struct drm_format_name_buf format_name; >> + drm_dbg_kms(dev, >> + "unsupported pixel format %s / modifier 0x%llx\n", >> + drm_get_format_name(mode_cmd->pixel_format, >> + &format_name), >> + mode_cmd->modifier[0]); >> + >> + ret = -EINVAL; >> + goto err; >> + } > > > Why is this needed? This is the function that initiates the check for modifiers. Inside it we call `plane->funcs->format_mod_supported` which is implemented as dm_plane_format_mod_supported in amdgpu_dm.c, modified below as well. > >> >> ret = amdgpu_display_framebuffer_init(dev, rfb, mode_cmd, obj); >> if (ret) >> 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 961abf1cf040c..21314024a83ce 100644 >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> @@ -3939,6 +3939,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, >> { >> struct amdgpu_device *adev = drm_to_adev(plane->dev); >> const struct drm_format_info *info = drm_format_info(format); >> + int i; >> >> enum dm_micro_swizzle microtile = modifier_gfx9_swizzle_mode(modifier) & 3; >> >> @@ -3952,6 +3953,14 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, >> if (modifier == DRM_FORMAT_MOD_LINEAR) >> return true; >> >> + /* Check that the modifier is on the list of the plane's supported modifiers. */ >> + for (i = 0; i < plane->modifier_count; i++) { >> + if (modifier == plane->modifiers[i]) >> + break; >> + } >> + if (i == plane->modifier_count) >> + return false; >> + > > > This part seems fine by me. >> >> /* >> * The arbitrary tiling support for multiplane formats has not been hooked >> * up. >> -- >> 2.30.1.766.gb4fecdf3b7-goog >> _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Mark Yacoub <markyacoub@google.com> To: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Cc: Alex Deucher <alexander.deucher@amd.com>, Mark Yacoub <markyacoub@chromium.org>, ML dri-devel <dri-devel@lists.freedesktop.org>, amd-gfx mailing list <amd-gfx@lists.freedesktop.org> Subject: Re: [PATCH] drm/amdgpu: Ensure that the modifier requested is supported by plane. Date: Tue, 23 Mar 2021 11:34:09 -0400 [thread overview] Message-ID: <CAC0gqY4x-bLAfjswiPLjRJKxmOD+7TNWybAHjL4bPgpTmRGx5Q@mail.gmail.com> (raw) In-Reply-To: <CAP+8YyFb4ax0Z6Ev2=KpqF481kFyG_Br+WT=72dGK-tATXVrGg@mail.gmail.com> On Tue, Mar 23, 2021 at 11:08 AM Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> wrote: > > > > On Wed, Mar 10, 2021 at 5:14 PM Mark Yacoub <markyacoub@chromium.org> wrote: >> >> From: Mark Yacoub <markyacoub@google.com> >> >> On initializing the framebuffer, call drm_any_plane_has_format to do a >> check if the modifier is supported. drm_any_plane_has_format calls >> dm_plane_format_mod_supported which is extended to validate that the >> modifier is on the list of the plane's supported modifiers. >> >> The bug was caught using igt-gpu-tools test: kms_addfb_basic.addfb25-bad-modifier >> >> Tested on ChromeOS Zork by turning on the display, running an overlay >> test, and running a YT video. >> >> Cc: Alex Deucher <alexander.deucher@amd.com> >> Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> >> Signed-off-by: default avatarMark Yacoub <markyacoub@chromium.org> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 13 +++++++++++++ >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++ >> 2 files changed, 22 insertions(+) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c >> index afa5f8ad0f563..a947b5aa420d2 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c >> @@ -908,6 +908,19 @@ int amdgpu_display_gem_fb_verify_and_init( >> &amdgpu_fb_funcs); >> if (ret) >> goto err; >> + /* Verify that the modifier is supported. */ >> + if (!drm_any_plane_has_format(dev, mode_cmd->pixel_format, >> + mode_cmd->modifier[0])) { >> + struct drm_format_name_buf format_name; >> + drm_dbg_kms(dev, >> + "unsupported pixel format %s / modifier 0x%llx\n", >> + drm_get_format_name(mode_cmd->pixel_format, >> + &format_name), >> + mode_cmd->modifier[0]); >> + >> + ret = -EINVAL; >> + goto err; >> + } > > > Why is this needed? This is the function that initiates the check for modifiers. Inside it we call `plane->funcs->format_mod_supported` which is implemented as dm_plane_format_mod_supported in amdgpu_dm.c, modified below as well. > >> >> ret = amdgpu_display_framebuffer_init(dev, rfb, mode_cmd, obj); >> if (ret) >> 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 961abf1cf040c..21314024a83ce 100644 >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> @@ -3939,6 +3939,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, >> { >> struct amdgpu_device *adev = drm_to_adev(plane->dev); >> const struct drm_format_info *info = drm_format_info(format); >> + int i; >> >> enum dm_micro_swizzle microtile = modifier_gfx9_swizzle_mode(modifier) & 3; >> >> @@ -3952,6 +3953,14 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, >> if (modifier == DRM_FORMAT_MOD_LINEAR) >> return true; >> >> + /* Check that the modifier is on the list of the plane's supported modifiers. */ >> + for (i = 0; i < plane->modifier_count; i++) { >> + if (modifier == plane->modifiers[i]) >> + break; >> + } >> + if (i == plane->modifier_count) >> + return false; >> + > > > This part seems fine by me. >> >> /* >> * The arbitrary tiling support for multiplane formats has not been hooked >> * up. >> -- >> 2.30.1.766.gb4fecdf3b7-goog >> _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2021-03-23 15:34 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-10 16:14 [PATCH] drm/amdgpu: Ensure that the modifier requested is supported by plane Mark Yacoub 2021-03-10 16:14 ` Mark Yacoub 2021-03-22 15:17 ` Mark Yacoub 2021-03-22 15:17 ` Mark Yacoub 2021-03-23 15:02 ` Alex Deucher 2021-03-23 15:02 ` Alex Deucher 2021-03-23 15:32 ` Mark Yacoub 2021-03-23 15:32 ` Mark Yacoub 2021-03-24 10:13 ` Michel Dänzer 2021-03-24 10:13 ` Michel Dänzer 2021-03-24 10:53 ` Bas Nieuwenhuizen 2021-03-24 10:53 ` Bas Nieuwenhuizen 2021-03-24 12:10 ` Daniel Stone 2021-03-24 12:10 ` Daniel Stone 2021-03-24 14:58 ` Mark Yacoub 2021-03-24 14:58 ` Mark Yacoub 2021-03-24 15:25 ` Daniel Stone 2021-03-24 15:25 ` Daniel Stone 2021-03-24 15:32 ` Mark Yacoub 2021-03-24 15:32 ` Mark Yacoub 2021-03-23 15:08 ` Bas Nieuwenhuizen 2021-03-23 15:08 ` Bas Nieuwenhuizen 2021-03-23 15:34 ` Mark Yacoub [this message] 2021-03-23 15:34 ` Mark Yacoub
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=CAC0gqY4x-bLAfjswiPLjRJKxmOD+7TNWybAHjL4bPgpTmRGx5Q@mail.gmail.com \ --to=markyacoub@google.com \ --cc=alexander.deucher@amd.com \ --cc=amd-gfx@lists.freedesktop.org \ --cc=bas@basnieuwenhuizen.nl \ --cc=dri-devel@lists.freedesktop.org \ --cc=markyacoub@chromium.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.