From: Felix Kuehling <felix.kuehling@amd.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
javierm@redhat.com, daniel@ffwll.ch,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
inki.dae@samsung.com, sw0312.kim@samsung.com,
kyungmin.park@samsung.com, linux@armlinux.org.uk,
krzk@kernel.org, alim.akhtar@samsung.com,
patrik.r.jakobsson@gmail.com, jani.nikula@linux.intel.com,
rodrigo.vivi@intel.com, joonas.lahtinen@linux.intel.com,
tursulin@ursulin.net, robdclark@gmail.com,
quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org,
sean@poorly.run, marijn.suijten@somainline.org,
tomi.valkeinen@ideasonboard.com, alexander.deucher@amd.com,
christian.koenig@amd.com, Xinhui.Pan@amd.com,
thierry.reding@gmail.com, mperttunen@nvidia.com,
jonathanh@nvidia.com
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 11/11] drm/tegra: Use fbdev client helpers
Date: Tue, 7 May 2024 17:03:41 -0400 [thread overview]
Message-ID: <b463d432-669c-43a4-933a-cafef000f7da@amd.com> (raw)
In-Reply-To: <20240507120422.25492-12-tzimmermann@suse.de>
On 2024-05-07 07:58, Thomas Zimmermann wrote:
> Implement struct drm_client_funcs with the respective helpers and
> remove the custom code from the emulation. The generic helpers are
> equivalent in functionality.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/radeon/radeon_fbdev.c | 66 ++-------------------------
Was radeon meant to be a separate patch?
Regards,
Felix
> drivers/gpu/drm/tegra/fbdev.c | 58 ++---------------------
> 2 files changed, 6 insertions(+), 118 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_fbdev.c b/drivers/gpu/drm/radeon/radeon_fbdev.c
> index 02bf25759059a..cf790922174ea 100644
> --- a/drivers/gpu/drm/radeon/radeon_fbdev.c
> +++ b/drivers/gpu/drm/radeon/radeon_fbdev.c
> @@ -29,7 +29,6 @@
> #include <linux/pm_runtime.h>
> #include <linux/vga_switcheroo.h>
>
> -#include <drm/drm_crtc_helper.h>
> #include <drm/drm_drv.h>
> #include <drm/drm_fb_helper.h>
> #include <drm/drm_fourcc.h>
> @@ -293,71 +292,12 @@ static const struct drm_fb_helper_funcs radeon_fbdev_fb_helper_funcs = {
> };
>
> /*
> - * Fbdev client and struct drm_client_funcs
> + * struct drm_client_funcs
> */
>
> -static void radeon_fbdev_client_unregister(struct drm_client_dev *client)
> -{
> - struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
> - struct drm_device *dev = fb_helper->dev;
> - struct radeon_device *rdev = dev->dev_private;
> -
> - if (fb_helper->info) {
> - vga_switcheroo_client_fb_set(rdev->pdev, NULL);
> - drm_helper_force_disable_all(dev);
> - drm_fb_helper_unregister_info(fb_helper);
> - } else {
> - drm_client_release(&fb_helper->client);
> - drm_fb_helper_unprepare(fb_helper);
> - kfree(fb_helper);
> - }
> -}
> -
> -static int radeon_fbdev_client_restore(struct drm_client_dev *client)
> -{
> - drm_fb_helper_lastclose(client->dev);
> - vga_switcheroo_process_delayed_switch();
> -
> - return 0;
> -}
> -
> -static int radeon_fbdev_client_hotplug(struct drm_client_dev *client)
> -{
> - struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
> - struct drm_device *dev = client->dev;
> - struct radeon_device *rdev = dev->dev_private;
> - int ret;
> -
> - if (dev->fb_helper)
> - return drm_fb_helper_hotplug_event(dev->fb_helper);
> -
> - ret = drm_fb_helper_init(dev, fb_helper);
> - if (ret)
> - goto err_drm_err;
> -
> - if (!drm_drv_uses_atomic_modeset(dev))
> - drm_helper_disable_unused_functions(dev);
> -
> - ret = drm_fb_helper_initial_config(fb_helper);
> - if (ret)
> - goto err_drm_fb_helper_fini;
> -
> - vga_switcheroo_client_fb_set(rdev->pdev, fb_helper->info);
> -
> - return 0;
> -
> -err_drm_fb_helper_fini:
> - drm_fb_helper_fini(fb_helper);
> -err_drm_err:
> - drm_err(dev, "Failed to setup radeon fbdev emulation (ret=%d)\n", ret);
> - return ret;
> -}
> -
> static const struct drm_client_funcs radeon_fbdev_client_funcs = {
> - .owner = THIS_MODULE,
> - .unregister = radeon_fbdev_client_unregister,
> - .restore = radeon_fbdev_client_restore,
> - .hotplug = radeon_fbdev_client_hotplug,
> + .owner = THIS_MODULE,
> + DRM_FBDEV_HELPER_CLIENT_FUNCS,
> };
>
> void radeon_fbdev_setup(struct radeon_device *rdev)
> diff --git a/drivers/gpu/drm/tegra/fbdev.c b/drivers/gpu/drm/tegra/fbdev.c
> index db6eaac3d30e6..f9cc365cfed94 100644
> --- a/drivers/gpu/drm/tegra/fbdev.c
> +++ b/drivers/gpu/drm/tegra/fbdev.c
> @@ -12,7 +12,6 @@
> #include <linux/vmalloc.h>
>
> #include <drm/drm_drv.h>
> -#include <drm/drm_crtc_helper.h>
> #include <drm/drm_fb_helper.h>
> #include <drm/drm_fourcc.h>
> #include <drm/drm_framebuffer.h>
> @@ -150,63 +149,12 @@ static const struct drm_fb_helper_funcs tegra_fb_helper_funcs = {
> };
>
> /*
> - * struct drm_client
> + * struct drm_client_funcs
> */
>
> -static void tegra_fbdev_client_unregister(struct drm_client_dev *client)
> -{
> - struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
> -
> - if (fb_helper->info) {
> - drm_fb_helper_unregister_info(fb_helper);
> - } else {
> - drm_client_release(&fb_helper->client);
> - drm_fb_helper_unprepare(fb_helper);
> - kfree(fb_helper);
> - }
> -}
> -
> -static int tegra_fbdev_client_restore(struct drm_client_dev *client)
> -{
> - drm_fb_helper_lastclose(client->dev);
> -
> - return 0;
> -}
> -
> -static int tegra_fbdev_client_hotplug(struct drm_client_dev *client)
> -{
> - struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
> - struct drm_device *dev = client->dev;
> - int ret;
> -
> - if (dev->fb_helper)
> - return drm_fb_helper_hotplug_event(dev->fb_helper);
> -
> - ret = drm_fb_helper_init(dev, fb_helper);
> - if (ret)
> - goto err_drm_err;
> -
> - if (!drm_drv_uses_atomic_modeset(dev))
> - drm_helper_disable_unused_functions(dev);
> -
> - ret = drm_fb_helper_initial_config(fb_helper);
> - if (ret)
> - goto err_drm_fb_helper_fini;
> -
> - return 0;
> -
> -err_drm_fb_helper_fini:
> - drm_fb_helper_fini(fb_helper);
> -err_drm_err:
> - drm_err(dev, "Failed to setup fbdev emulation (ret=%d)\n", ret);
> - return ret;
> -}
> -
> static const struct drm_client_funcs tegra_fbdev_client_funcs = {
> - .owner = THIS_MODULE,
> - .unregister = tegra_fbdev_client_unregister,
> - .restore = tegra_fbdev_client_restore,
> - .hotplug = tegra_fbdev_client_hotplug,
> + .owner = THIS_MODULE,
> + DRM_FBDEV_HELPER_CLIENT_FUNCS,
> };
>
> void tegra_fbdev_setup(struct drm_device *dev)
next prev parent reply other threads:[~2024-05-07 21:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 11:58 [PATCH 00/11] drm: Provide common fbdev client helpers Thomas Zimmermann
2024-05-07 11:58 ` [PATCH 01/11] drm/fb-helper: Add helpers for struct drm_client_funcs Thomas Zimmermann
2024-05-07 11:58 ` [PATCH 02/11] drm/fbdev-dma: Use fbdev client helpers Thomas Zimmermann
2024-05-07 11:58 ` [PATCH 03/11] drm/fbdev-shmem: " Thomas Zimmermann
2024-05-07 11:58 ` [PATCH 04/11] drm/fbdev-ttm: " Thomas Zimmermann
2024-05-07 11:58 ` [PATCH 05/11] drm/armada: " Thomas Zimmermann
2024-05-07 11:58 ` [PATCH 06/11] drm/exynos: " Thomas Zimmermann
2024-05-07 11:58 ` [PATCH 07/11] drm/gma500: " Thomas Zimmermann
2024-05-08 12:53 ` Patrik Jakobsson
2024-05-07 11:58 ` [PATCH 08/11] drm/i915: Use drm_fbdev_helper_client_unregister() Thomas Zimmermann
2024-05-07 12:25 ` Rodrigo Vivi
2024-05-07 13:10 ` Thomas Zimmermann
2024-05-07 11:58 ` [PATCH 09/11] drm/msm: Use fbdev client helpers Thomas Zimmermann
2024-05-07 14:36 ` Dmitry Baryshkov
2024-05-07 11:58 ` [PATCH 10/11] drm/omapdrm: " Thomas Zimmermann
2024-05-07 11:58 ` [PATCH 11/11] drm/tegra: " Thomas Zimmermann
2024-05-07 21:03 ` Felix Kuehling [this message]
2024-05-08 6:00 ` 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=b463d432-669c-43a4-933a-cafef000f7da@amd.com \
--to=felix.kuehling@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=alexander.deucher@amd.com \
--cc=alim.akhtar@samsung.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=javierm@redhat.com \
--cc=jonathanh@nvidia.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux@armlinux.org.uk \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marijn.suijten@somainline.org \
--cc=mperttunen@nvidia.com \
--cc=mripard@kernel.org \
--cc=patrik.r.jakobsson@gmail.com \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=rodrigo.vivi@intel.com \
--cc=sean@poorly.run \
--cc=sw0312.kim@samsung.com \
--cc=thierry.reding@gmail.com \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tursulin@ursulin.net \
--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 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 read-only IMAP folder(s) and NNTP newsgroup(s).