From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 10/10] convert to using crtc->fb for BIOS fb management
Date: Tue, 17 Dec 2013 14:47:01 -0800 [thread overview]
Message-ID: <1387320421-857-10-git-send-email-jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1387320421-857-1-git-send-email-jbarnes@virtuousgeek.org>
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
prev parent reply other threads:[~2013-12-17 22:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 22:46 [PATCH 01/10] drm/i915/vlv: add early DPIO init v3 Jesse Barnes
2013-12-17 22:46 ` [PATCH 02/10] drm/i915/vlv: split DPIO init and reset Jesse Barnes
2013-12-17 22:46 ` [PATCH 03/10] drm/i915: read out hw state earlier Jesse Barnes
2013-12-17 22:46 ` [PATCH 04/10] drm/i915: split aligned height calculation out Jesse Barnes
2013-12-17 22:46 ` [PATCH 05/10] drm/i915: retrieve current fb config into new plane_config structure at init v8 Jesse Barnes
2013-12-18 10:36 ` Jani Nikula
2013-12-18 16:14 ` Jesse Barnes
2013-12-17 22:46 ` [PATCH 06/10] drm/i915: alloc intel_fb in the intel_fbdev struct Jesse Barnes
2013-12-17 22:46 ` [PATCH 07/10] drm/i915: allow re-use BIOS connector config for initial fbdev config Jesse Barnes
2013-12-17 22:46 ` [PATCH 08/10] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v8 Jesse Barnes
2013-12-17 22:47 ` [PATCH 09/10] port hotplug status live fix for VLV Jesse Barnes
2013-12-17 22:47 ` Jesse Barnes [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387320421-857-10-git-send-email-jbarnes@virtuousgeek.org \
--to=jbarnes@virtuousgeek.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox