Commit 747bda7b authored by Thomas Zimmermann's avatar Thomas Zimmermann

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240419083331.7761-8-tzimmermann@suse.de
parent 1ecbc7dd
...@@ -25,9 +25,13 @@ ...@@ -25,9 +25,13 @@
static struct page *fb_deferred_io_get_page(struct fb_info *info, unsigned long offs) 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; const void *screen_buffer = info->screen_buffer;
struct page *page = NULL; struct page *page = NULL;
if (fbdefio->get_page)
return fbdefio->get_page(info, offs);
if (is_vmalloc_addr(screen_buffer + offs)) if (is_vmalloc_addr(screen_buffer + offs))
page = vmalloc_to_page(screen_buffer + offs); page = vmalloc_to_page(screen_buffer + offs);
else if (info->fix.smem_start) else if (info->fix.smem_start)
......
...@@ -225,6 +225,7 @@ struct fb_deferred_io { ...@@ -225,6 +225,7 @@ struct fb_deferred_io {
struct mutex lock; /* mutex that protects the pageref list */ struct mutex lock; /* mutex that protects the pageref list */
struct list_head pagereflist; /* list of pagerefs for touched pages */ struct list_head pagereflist; /* list of pagerefs for touched pages */
/* callback */ /* callback */
struct page *(*get_page)(struct fb_info *info, unsigned long offset);
void (*deferred_io)(struct fb_info *info, struct list_head *pagelist); void (*deferred_io)(struct fb_info *info, struct list_head *pagelist);
}; };
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment