Re: drm/fbdev-dma: regression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

Am 11.11.24 um 14:42 schrieb Nuno Gonçalves:
On Mon, Nov 11, 2024 at 1:22 PM Thomas Zimmermann <tzimmermann@xxxxxxx> wrote:
The patch in question changes the whole memory management of the
affected code. It's also noteworthy that most of it has been reworked
for the upcoming v6.12. Maybe this already fixed the problem. Kernel
v6.11-rc7 added commit 5a498d4d06d6 ("drm/fbdev-dma: Only install
deferred I/O if necessary"), which possibly fixes the problem as well.

But there's no explicit fix for this problem and I have not seen any
other related reports. Any further information is welcome.
Issue was present since 5ab91447aa13b8b98bc11f5326f33500b0ee2c48 and
tested until 6.12-rc3.
Is there any suggestion on how to dig down?

Here's a first attempt to address this bug. Could you please apply the attached patch and report on the results? It should work against the upcoming v6.13-rc1 or against a recent drm-misc-next.

Best regards
Thomas


Thanks

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
From 40d481266497437ebaa5312c9af9641361b172f8 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <tzimmermann@xxxxxxx>
Date: Thu, 28 Nov 2024 14:25:03 +0100
Subject: [PATCH] fbdev-dma: Support deferred I/O without smem_start

Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
---
 drivers/gpu/drm/drm_fbdev_dma.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index b14b581c059d..6a94d1b62479 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -8,6 +8,7 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_dma_helper.h>
+#include <drm/drm_gem_framebuffer_helper.h>
 
 /*
  * struct fb_ops
@@ -124,6 +125,28 @@ static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = {
 	.fb_dirty = drm_fbdev_dma_helper_fb_dirty,
 };
 
+static struct page *drm_fbdev_dma_get_page(struct fb_info *info, unsigned long offset)
+{
+	struct drm_fb_helper *fb_helper = info->par;
+	struct drm_framebuffer *fb = fb_helper->fb;
+	struct drm_gem_object *obj = drm_gem_fb_get_obj(fb, 0);
+	const void *addr = info->screen_buffer + offset;
+	struct page *page = NULL;
+
+	if (fb_WARN_ON_ONCE(info, offset > obj->size))
+		return NULL;
+
+	if (is_vmalloc_addr(addr))
+		page = vmalloc_to_page(addr);
+	else if (virt_addr_valid(addr))
+		page = virt_to_page(addr);
+
+	if (!fb_WARN_ON_ONCE(info, !page))
+		get_page(page);
+
+	return page;
+}
+
 /*
  * struct drm_fb_helper
  */
@@ -217,6 +240,7 @@ int drm_fbdev_dma_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
 	/* deferred I/O */
 	if (use_deferred_io) {
 		fb_helper->fbdefio.delay = HZ / 20;
+		fb_helper->fbdefio.get_page = drm_fbdev_dma_get_page;
 		fb_helper->fbdefio.deferred_io = drm_fb_helper_deferred_io;
 
 		info->fbdefio = &fb_helper->fbdefio;
-- 
2.47.0


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux