From: Thomas Zimmermann <tzimmermann@suse.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: airlied@gmail.com, daniel@ffwll.ch,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
javierm@redhat.com, linux-samsung-soc@vger.kernel.org,
linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
linux-tegra@vger.kernel.org, freedreno@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 04/10] drm/fbdev-generic: Initialize fb-helper structure in generic setup
Date: Fri, 27 Jan 2023 15:21:30 +0100 [thread overview]
Message-ID: <441188d8-01a6-2a48-ce46-e32d7006aafa@suse.de> (raw)
In-Reply-To: <Y9GZJcRKbaK0cYGo@ravnborg.org>
[-- Attachment #1.1: Type: text/plain, Size: 3176 bytes --]
Hi
Am 25.01.23 um 22:03 schrieb Sam Ravnborg:
> Hi Thomas,
>
> On Wed, Jan 25, 2023 at 09:04:09PM +0100, Thomas Zimmermann wrote:
>> Initialize the fb-helper structure immediately after its allocation
>> in drm_fbdev_generic_setup(). That will make it easier to fill it with
>> driver-specific values, such as the preferred BPP.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
>> ---
>> drivers/gpu/drm/drm_fbdev_generic.c | 13 +++++++++----
>> 1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
>> index 135d58b8007b..63f66325a8a5 100644
>> --- a/drivers/gpu/drm/drm_fbdev_generic.c
>> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
>> @@ -385,8 +385,6 @@ static int drm_fbdev_client_hotplug(struct drm_client_dev *client)
>> if (dev->fb_helper)
>> return drm_fb_helper_hotplug_event(dev->fb_helper);
>>
>> - drm_fb_helper_prepare(dev, fb_helper, &drm_fb_helper_generic_funcs);
>> -
>> ret = drm_fb_helper_init(dev, fb_helper);
>> if (ret)
>> goto err;
>
> From the documentation:
> The drm_fb_helper_prepare()
> helper must be called first to initialize the minimum required to make
> hotplug detection work.
> ...
> To finish up the fbdev helper initialization, the
> drm_fb_helper_init() function is called.
>
> So this change do not follow the documentation as drm_fb_helper_init()
> is now called before drm_fb_helper_prepare()
No, we now call drm_fb_helper_prepare() from within
drm_fbdev_generic_setup(), right after allocating the fb_helper.
drm_fb_helper_init() will only be called after the client received a
hot-plug event.
>
> I did not follow all the code - but my gut feeling is that the
> documentation is right.
The docs are of low quality. The _prepare() helper is the actual init
function and _init() only sets the fb_helper in the device instance.
Best regards
Thomas
>
> Sam
>
>
>> @@ -456,12 +454,12 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
>> fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
>> if (!fb_helper)
>> return;
>> + drm_fb_helper_prepare(dev, fb_helper, &drm_fb_helper_generic_funcs);
>>
>> ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs);
>> if (ret) {
>> - kfree(fb_helper);
>> drm_err(dev, "Failed to register client: %d\n", ret);
>> - return;
>> + goto err_drm_client_init;
>> }
>>
>> /*
>> @@ -484,5 +482,12 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
>> drm_dbg_kms(dev, "client hotplug ret=%d\n", ret);
>>
>> drm_client_register(&fb_helper->client);
>> +
>> + return;
>> +
>> +err_drm_client_init:
>> + drm_fb_helper_unprepare(fb_helper);
>> + kfree(fb_helper);
>> + return;
>> }
>> EXPORT_SYMBOL(drm_fbdev_generic_setup);
>> --
>> 2.39.0
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2023-01-27 14:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 20:04 [PATCH v3 00/10] drm/fb-helper: Various cleanups Thomas Zimmermann
2023-01-25 20:04 ` [PATCH v3 01/10] drm/client: Test for connectors before sending hotplug event Thomas Zimmermann
2023-01-25 20:52 ` Sam Ravnborg
2023-01-27 14:13 ` Thomas Zimmermann
2023-01-27 17:33 ` Sam Ravnborg
2023-01-27 18:02 ` Simon Ser
2023-01-30 8:40 ` Thomas Zimmermann
2023-01-25 20:04 ` [PATCH v3 02/10] drm/client: Add hotplug_failed flag Thomas Zimmermann
2023-01-25 20:57 ` Sam Ravnborg
2023-01-27 14:17 ` Thomas Zimmermann
2023-01-25 20:04 ` [PATCH v3 03/10] drm/fb-helper: Introduce drm_fb_helper_unprepare() Thomas Zimmermann
2023-01-25 20:04 ` [PATCH v3 04/10] drm/fbdev-generic: Initialize fb-helper structure in generic setup Thomas Zimmermann
2023-01-25 21:03 ` Sam Ravnborg
2023-01-27 14:21 ` Thomas Zimmermann [this message]
2023-01-27 17:35 ` Sam Ravnborg
2023-01-25 20:04 ` [PATCH v3 05/10] drm/fb-helper: Remove preferred_bpp parameter from fbdev internals Thomas Zimmermann
2023-01-25 20:04 ` [PATCH v3 06/10] drm/fb-helper: Initialize fb-helper's preferred BPP in prepare function Thomas Zimmermann
2023-01-25 20:04 ` [PATCH v3 07/10] drm/fbdev-generic: Minimize hotplug error handling Thomas Zimmermann
2023-01-25 20:04 ` [PATCH v3 08/10] drm/fbdev-generic: Minimize client unregistering Thomas Zimmermann
2023-01-25 20:04 ` [PATCH v3 09/10] drm/fbdev-generic: Inline clean-up helpers into drm_fbdev_fb_destroy() Thomas Zimmermann
2023-01-25 20:04 ` [PATCH v3 10/10] drm/fbdev-generic: Rename struct fb_info 'fbi' to 'info' Thomas Zimmermann
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=441188d8-01a6-2a48-ce46-e32d7006aafa@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=sam@ravnborg.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: 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