Add drm_fb_helper_vm_page_mkwrite(), a helper to track pages written by fbdev userspace. DRM drivers should use this function to implement fbdev deferred I/O. Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> --- drivers/gpu/drm/drm_fb_helper.c | 10 ++++++++++ include/drm/drm_fb_helper.h | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 9d1140a789f4..6203f5ab33af 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -760,6 +760,16 @@ void drm_fb_helper_deferred_io(struct fb_info *info, } EXPORT_SYMBOL(drm_fb_helper_deferred_io); +vm_fault_t drm_fb_helper_vm_page_mkwrite(struct drm_fb_helper *fb_helper, struct vm_fault *vmf) +{ + struct fb_info *info = fb_helper->fbdev; + + if (!info->fbdefio) + return 0; + return fb_deferred_io_page_mkwrite(info, vmf); +} +EXPORT_SYMBOL(drm_fb_helper_vm_page_mkwrite); + /** * drm_fb_helper_sys_read - wrapper around fb_sys_read * @info: fb_info struct pointer diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 3af4624368d8..8994c65f0b5a 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h @@ -232,6 +232,9 @@ void drm_fb_helper_fill_info(struct fb_info *info, void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagelist); +vm_fault_t drm_fb_helper_vm_page_mkwrite(struct drm_fb_helper *fb_helper, + struct vm_fault *vmf); + ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf, size_t count, loff_t *ppos); ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf, @@ -355,6 +358,12 @@ static inline void drm_fb_helper_deferred_io(struct fb_info *info, { } +static inline vm_fault_t drm_fb_helper_vm_page_mkwrite(struct drm_fb_helper *fb_helper, + struct vm_fault *vmf) +{ + return 0; +} + static inline int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper) { return -ENODEV; -- 2.35.1