public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* BIOS fb wrapping
@ 2013-11-13 18:20 Jesse Barnes
  2013-11-13 18:20 ` [PATCH 1/5] drm/i915: make pitch_for_width take a tiled arg Jesse Barnes
                   ` (4 more replies)
  0 siblings, 5 replies; 27+ messages in thread
From: Jesse Barnes @ 2013-11-13 18:20 UTC (permalink / raw)
  To: intel-gfx

I split these out for clarity and ease of review.  They seem to be
working ok here now, and correctly taking the previous fb and using it.

The memset patch makes plymouth look better on this machine (it doesn't
flicker black near the end).

I haven't tested this on as many configs as the old patchset (dual head,
misc grub configs, etc), so extra testing would also be welcome.

Thanks,
Jesse

^ permalink raw reply	[flat|nested] 27+ messages in thread
* [PATCH 1/5] drm/i915: make pitch_for_width take a tiled arg v2
@ 2013-11-15  0:04 Jesse Barnes
  2013-11-15  0:04 ` [PATCH 4/5] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon Jesse Barnes
  0 siblings, 1 reply; 27+ messages in thread
From: Jesse Barnes @ 2013-11-15  0:04 UTC (permalink / raw)
  To: intel-gfx

And move it up in the file for earlier usage.

v2: add pre-gen4 support as well (Chris)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c | 53 ++++++++++++++++++++++++++----------
 1 file changed, 38 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3b7f1c4..4cab78d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5452,6 +5452,28 @@ static void vlv_crtc_clock_get(struct intel_crtc *crtc,
 	pipe_config->port_clock = clock.dot / 5;
 }
 
+static u32
+intel_framebuffer_pitch_for_width(struct drm_i915_private *dev_priv, int width,
+				  int bpp, bool tiled)
+{
+	u32 pitch = DIV_ROUND_UP(width * bpp, 8);
+	int align;
+
+	if (tiled) {
+		if (INTEL_INFO(dev_priv->dev)->gen < 4) {
+			/* Pre-965 needs power of two tile width */
+			for (align = 512; align < pitch; align <<= 1)
+				;
+		} else {
+			align = 512;
+		}
+	} else {
+		align = 64;
+	}
+
+	return ALIGN(pitch, align);
+}
+
 static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
 				 struct intel_crtc_config *pipe_config)
 {
@@ -7629,16 +7651,12 @@ err:
 }
 
 static u32
-intel_framebuffer_pitch_for_width(int width, int bpp)
-{
-	u32 pitch = DIV_ROUND_UP(width * bpp, 8);
-	return ALIGN(pitch, 64);
-}
-
-static u32
-intel_framebuffer_size_for_mode(struct drm_display_mode *mode, int bpp)
+intel_framebuffer_size_for_mode(struct drm_i915_private *dev_priv,
+				struct drm_display_mode *mode, int bpp)
 {
-	u32 pitch = intel_framebuffer_pitch_for_width(mode->hdisplay, bpp);
+	u32 pitch = intel_framebuffer_pitch_for_width(dev_priv,
+						      mode->hdisplay, bpp,
+						      false);
 	return ALIGN(pitch * mode->vdisplay, PAGE_SIZE);
 }
 
@@ -7647,18 +7665,21 @@ intel_framebuffer_create_for_mode(struct drm_device *dev,
 				  struct drm_display_mode *mode,
 				  int depth, int bpp)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_gem_object *obj;
 	struct drm_mode_fb_cmd2 mode_cmd = { 0 };
+	int size;
 
-	obj = i915_gem_alloc_object(dev,
-				    intel_framebuffer_size_for_mode(mode, bpp));
+	size =  intel_framebuffer_size_for_mode(dev_priv, mode, bpp);
+	obj = i915_gem_alloc_object(dev, size);
 	if (obj == NULL)
 		return ERR_PTR(-ENOMEM);
 
 	mode_cmd.width = mode->hdisplay;
 	mode_cmd.height = mode->vdisplay;
-	mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(mode_cmd.width,
-								bpp);
+	mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(dev_priv,
+								mode_cmd.width,
+								bpp, false);
 	mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);
 
 	return intel_framebuffer_create(dev, &mode_cmd, obj);
@@ -7681,8 +7702,10 @@ mode_fits_in_fbdev(struct drm_device *dev,
 		return NULL;
 
 	fb = &dev_priv->fbdev->ifb.base;
-	if (fb->pitches[0] < intel_framebuffer_pitch_for_width(mode->hdisplay,
-							       fb->bits_per_pixel))
+	if (fb->pitches[0] < intel_framebuffer_pitch_for_width(dev_priv,
+							       mode->hdisplay,
+							       fb->bits_per_pixel,
+							       false))
 		return NULL;
 
 	if (obj->base.size < mode->vdisplay * fb->pitches[0])
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2013-11-22 23:28 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 18:20 BIOS fb wrapping Jesse Barnes
2013-11-13 18:20 ` [PATCH 1/5] drm/i915: make pitch_for_width take a tiled arg Jesse Barnes
2013-11-13 21:59   ` Chris Wilson
2013-11-13 22:06     ` Jesse Barnes
2013-11-13 18:20 ` [PATCH 2/5] drm/i915: retrieve current fb config into new plane_config structure at init Jesse Barnes
2013-11-13 22:10   ` Chris Wilson
2013-11-14 15:06   ` Chris Wilson
2013-11-14 16:09     ` Jesse Barnes
2013-11-20 13:10   ` Ville Syrjälä
2013-11-22 21:55     ` Jesse Barnes
2013-11-22 23:08       ` Ville Syrjälä
2013-11-22 23:21         ` Jesse Barnes
2013-11-22 23:26           ` Ville Syrjälä
2013-11-22 23:29             ` Jesse Barnes
2013-11-13 18:20 ` [PATCH 3/5] drm/i915: split fb allocation and initialization Jesse Barnes
2013-11-13 21:58   ` Chris Wilson
2013-11-13 18:20 ` [PATCH 4/5] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon Jesse Barnes
2013-11-13 22:05   ` Bob Paauwe
2013-11-13 22:08     ` Jesse Barnes
2013-11-13 22:07   ` Chris Wilson
2013-11-13 22:11     ` Jesse Barnes
2013-11-13 18:20 ` [PATCH 5/5] drm/i915: don't memset the fb buffer Jesse Barnes
2013-11-13 21:56   ` Chris Wilson
2013-11-13 22:05     ` Jesse Barnes
  -- strict thread matches above, loose matches on Subject: below --
2013-11-15  0:04 [PATCH 1/5] drm/i915: make pitch_for_width take a tiled arg v2 Jesse Barnes
2013-11-15  0:04 ` [PATCH 4/5] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon Jesse Barnes
2013-11-15  0:29   ` Daniel Vetter
2013-11-15  9:40     ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox