Skip to content

Commit f06a4da

Browse files
committed
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 <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20221208084040.yw4zavsjd25qsltf@houat
2 parents b2268e2 + b02897e commit f06a4da

File tree

4 files changed

+16
-35
lines changed

4 files changed

+16
-35
lines changed

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,13 @@ static void drm_fb_helper_fb_dirty(struct drm_fb_helper *helper)
403403
spin_unlock_irqrestore(&helper->damage_lock, flags);
404404
}
405405

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+
406413
/**
407414
* drm_fb_helper_prepare - setup a drm_fb_helper structure
408415
* @dev: DRM device
@@ -418,6 +425,7 @@ void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
418425
INIT_LIST_HEAD(&helper->kernel_fb_list);
419426
spin_lock_init(&helper->damage_lock);
420427
INIT_WORK(&helper->resume_work, drm_fb_helper_resume_worker);
428+
INIT_WORK(&helper->damage_work, drm_fb_helper_damage_work);
421429
helper->damage_clip.x1 = helper->damage_clip.y1 = ~0;
422430
mutex_init(&helper->lock);
423431
helper->funcs = funcs;
@@ -549,6 +557,7 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
549557
return;
550558

551559
cancel_work_sync(&fb_helper->resume_work);
560+
cancel_work_sync(&fb_helper->damage_work);
552561

553562
info = fb_helper->info;
554563
if (info) {
@@ -590,16 +599,9 @@ static void drm_fb_helper_add_damage_clip(struct drm_fb_helper *helper, u32 x, u
590599
static void drm_fb_helper_damage(struct drm_fb_helper *helper, u32 x, u32 y,
591600
u32 width, u32 height)
592601
{
593-
struct fb_info *info = helper->info;
594-
595602
drm_fb_helper_add_damage_clip(helper, x, y, width, height);
596603

597-
/*
598-
* The current fbdev emulation only flushes buffers if a damage
599-
* update is necessary. And we can assume that deferred I/O has
600-
* been enabled as damage updates require deferred I/O for mmap.
601-
*/
602-
fb_deferred_io_schedule_flush(info);
604+
schedule_work(&helper->damage_work);
603605
}
604606

605607
/*
@@ -664,16 +666,10 @@ void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagerefli
664666

665667
if (min_off < max_off) {
666668
drm_fb_helper_memory_range_to_clip(info, min_off, max_off - min_off, &damage_area);
667-
drm_fb_helper_add_damage_clip(helper, damage_area.x1, damage_area.y1,
668-
drm_rect_width(&damage_area),
669-
drm_rect_height(&damage_area));
669+
drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1,
670+
drm_rect_width(&damage_area),
671+
drm_rect_height(&damage_area));
670672
}
671-
672-
/*
673-
* Flushes all dirty pages from mmap's pageref list and the
674-
* areas that have been written by struct fb_ops callbacks.
675-
*/
676-
drm_fb_helper_fb_dirty(helper);
677673
}
678674
EXPORT_SYMBOL(drm_fb_helper_deferred_io);
679675

drivers/video/fbdev/core/fb_defio.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -332,19 +332,3 @@ void fb_deferred_io_cleanup(struct fb_info *info)
332332
mutex_destroy(&fbdefio->lock);
333333
}
334334
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);

include/drm/drm_fb_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ struct drm_fb_helper_funcs {
116116
* @damage_clip: clip rectangle used with deferred_io to accumulate damage to
117117
* the screen buffer
118118
* @damage_lock: spinlock protecting @damage_clip
119+
* @damage_work: worker used to flush the framebuffer
119120
* @resume_work: worker used during resume if the console lock is already taken
120121
*
121122
* This is the main structure used by the fbdev helpers. Drivers supporting
@@ -145,6 +146,7 @@ struct drm_fb_helper {
145146
u32 pseudo_palette[17];
146147
struct drm_clip_rect damage_clip;
147148
spinlock_t damage_lock;
149+
struct work_struct damage_work;
148150
struct work_struct resume_work;
149151

150152
/**

include/linux/fb.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,6 @@ extern void fb_deferred_io_open(struct fb_info *info,
663663
struct inode *inode,
664664
struct file *file);
665665
extern void fb_deferred_io_cleanup(struct fb_info *info);
666-
extern void fb_deferred_io_schedule_flush(struct fb_info *info);
667666
extern int fb_deferred_io_fsync(struct file *file, loff_t start,
668667
loff_t end, int datasync);
669668

@@ -807,7 +806,7 @@ extern int fb_find_mode(struct fb_var_screeninfo *var,
807806
#if defined(CONFIG_VIDEO_NOMODESET)
808807
bool fb_modesetting_disabled(const char *drvname);
809808
#else
810-
bool fb_modesetting_disabled(const char *drvname)
809+
static inline bool fb_modesetting_disabled(const char *drvname)
811810
{
812811
return false;
813812
}

0 commit comments

Comments
 (0)