From: Hamza Mahfooz <hamza.mahfooz@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
stable@vger.kernel.org,
"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>
Subject: Re: [PATCH v3] drm/amdgpu: register a dirty framebuffer callback for fbcon
Date: Wed, 23 Aug 2023 17:49:09 -0400 [thread overview]
Message-ID: <2c8e63ea-bf5d-4ecb-baba-e1df60b46cb5@amd.com> (raw)
In-Reply-To: <44226172-b1b8-42ca-9e9f-0fe72399948e@amd.com>
On 8/23/23 17:47, Mario Limonciello wrote:
> On 8/23/2023 16:44, Hamza Mahfooz wrote:
>> fbcon requires that we implement &drm_framebuffer_funcs.dirty.
>> Otherwise, the framebuffer might take a while to flush (which would
>> manifest as noticeable lag). However, we can't enable this callback for
>> non-fbcon cases since it may cause too many atomic commits to be made at
>> once. So, implement amdgpu_dirtyfb() and only enable it for fbcon
>> framebuffers (we can use the "struct drm_file file" parameter in the
>> callback to check for this since it is only NULL when called by fbcon,
>> at least in the mainline kernel) on devices that support atomic KMS.
>>
>> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
>> Cc: Mario Limonciello <mario.limonciello@amd.com>
>> Cc: stable@vger.kernel.org # 6.1+
>> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2519
>> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>
> You probably meant to drop Alex's SoB as you bumped v2. When committing
> this make sure you drop it. He can add it when this is upstreamed.
Whoops, ya I'll be sure to drop it.
>
> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
>> --
>> v3: check if file is NULL instead of doing a strcmp() and make note of
>> it in the commit message
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 26 ++++++++++++++++++++-
>> 1 file changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index d20dd3f852fc..363e6a2cad8c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -38,6 +38,8 @@
>> #include <linux/pci.h>
>> #include <linux/pm_runtime.h>
>> #include <drm/drm_crtc_helper.h>
>> +#include <drm/drm_damage_helper.h>
>> +#include <drm/drm_drv.h>
>> #include <drm/drm_edid.h>
>> #include <drm/drm_fb_helper.h>
>> #include <drm/drm_gem_framebuffer_helper.h>
>> @@ -532,11 +534,29 @@ bool amdgpu_display_ddc_probe(struct
>> amdgpu_connector *amdgpu_connector,
>> return true;
>> }
>> +static int amdgpu_dirtyfb(struct drm_framebuffer *fb, struct drm_file
>> *file,
>> + unsigned int flags, unsigned int color,
>> + struct drm_clip_rect *clips, unsigned int num_clips)
>> +{
>> +
>> + if (file)
>> + return -ENOSYS;
>> +
>> + return drm_atomic_helper_dirtyfb(fb, file, flags, color, clips,
>> + num_clips);
>> +}
>> +
>> static const struct drm_framebuffer_funcs amdgpu_fb_funcs = {
>> .destroy = drm_gem_fb_destroy,
>> .create_handle = drm_gem_fb_create_handle,
>> };
>> +static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = {
>> + .destroy = drm_gem_fb_destroy,
>> + .create_handle = drm_gem_fb_create_handle,
>> + .dirty = amdgpu_dirtyfb
>> +};
>> +
>> uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
>> uint64_t bo_flags)
>> {
>> @@ -1139,7 +1159,11 @@ static int
>> amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev,
>> if (ret)
>> goto err;
>> - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
>> + if (drm_drv_uses_atomic_modeset(dev))
>> + ret = drm_framebuffer_init(dev, &rfb->base,
>> + &amdgpu_fb_funcs_atomic);
>> + else
>> + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
>> if (ret)
>> goto err;
>
--
Hamza
WARNING: multiple messages have this Message-ID (diff)
From: Hamza Mahfooz <hamza.mahfooz@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: "Thomas Zimmermann" <tzimmermann@suse.de>,
"Christian König" <christian.koenig@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v3] drm/amdgpu: register a dirty framebuffer callback for fbcon
Date: Wed, 23 Aug 2023 17:49:09 -0400 [thread overview]
Message-ID: <2c8e63ea-bf5d-4ecb-baba-e1df60b46cb5@amd.com> (raw)
In-Reply-To: <44226172-b1b8-42ca-9e9f-0fe72399948e@amd.com>
On 8/23/23 17:47, Mario Limonciello wrote:
> On 8/23/2023 16:44, Hamza Mahfooz wrote:
>> fbcon requires that we implement &drm_framebuffer_funcs.dirty.
>> Otherwise, the framebuffer might take a while to flush (which would
>> manifest as noticeable lag). However, we can't enable this callback for
>> non-fbcon cases since it may cause too many atomic commits to be made at
>> once. So, implement amdgpu_dirtyfb() and only enable it for fbcon
>> framebuffers (we can use the "struct drm_file file" parameter in the
>> callback to check for this since it is only NULL when called by fbcon,
>> at least in the mainline kernel) on devices that support atomic KMS.
>>
>> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
>> Cc: Mario Limonciello <mario.limonciello@amd.com>
>> Cc: stable@vger.kernel.org # 6.1+
>> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2519
>> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>
> You probably meant to drop Alex's SoB as you bumped v2. When committing
> this make sure you drop it. He can add it when this is upstreamed.
Whoops, ya I'll be sure to drop it.
>
> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
>> --
>> v3: check if file is NULL instead of doing a strcmp() and make note of
>> it in the commit message
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 26 ++++++++++++++++++++-
>> 1 file changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index d20dd3f852fc..363e6a2cad8c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -38,6 +38,8 @@
>> #include <linux/pci.h>
>> #include <linux/pm_runtime.h>
>> #include <drm/drm_crtc_helper.h>
>> +#include <drm/drm_damage_helper.h>
>> +#include <drm/drm_drv.h>
>> #include <drm/drm_edid.h>
>> #include <drm/drm_fb_helper.h>
>> #include <drm/drm_gem_framebuffer_helper.h>
>> @@ -532,11 +534,29 @@ bool amdgpu_display_ddc_probe(struct
>> amdgpu_connector *amdgpu_connector,
>> return true;
>> }
>> +static int amdgpu_dirtyfb(struct drm_framebuffer *fb, struct drm_file
>> *file,
>> + unsigned int flags, unsigned int color,
>> + struct drm_clip_rect *clips, unsigned int num_clips)
>> +{
>> +
>> + if (file)
>> + return -ENOSYS;
>> +
>> + return drm_atomic_helper_dirtyfb(fb, file, flags, color, clips,
>> + num_clips);
>> +}
>> +
>> static const struct drm_framebuffer_funcs amdgpu_fb_funcs = {
>> .destroy = drm_gem_fb_destroy,
>> .create_handle = drm_gem_fb_create_handle,
>> };
>> +static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = {
>> + .destroy = drm_gem_fb_destroy,
>> + .create_handle = drm_gem_fb_create_handle,
>> + .dirty = amdgpu_dirtyfb
>> +};
>> +
>> uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
>> uint64_t bo_flags)
>> {
>> @@ -1139,7 +1159,11 @@ static int
>> amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev,
>> if (ret)
>> goto err;
>> - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
>> + if (drm_drv_uses_atomic_modeset(dev))
>> + ret = drm_framebuffer_init(dev, &rfb->base,
>> + &amdgpu_fb_funcs_atomic);
>> + else
>> + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
>> if (ret)
>> goto err;
>
--
Hamza
next prev parent reply other threads:[~2023-08-23 21:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 21:44 [PATCH v3] drm/amdgpu: register a dirty framebuffer callback for fbcon Hamza Mahfooz
2023-08-23 21:44 ` Hamza Mahfooz
2023-08-23 21:47 ` Mario Limonciello
2023-08-23 21:47 ` Mario Limonciello
2023-08-23 21:49 ` Hamza Mahfooz [this message]
2023-08-23 21:49 ` Hamza Mahfooz
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=2c8e63ea-bf5d-4ecb-baba-e1df60b46cb5@amd.com \
--to=hamza.mahfooz@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=christian.koenig@amd.com \
--cc=mario.limonciello@amd.com \
--cc=stable@vger.kernel.org \
--cc=tzimmermann@suse.de \
/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 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.