Skip to content

Commit ef9e0e2

Browse files
Thomas ZimmermannMaarten Lankhorst
authored andcommitted
drm/i915/display: Move fbdev code around
Move fbdev code around in the source file before switching to DRM's generic fbdev client. This will make the conversion less intrusive. No functional changes. 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 04a1c47 commit ef9e0e2

File tree

1 file changed

+44
-41
lines changed

1 file changed

+44
-41
lines changed

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

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
#include "intel_fbdev_fb.h"
5757
#include "intel_frontbuffer.h"
5858

59+
static int intelfb_create(struct drm_fb_helper *helper,
60+
struct drm_fb_helper_surface_size *sizes);
61+
5962
struct intel_fbdev {
6063
struct intel_framebuffer *fb;
6164
struct i915_vma *vma;
@@ -165,6 +168,47 @@ static const struct fb_ops intelfb_ops = {
165168

166169
__diag_pop();
167170

171+
static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *clip)
172+
{
173+
if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
174+
return 0;
175+
176+
if (helper->fb->funcs->dirty)
177+
return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
178+
179+
return 0;
180+
}
181+
182+
static void intelfb_restore(struct drm_fb_helper *fb_helper)
183+
{
184+
struct intel_fbdev *ifbdev = to_intel_fbdev(fb_helper);
185+
186+
intel_fbdev_invalidate(ifbdev);
187+
}
188+
189+
static void intelfb_set_suspend(struct drm_fb_helper *fb_helper, bool suspend)
190+
{
191+
struct fb_info *info = fb_helper->info;
192+
193+
/*
194+
* When resuming from hibernation, Linux restores the object's
195+
* content from swap if the buffer is backed by shmemfs. If the
196+
* object is stolen however, it will be full of whatever garbage
197+
* was left in there. Clear it to zero in this case.
198+
*/
199+
if (!suspend && !intel_bo_is_shmem(intel_fb_bo(fb_helper->fb)))
200+
memset_io(info->screen_base, 0, info->screen_size);
201+
202+
fb_set_suspend(info, suspend);
203+
}
204+
205+
static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
206+
.fb_probe = intelfb_create,
207+
.fb_dirty = intelfb_dirty,
208+
.fb_restore = intelfb_restore,
209+
.fb_set_suspend = intelfb_set_suspend,
210+
};
211+
168212
static int intelfb_create(struct drm_fb_helper *helper,
169213
struct drm_fb_helper_surface_size *sizes)
170214
{
@@ -268,47 +312,6 @@ static int intelfb_create(struct drm_fb_helper *helper,
268312
return ret;
269313
}
270314

271-
static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *clip)
272-
{
273-
if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
274-
return 0;
275-
276-
if (helper->fb->funcs->dirty)
277-
return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
278-
279-
return 0;
280-
}
281-
282-
static void intelfb_restore(struct drm_fb_helper *fb_helper)
283-
{
284-
struct intel_fbdev *ifbdev = to_intel_fbdev(fb_helper);
285-
286-
intel_fbdev_invalidate(ifbdev);
287-
}
288-
289-
static void intelfb_set_suspend(struct drm_fb_helper *fb_helper, bool suspend)
290-
{
291-
struct fb_info *info = fb_helper->info;
292-
293-
/*
294-
* When resuming from hibernation, Linux restores the object's
295-
* content from swap if the buffer is backed by shmemfs. If the
296-
* object is stolen however, it will be full of whatever garbage
297-
* was left in there. Clear it to zero in this case.
298-
*/
299-
if (!suspend && !intel_bo_is_shmem(intel_fb_bo(fb_helper->fb)))
300-
memset_io(info->screen_base, 0, info->screen_size);
301-
302-
fb_set_suspend(info, suspend);
303-
}
304-
305-
static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
306-
.fb_probe = intelfb_create,
307-
.fb_dirty = intelfb_dirty,
308-
.fb_restore = intelfb_restore,
309-
.fb_set_suspend = intelfb_set_suspend,
310-
};
311-
312315
/*
313316
* Build an intel_fbdev struct using a BIOS allocated framebuffer, if possible.
314317
* The core display code will have read out the current plane configuration,

0 commit comments

Comments
 (0)