|
56 | 56 | #include "intel_fbdev_fb.h"
|
57 | 57 | #include "intel_frontbuffer.h"
|
58 | 58 |
|
| 59 | +static int intelfb_create(struct drm_fb_helper *helper, |
| 60 | + struct drm_fb_helper_surface_size *sizes); |
| 61 | + |
59 | 62 | struct intel_fbdev {
|
60 | 63 | struct intel_framebuffer *fb;
|
61 | 64 | struct i915_vma *vma;
|
@@ -165,6 +168,47 @@ static const struct fb_ops intelfb_ops = {
|
165 | 168 |
|
166 | 169 | __diag_pop();
|
167 | 170 |
|
| 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 | + |
168 | 212 | static int intelfb_create(struct drm_fb_helper *helper,
|
169 | 213 | struct drm_fb_helper_surface_size *sizes)
|
170 | 214 | {
|
@@ -268,47 +312,6 @@ static int intelfb_create(struct drm_fb_helper *helper,
|
268 | 312 | return ret;
|
269 | 313 | }
|
270 | 314 |
|
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 |
| - |
312 | 315 | /*
|
313 | 316 | * Build an intel_fbdev struct using a BIOS allocated framebuffer, if possible.
|
314 | 317 | * The core display code will have read out the current plane configuration,
|
|
0 commit comments