All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/fb-helper: Mark screen buffers in system memory with FB_VIRTFB
@ 2022-01-27 10:26 Thomas Zimmermann
  2022-01-27 10:29 ` Thomas Zimmermann
  2022-01-27 11:42 ` Daniel Vetter
  0 siblings, 2 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2022-01-27 10:26 UTC (permalink / raw)
  To: daniel, airlied, mripard, maarten.lankhorst; +Cc: Thomas Zimmermann, dri-devel

Mark screen buffers in system memory with FB_VIRTFB. Otherwise, the
buffers are mmap'ed as I/O memory (i.e., VM_IO). For shadow buffers,
also set the FB_READS_FAST hint.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_fb_helper.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index ed43b987d306..f15127a32f7a 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2346,6 +2346,7 @@ static int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
 	fbi->fbops = &drm_fbdev_fb_ops;
 	fbi->screen_size = sizes->surface_height * fb->pitches[0];
 	fbi->fix.smem_len = fbi->screen_size;
+	fbi->flags = FBINFO_DEFAULT;
 
 	drm_fb_helper_fill_info(fbi, fb_helper, sizes);
 
@@ -2353,19 +2354,21 @@ static int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
 		fbi->screen_buffer = vzalloc(fbi->screen_size);
 		if (!fbi->screen_buffer)
 			return -ENOMEM;
+		fbi->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
 
 		fbi->fbdefio = &drm_fbdev_defio;
-
 		fb_deferred_io_init(fbi);
 	} else {
 		/* buffer is mapped for HW framebuffer */
 		ret = drm_client_buffer_vmap(fb_helper->buffer, &map);
 		if (ret)
 			return ret;
-		if (map.is_iomem)
+		if (map.is_iomem) {
 			fbi->screen_base = map.vaddr_iomem;
-		else
+		} else {
 			fbi->screen_buffer = map.vaddr;
+			fbi->flags |= FBINFO_VIRTFB;
+		}
 
 		/*
 		 * Shamelessly leak the physical address to user-space. As
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-28 15:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 10:26 [PATCH] drm/fb-helper: Mark screen buffers in system memory with FB_VIRTFB Thomas Zimmermann
2022-01-27 10:29 ` Thomas Zimmermann
2022-01-27 11:42 ` Daniel Vetter
2022-01-27 11:58   ` Thomas Zimmermann
2022-01-27 15:03     ` Daniel Vetter
2022-01-27 15:18       ` Thomas Zimmermann
2022-01-28 11:00         ` Daniel Vetter
2022-01-28 11:36           ` Thomas Zimmermann
2022-01-28 15:58             ` Daniel Vetter

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.