Along with refcounting changes and breakage. --- drivers/gpu/drm/i915/i915_gem_stolen.c | 2 ++ drivers/gpu/drm/i915/intel_display.c | 39 ++++++++++++++++++---------------- drivers/gpu/drm/i915/intel_drv.h | 1 - drivers/gpu/drm/i915/intel_fbdev.c | 19 ++++------------- 4 files changed, 27 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index d284d89..c1625e6 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -420,6 +420,8 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, list_add_tail(&obj->global_list, &dev_priv->mm.bound_list); list_add_tail(&vma->mm_list, &ggtt->inactive_list); + /* the vma also holds a pages reference */ + i915_gem_object_pin_pages(obj); return obj; diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 97acb01..e5821a0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -5508,13 +5508,14 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_gem_object *obj = NULL; struct drm_mode_fb_cmd2 mode_cmd = { 0 }; + struct intel_framebuffer *fb; u32 val, base, offset; int pipe = crtc->pipe, plane = crtc->plane; int fourcc, pixel_format; int aligned_height; - plane_config->fb = kzalloc(sizeof(*plane_config->fb), GFP_KERNEL); - if (!plane_config->fb) { + fb = kzalloc(sizeof(*fb), GFP_KERNEL); + if (!fb) { DRM_DEBUG_KMS("failed to alloc fb\n"); return; } @@ -5527,8 +5528,8 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, pixel_format = val & DISPPLANE_PIXFORMAT_MASK; fourcc = intel_format_to_fourcc(pixel_format); - plane_config->fb->base.pixel_format = fourcc; - plane_config->fb->base.bits_per_pixel = + fb->base.pixel_format = fourcc; + fb->base.bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8; if (INTEL_INFO(dev)->gen >= 4) { @@ -5542,23 +5543,23 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, } val = I915_READ(PIPESRC(pipe)); - plane_config->fb->base.width = ((val >> 16) & 0xfff) + 1; - plane_config->fb->base.height = ((val >> 0) & 0xfff) + 1; + fb->base.width = ((val >> 16) & 0xfff) + 1; + fb->base.height = ((val >> 0) & 0xfff) + 1; val = I915_READ(DSPSTRIDE(pipe)); - plane_config->fb->base.pitches[0] = val & 0xffffff80; + fb->base.pitches[0] = val & 0xffffff80; - aligned_height = intel_align_height(dev, plane_config->fb->base.height, + aligned_height = intel_align_height(dev, fb->base.height, plane_config->tiled); - plane_config->size = ALIGN(plane_config->fb->base.pitches[0] * + plane_config->size = ALIGN(fb->base.pitches[0] * aligned_height, PAGE_SIZE); DRM_DEBUG_KMS("pipe/plane %d/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", - pipe, plane, plane_config->fb->base.width, - plane_config->fb->base.height, - plane_config->fb->base.bits_per_pixel, base, - plane_config->fb->base.pitches[0], + pipe, plane, fb->base.width, + fb->base.height, + fb->base.bits_per_pixel, base, + fb->base.pitches[0], plane_config->size); /* @@ -5571,19 +5572,21 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, return; mode_cmd.pixel_format = fourcc; - mode_cmd.width = plane_config->fb->base.width; - mode_cmd.height = plane_config->fb->base.height; - mode_cmd.pitches[0] = plane_config->fb->base.pitches[0]; + mode_cmd.width = fb->base.width; + mode_cmd.height = fb->base.height; + mode_cmd.pitches[0] = fb->base.pitches[0]; mutex_lock(&dev->struct_mutex); - if (intel_framebuffer_init(dev, plane_config->fb, &mode_cmd, obj)) { + if (intel_framebuffer_init(dev, fb, &mode_cmd, obj)) { DRM_DEBUG_KMS("intel fb init failed\n"); goto out_unref_obj; } + crtc->base.fb = &fb->base; + mutex_unlock(&dev->struct_mutex); - DRM_DEBUG_KMS("plane fb obj %p\n", plane_config->fb->obj); + DRM_DEBUG_KMS("plane fb obj %p\n", fb->obj); return; out_unref_obj: diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index d849a5c..a40109e 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -211,7 +211,6 @@ typedef struct dpll { } intel_clock_t; struct intel_plane_config { - struct intel_framebuffer *fb; /* ends up managed by intel_fbdev.c */ bool tiled; int size; }; diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index a3e8156..2cbfe72 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -388,7 +388,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { intel_crtc = to_intel_crtc(crtc); - if (!intel_crtc->active || !intel_crtc->plane_config.fb) { + if (!intel_crtc->active || !crtc->fb) { DRM_DEBUG_KMS("pipe %c not active or no fb, skipping\n", pipe_name(intel_crtc->pipe)); continue; @@ -397,27 +397,16 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, if (intel_crtc->plane_config.size > last_size) { plane_config = &intel_crtc->plane_config; last_size = plane_config->size; - fb = plane_config->fb; + fb = to_intel_framebuffer(crtc->fb); } } - /* Free unused fbs */ - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - struct intel_framebuffer *cur_fb; - - intel_crtc = to_intel_crtc(crtc); - cur_fb = intel_crtc->plane_config.fb; - - if (cur_fb && cur_fb != fb) - intel_framebuffer_fini(cur_fb); - } - if (!fb) { DRM_DEBUG_KMS("no active pipes found, not using BIOS config\n"); goto out_free; } - ifbdev->preferred_bpp = plane_config->fb->base.bits_per_pixel; + ifbdev->preferred_bpp = fb->base.bits_per_pixel; ifbdev->helper.funcs = &intel_fb_helper_funcs; ifbdev->helper.funcs->initial_config = intel_fb_initial_config; ifbdev->fb = fb; @@ -437,7 +426,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, goto out_unref_obj; crtc->fb = &fb->base; - drm_gem_object_reference(&fb->obj->base); + /* Take a private ref on the fb for fbdev */ drm_framebuffer_reference(&fb->base); } -- 1.8.4.2 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx