Skip to content

Commit 2ef5754

Browse files
Thomas ZimmermannMaarten Lankhorst
authored andcommitted
drm/i915/display: fbdev: Move custom restore code to new callback
i915's fbdev contains code for restoring the client's framebuffer. It is specific to i195 and cannot be ported to the common fbdev client. Introduce the callback struct drm_fb_helper.fb_restore and implement it for i915. The fbdev helpers invoke the callback after restoring the fbdev client. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Maarten Lankhorst <[email protected]>
1 parent f4e4371 commit 2ef5754

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ __drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper,
245245
if (do_delayed)
246246
drm_fb_helper_hotplug_event(fb_helper);
247247

248+
if (fb_helper->funcs->fb_restore)
249+
fb_helper->funcs->fb_restore(fb_helper);
250+
248251
return ret;
249252
}
250253

drivers/gpu/drm/i915/display/intel_fbdev.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,17 @@ static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *cli
278278
return 0;
279279
}
280280

281+
static void intelfb_restore(struct drm_fb_helper *fb_helper)
282+
{
283+
struct intel_fbdev *ifbdev = to_intel_fbdev(fb_helper);
284+
285+
intel_fbdev_invalidate(ifbdev);
286+
}
287+
281288
static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
282289
.fb_probe = intelfb_create,
283290
.fb_dirty = intelfb_dirty,
291+
.fb_restore = intelfb_restore,
284292
};
285293

286294
/*
@@ -518,8 +526,6 @@ static int intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
518526
if (ret)
519527
return ret;
520528

521-
intel_fbdev_invalidate(ifbdev);
522-
523529
return 0;
524530
}
525531

include/drm/drm_fb_helper.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ struct drm_fb_helper_funcs {
9999
* 0 on success, or an error code otherwise.
100100
*/
101101
int (*fb_dirty)(struct drm_fb_helper *helper, struct drm_clip_rect *clip);
102+
103+
/**
104+
* @fb_restore:
105+
*
106+
* Driver callback to restore internal fbdev state. If set, fbdev
107+
* emulation will invoke this callback after restoring the display
108+
* mode.
109+
*
110+
* Only for i915. Do not use in new code.
111+
*
112+
* TODO: Fix i915 to not require this callback.
113+
*/
114+
void (*fb_restore)(struct drm_fb_helper *helper);
102115
};
103116

104117
/**

0 commit comments

Comments
 (0)