diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_fbdev.c')
| -rw-r--r-- | drivers/gpu/drm/i915/intel_fbdev.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index ab8d09a81f14..4babefc51eb2 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
| @@ -150,10 +150,10 @@ static int intelfb_alloc(struct drm_fb_helper *helper, | |||
| 150 | if (size * 2 < ggtt->stolen_usable_size) | 150 | if (size * 2 < ggtt->stolen_usable_size) |
| 151 | obj = i915_gem_object_create_stolen(dev, size); | 151 | obj = i915_gem_object_create_stolen(dev, size); |
| 152 | if (obj == NULL) | 152 | if (obj == NULL) |
| 153 | obj = i915_gem_alloc_object(dev, size); | 153 | obj = i915_gem_object_create(dev, size); |
| 154 | if (!obj) { | 154 | if (IS_ERR(obj)) { |
| 155 | DRM_ERROR("failed to allocate framebuffer\n"); | 155 | DRM_ERROR("failed to allocate framebuffer\n"); |
| 156 | ret = -ENOMEM; | 156 | ret = PTR_ERR(obj); |
| 157 | goto out; | 157 | goto out; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| @@ -186,9 +186,11 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
| 186 | struct i915_ggtt *ggtt = &dev_priv->ggtt; | 186 | struct i915_ggtt *ggtt = &dev_priv->ggtt; |
| 187 | struct fb_info *info; | 187 | struct fb_info *info; |
| 188 | struct drm_framebuffer *fb; | 188 | struct drm_framebuffer *fb; |
| 189 | struct i915_vma *vma; | ||
| 189 | struct drm_i915_gem_object *obj; | 190 | struct drm_i915_gem_object *obj; |
| 190 | int size, ret; | ||
| 191 | bool prealloc = false; | 191 | bool prealloc = false; |
| 192 | void *vaddr; | ||
| 193 | int ret; | ||
| 192 | 194 | ||
| 193 | if (intel_fb && | 195 | if (intel_fb && |
| 194 | (sizes->fb_width > intel_fb->base.width || | 196 | (sizes->fb_width > intel_fb->base.width || |
| @@ -214,7 +216,6 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
| 214 | } | 216 | } |
| 215 | 217 | ||
| 216 | obj = intel_fb->obj; | 218 | obj = intel_fb->obj; |
| 217 | size = obj->base.size; | ||
| 218 | 219 | ||
| 219 | mutex_lock(&dev->struct_mutex); | 220 | mutex_lock(&dev->struct_mutex); |
| 220 | 221 | ||
| @@ -244,22 +245,23 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
| 244 | info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT; | 245 | info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT; |
| 245 | info->fbops = &intelfb_ops; | 246 | info->fbops = &intelfb_ops; |
| 246 | 247 | ||
| 248 | vma = i915_gem_obj_to_ggtt(obj); | ||
| 249 | |||
| 247 | /* setup aperture base/size for vesafb takeover */ | 250 | /* setup aperture base/size for vesafb takeover */ |
| 248 | info->apertures->ranges[0].base = dev->mode_config.fb_base; | 251 | info->apertures->ranges[0].base = dev->mode_config.fb_base; |
| 249 | info->apertures->ranges[0].size = ggtt->mappable_end; | 252 | info->apertures->ranges[0].size = ggtt->mappable_end; |
| 250 | 253 | ||
| 251 | info->fix.smem_start = dev->mode_config.fb_base + i915_gem_obj_ggtt_offset(obj); | 254 | info->fix.smem_start = dev->mode_config.fb_base + vma->node.start; |
| 252 | info->fix.smem_len = size; | 255 | info->fix.smem_len = vma->node.size; |
| 253 | 256 | ||
| 254 | info->screen_base = | 257 | vaddr = i915_vma_pin_iomap(vma); |
| 255 | ioremap_wc(ggtt->mappable_base + i915_gem_obj_ggtt_offset(obj), | 258 | if (IS_ERR(vaddr)) { |
| 256 | size); | ||
| 257 | if (!info->screen_base) { | ||
| 258 | DRM_ERROR("Failed to remap framebuffer into virtual memory\n"); | 259 | DRM_ERROR("Failed to remap framebuffer into virtual memory\n"); |
| 259 | ret = -ENOSPC; | 260 | ret = PTR_ERR(vaddr); |
| 260 | goto out_destroy_fbi; | 261 | goto out_destroy_fbi; |
| 261 | } | 262 | } |
| 262 | info->screen_size = size; | 263 | info->screen_base = vaddr; |
| 264 | info->screen_size = vma->node.size; | ||
| 263 | 265 | ||
| 264 | /* This driver doesn't need a VT switch to restore the mode on resume */ | 266 | /* This driver doesn't need a VT switch to restore the mode on resume */ |
| 265 | info->skip_vt_switch = true; | 267 | info->skip_vt_switch = true; |
| @@ -287,7 +289,7 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
| 287 | out_destroy_fbi: | 289 | out_destroy_fbi: |
| 288 | drm_fb_helper_release_fbi(helper); | 290 | drm_fb_helper_release_fbi(helper); |
| 289 | out_unpin: | 291 | out_unpin: |
| 290 | i915_gem_object_ggtt_unpin(obj); | 292 | intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0)); |
| 291 | out_unlock: | 293 | out_unlock: |
| 292 | mutex_unlock(&dev->struct_mutex); | 294 | mutex_unlock(&dev->struct_mutex); |
| 293 | return ret; | 295 | return ret; |
| @@ -488,10 +490,10 @@ retry: | |||
| 488 | } | 490 | } |
| 489 | crtcs[i] = new_crtc; | 491 | crtcs[i] = new_crtc; |
| 490 | 492 | ||
| 491 | DRM_DEBUG_KMS("connector %s on pipe %c [CRTC:%d]: %dx%d%s\n", | 493 | DRM_DEBUG_KMS("connector %s on [CRTC:%d:%s]: %dx%d%s\n", |
| 492 | connector->name, | 494 | connector->name, |
| 493 | pipe_name(to_intel_crtc(connector->state->crtc)->pipe), | ||
| 494 | connector->state->crtc->base.id, | 495 | connector->state->crtc->base.id, |
| 496 | connector->state->crtc->name, | ||
| 495 | modes[i]->hdisplay, modes[i]->vdisplay, | 497 | modes[i]->hdisplay, modes[i]->vdisplay, |
| 496 | modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" :""); | 498 | modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" :""); |
| 497 | 499 | ||
| @@ -550,7 +552,10 @@ static void intel_fbdev_destroy(struct drm_device *dev, | |||
| 550 | drm_fb_helper_fini(&ifbdev->helper); | 552 | drm_fb_helper_fini(&ifbdev->helper); |
| 551 | 553 | ||
| 552 | if (ifbdev->fb) { | 554 | if (ifbdev->fb) { |
| 553 | drm_framebuffer_unregister_private(&ifbdev->fb->base); | 555 | mutex_lock(&dev->struct_mutex); |
| 556 | intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0)); | ||
| 557 | mutex_unlock(&dev->struct_mutex); | ||
| 558 | |||
| 554 | drm_framebuffer_remove(&ifbdev->fb->base); | 559 | drm_framebuffer_remove(&ifbdev->fb->base); |
| 555 | } | 560 | } |
| 556 | } | 561 | } |
| @@ -717,8 +722,6 @@ int intel_fbdev_init(struct drm_device *dev) | |||
| 717 | return ret; | 722 | return ret; |
| 718 | } | 723 | } |
| 719 | 724 | ||
| 720 | ifbdev->helper.atomic = true; | ||
| 721 | |||
| 722 | dev_priv->fbdev = ifbdev; | 725 | dev_priv->fbdev = ifbdev; |
| 723 | INIT_WORK(&dev_priv->fbdev_suspend_work, intel_fbdev_suspend_worker); | 726 | INIT_WORK(&dev_priv->fbdev_suspend_work, intel_fbdev_suspend_worker); |
| 724 | 727 | ||
