diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2024-04-19 10:29:00 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2024-05-02 11:33:14 +0200 |
commit | 747bda7bb5b1644a06734900326847a5d353c448 (patch) | |
tree | 5e42495aa07faf354aaa93b3317ffcf7efa057c8 | |
parent | 1ecbc7dd29020d335e1f6f789c23b36a84cd5214 (diff) | |
download | linux-747bda7bb5b1644a06734900326847a5d353c448.tar.gz linux-747bda7bb5b1644a06734900326847a5d353c448.tar.bz2 linux-747bda7bb5b1644a06734900326847a5d353c448.zip |
fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io
Add a callback for drivers to provide framebuffer pages to fbdev's
deferred-I/O helpers. Implementations need to acquire a reference on
the page before returning it. Returning NULL generates a SIGBUS
signal.
This will be useful for DRM's fbdev emulation with GEM-shmem buffer
objects.
v2:
- fix typo in commit message (Javier)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240419083331.7761-8-tzimmermann@suse.de
-rw-r--r-- | drivers/video/fbdev/core/fb_defio.c | 4 | ||||
-rw-r--r-- | include/linux/fb.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c index c68c51d0ef70..5ee7e78c2cea 100644 --- a/drivers/video/fbdev/core/fb_defio.c +++ b/drivers/video/fbdev/core/fb_defio.c @@ -25,9 +25,13 @@ static struct page *fb_deferred_io_get_page(struct fb_info *info, unsigned long offs) { + struct fb_deferred_io *fbdefio = info->fbdefio; const void *screen_buffer = info->screen_buffer; struct page *page = NULL; + if (fbdefio->get_page) + return fbdefio->get_page(info, offs); + if (is_vmalloc_addr(screen_buffer + offs)) page = vmalloc_to_page(screen_buffer + offs); else if (info->fix.smem_start) diff --git a/include/linux/fb.h b/include/linux/fb.h index 811e47f9d1c3..5358edbb9c0b 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -225,6 +225,7 @@ struct fb_deferred_io { struct mutex lock; /* mutex that protects the pageref list */ struct list_head pagereflist; /* list of pagerefs for touched pages */ /* callback */ + struct page *(*get_page)(struct fb_info *info, unsigned long offset); void (*deferred_io)(struct fb_info *info, struct list_head *pagelist); }; #endif |