27 #include <linux/module.h>
28 #include <linux/kernel.h>
29 #include <linux/errno.h>
30 #include <linux/string.h>
32 #include <linux/tty.h>
43 #include <drm/i915_drm.h>
46 static struct fb_ops intelfb_ops = {
60 static int intelfb_create(
struct intel_fbdev *ifbdev,
88 DRM_ERROR(
"failed to allocate framebuffer\n");
98 DRM_ERROR(
"failed to pin fb: %d\n", ret);
114 fb = &ifbdev->
ifb.base;
122 info->
fbops = &intelfb_ops;
135 info->
apertures->ranges[0].base = dev->mode_config.fb_base;
139 info->
fix.smem_start = dev->mode_config.fb_base + obj->
gtt_offset;
158 DRM_DEBUG_KMS(
"allocated %dx%d fb: 0x%08x, bo %p\n",
170 drm_gem_object_unreference(&obj->
base);
176 static int intel_fb_find_or_create_single(
struct drm_fb_helper *helper,
184 ret = intelfb_create(ifbdev, sizes);
195 .fb_probe = intel_fb_find_or_create_single,
198 static void intel_fbdev_destroy(
struct drm_device *dev,
204 if (ifbdev->
helper.fbdev) {
205 info = ifbdev->
helper.fbdev;
217 drm_gem_object_unreference_unlocked(&ifb->
obj->base);
232 dev_priv->
fbdev = ifbdev;
233 ifbdev->
helper.funcs = &intel_fb_helper_funcs;
251 if (!dev_priv->
fbdev)
254 intel_fbdev_destroy(dev, dev_priv->
fbdev);
262 if (!dev_priv->
fbdev)
287 DRM_DEBUG(
"failed to restore crtc mode\n");
291 plane->
funcs->disable_plane(plane);