From: Thomas Zimmermann <tzimmermann@suse.de>
To: alexander.deucher@amd.com, christian.koenig@amd.com,
Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch,
javierm@redhat.com
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 07/10] drm/radeon: Move fbdev cleanup code into fb_destroy callback
Date: Thu, 16 Mar 2023 10:37:35 +0100 [thread overview]
Message-ID: <20230316093738.28866-8-tzimmermann@suse.de> (raw)
In-Reply-To: <20230316093738.28866-1-tzimmermann@suse.de>
Fbdev calls struct fb_ops.fb_destroy after cleaning up the final
reference to an fbdev framebuffer. Move radeon's fbdev cleanup code
there.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/radeon/radeon_fb.c | 43 +++++++++++++++---------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index f55aaea10406..d85f99b5aa49 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -173,6 +173,25 @@ static int radeon_fbdev_fb_release(struct fb_info *info, int user)
return 0;
}
+static void radeon_fbdev_fb_destroy(struct fb_info *info)
+{
+ struct drm_fb_helper *fb_helper = info->par;
+ struct drm_framebuffer *fb = fb_helper->fb;
+
+ if (fb) {
+ if (fb->obj[0]) {
+ radeon_fbdev_destroy_pinned_object(fb->obj[0]);
+ fb->obj[0] = NULL;
+ drm_framebuffer_unregister_private(fb);
+ drm_framebuffer_cleanup(fb);
+ }
+ kfree(fb);
+ fb_helper->fb = NULL;
+ }
+
+ drm_fb_helper_fini(fb_helper);
+}
+
static const struct fb_ops radeon_fbdev_fb_ops = {
.owner = THIS_MODULE,
DRM_FB_HELPER_DEFAULT_OPS,
@@ -183,6 +202,7 @@ static const struct fb_ops radeon_fbdev_fb_ops = {
.fb_fillrect = drm_fb_helper_cfb_fillrect,
.fb_copyarea = drm_fb_helper_cfb_copyarea,
.fb_imageblit = drm_fb_helper_cfb_imageblit,
+ .fb_destroy = radeon_fbdev_fb_destroy,
};
/*
@@ -277,27 +297,6 @@ static int radeon_fbdev_fb_helper_fb_probe(struct drm_fb_helper *fb_helper,
return ret;
}
-static int radeon_fbdev_destroy(struct drm_device *dev, struct drm_fb_helper *fb_helper)
-{
- struct drm_framebuffer *fb = fb_helper->fb;
-
- drm_fb_helper_unregister_info(fb_helper);
-
- if (fb) {
- if (fb->obj[0]) {
- radeon_fbdev_destroy_pinned_object(fb->obj[0]);
- fb->obj[0] = NULL;
- drm_framebuffer_unregister_private(fb);
- drm_framebuffer_cleanup(fb);
- }
- kfree(fb);
- fb_helper->fb = NULL;
- }
- drm_fb_helper_fini(fb_helper);
-
- return 0;
-}
-
static const struct drm_fb_helper_funcs radeon_fbdev_fb_helper_funcs = {
.fb_probe = radeon_fbdev_fb_helper_fb_probe,
};
@@ -351,7 +350,7 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
if (!rdev->ddev->fb_helper)
return;
- radeon_fbdev_destroy(rdev->ddev, rdev->ddev->fb_helper);
+ drm_fb_helper_unregister_info(rdev->ddev->fb_helper);
drm_fb_helper_unprepare(rdev->ddev->fb_helper);
kfree(rdev->ddev->fb_helper);
rdev->ddev->fb_helper = NULL;
--
2.39.2
next prev parent reply other threads:[~2023-03-16 9:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 9:37 [PATCH 00/10] drm/radeon: Convert fbdev to DRM client Thomas Zimmermann
2023-03-16 9:37 ` [PATCH 01/10] drm/radeon: Move radeon_align_pitch() next to dumb-buffer helpers Thomas Zimmermann
2023-03-16 9:37 ` [PATCH 02/10] drm/radeon: Improve fbdev object-test helper Thomas Zimmermann
2023-03-16 9:37 ` [PATCH 03/10] drm/radeon: Remove struct radeon_fbdev Thomas Zimmermann
2023-03-16 9:37 ` [PATCH 04/10] drm/radeon: Remove test for !screen_base in fbdev probing Thomas Zimmermann
2023-03-16 9:37 ` [PATCH 05/10] drm/radeon: Move fbdev object helpers before struct fb_ops et al Thomas Zimmermann
2023-03-16 9:37 ` [PATCH 06/10] drm/radeon: Fix coding style in fbdev emulation Thomas Zimmermann
2023-03-16 9:37 ` Thomas Zimmermann [this message]
2023-03-16 9:37 ` [PATCH 08/10] drm/radeon: Correctly clean up failed display probing Thomas Zimmermann
2023-03-16 9:37 ` [PATCH 09/10] drm/radeon: Implement client-based fbdev emulation Thomas Zimmermann
2023-03-16 9:37 ` [PATCH 10/10] drm/radeon: Only build fbdev if DRM_FBDEV_EMULATION is set Thomas Zimmermann
2023-03-17 8:53 ` [PATCH 00/10] drm/radeon: Convert fbdev to DRM client Christian König
2023-03-17 9:20 ` Thomas Zimmermann
2023-03-20 15:11 ` Christian König
2023-03-20 15:19 ` Thomas Zimmermann
2023-03-20 15:23 ` Alex Deucher
2023-03-21 9:33 ` Thomas Zimmermann
2023-03-24 21:44 ` Alex Deucher
2023-03-27 22:39 ` Alex Deucher
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=20230316093738.28866-8-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
/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).