Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm-misc-next-fixes-2022-12-08' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

Some deferred-io and damage worker reworks revert and make a fb function
static

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20221208084040.yw4zavsjd25qsltf@houat

+16 -35
+13 -17
drivers/gpu/drm/drm_fb_helper.c
··· 403 403 spin_unlock_irqrestore(&helper->damage_lock, flags); 404 404 } 405 405 406 + static void drm_fb_helper_damage_work(struct work_struct *work) 407 + { 408 + struct drm_fb_helper *helper = container_of(work, struct drm_fb_helper, damage_work); 409 + 410 + drm_fb_helper_fb_dirty(helper); 411 + } 412 + 406 413 /** 407 414 * drm_fb_helper_prepare - setup a drm_fb_helper structure 408 415 * @dev: DRM device ··· 425 418 INIT_LIST_HEAD(&helper->kernel_fb_list); 426 419 spin_lock_init(&helper->damage_lock); 427 420 INIT_WORK(&helper->resume_work, drm_fb_helper_resume_worker); 421 + INIT_WORK(&helper->damage_work, drm_fb_helper_damage_work); 428 422 helper->damage_clip.x1 = helper->damage_clip.y1 = ~0; 429 423 mutex_init(&helper->lock); 430 424 helper->funcs = funcs; ··· 557 549 return; 558 550 559 551 cancel_work_sync(&fb_helper->resume_work); 552 + cancel_work_sync(&fb_helper->damage_work); 560 553 561 554 info = fb_helper->info; 562 555 if (info) { ··· 599 590 static void drm_fb_helper_damage(struct drm_fb_helper *helper, u32 x, u32 y, 600 591 u32 width, u32 height) 601 592 { 602 - struct fb_info *info = helper->info; 603 - 604 593 drm_fb_helper_add_damage_clip(helper, x, y, width, height); 605 594 606 - /* 607 - * The current fbdev emulation only flushes buffers if a damage 608 - * update is necessary. And we can assume that deferred I/O has 609 - * been enabled as damage updates require deferred I/O for mmap. 610 - */ 611 - fb_deferred_io_schedule_flush(info); 595 + schedule_work(&helper->damage_work); 612 596 } 613 597 614 598 /* ··· 666 664 667 665 if (min_off < max_off) { 668 666 drm_fb_helper_memory_range_to_clip(info, min_off, max_off - min_off, &damage_area); 669 - drm_fb_helper_add_damage_clip(helper, damage_area.x1, damage_area.y1, 670 - drm_rect_width(&damage_area), 671 - drm_rect_height(&damage_area)); 667 + drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1, 668 + drm_rect_width(&damage_area), 669 + drm_rect_height(&damage_area)); 672 670 } 673 - 674 - /* 675 - * Flushes all dirty pages from mmap's pageref list and the 676 - * areas that have been written by struct fb_ops callbacks. 677 - */ 678 - drm_fb_helper_fb_dirty(helper); 679 671 } 680 672 EXPORT_SYMBOL(drm_fb_helper_deferred_io); 681 673
-16
drivers/video/fbdev/core/fb_defio.c
··· 332 332 mutex_destroy(&fbdefio->lock); 333 333 } 334 334 EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup); 335 - 336 - void fb_deferred_io_schedule_flush(struct fb_info *info) 337 - { 338 - struct fb_deferred_io *fbdefio = info->fbdefio; 339 - 340 - if (WARN_ON_ONCE(!fbdefio)) 341 - return; /* bug in driver logic */ 342 - 343 - /* 344 - * There's no requirement from callers to schedule the 345 - * flush immediately. Rather schedule the worker with a 346 - * delay and let a few more writes pile up. 347 - */ 348 - schedule_delayed_work(&info->deferred_work, fbdefio->delay); 349 - } 350 - EXPORT_SYMBOL_GPL(fb_deferred_io_schedule_flush);
+2
include/drm/drm_fb_helper.h
··· 116 116 * @damage_clip: clip rectangle used with deferred_io to accumulate damage to 117 117 * the screen buffer 118 118 * @damage_lock: spinlock protecting @damage_clip 119 + * @damage_work: worker used to flush the framebuffer 119 120 * @resume_work: worker used during resume if the console lock is already taken 120 121 * 121 122 * This is the main structure used by the fbdev helpers. Drivers supporting ··· 146 145 u32 pseudo_palette[17]; 147 146 struct drm_clip_rect damage_clip; 148 147 spinlock_t damage_lock; 148 + struct work_struct damage_work; 149 149 struct work_struct resume_work; 150 150 151 151 /**
+1 -2
include/linux/fb.h
··· 663 663 struct inode *inode, 664 664 struct file *file); 665 665 extern void fb_deferred_io_cleanup(struct fb_info *info); 666 - extern void fb_deferred_io_schedule_flush(struct fb_info *info); 667 666 extern int fb_deferred_io_fsync(struct file *file, loff_t start, 668 667 loff_t end, int datasync); 669 668 ··· 806 807 #if defined(CONFIG_VIDEO_NOMODESET) 807 808 bool fb_modesetting_disabled(const char *drvname); 808 809 #else 809 - bool fb_modesetting_disabled(const char *drvname) 810 + static inline bool fb_modesetting_disabled(const char *drvname) 810 811 { 811 812 return false; 812 813 }