From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesse Barnes Subject: [PATCH 1/5] drm/i915: make pitch_for_width take a tiled arg Date: Wed, 13 Nov 2013 10:20:44 -0800 Message-ID: <1384366848-845-2-git-send-email-jbarnes@virtuousgeek.org> References: <1384366848-845-1-git-send-email-jbarnes@virtuousgeek.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from oproxy16-pub.mail.unifiedlayer.com (oproxy16-pub.mail.unifiedlayer.com [69.89.22.201]) by gabe.freedesktop.org (Postfix) with SMTP id 2162CFB21F for ; Wed, 13 Nov 2013 10:20:52 -0800 (PST) Received: from [67.161.37.189] (port=39119 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.82) (envelope-from ) id 1Vgf3a-0005An-U9 for intel-gfx@lists.freedesktop.org; Wed, 13 Nov 2013 11:20:51 -0700 In-Reply-To: <1384366848-845-1-git-send-email-jbarnes@virtuousgeek.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org And move it up in the file for earlier usage. Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 2df2366..d4cc00c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -5452,6 +5452,17 @@ static void vlv_crtc_clock_get(struct intel_crtc *crtc, pipe_config->port_clock = clock.dot / 5; } +static u32 +intel_framebuffer_pitch_for_width(int width, int bpp, bool tiled) +{ + u32 pitch = DIV_ROUND_UP(width * bpp, 8); + + if (tiled) + return ALIGN(pitch, 512); + else + return ALIGN(pitch, 64); +} + static bool i9xx_get_pipe_config(struct intel_crtc *crtc, struct intel_crtc_config *pipe_config) { @@ -7629,16 +7640,10 @@ 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) { - u32 pitch = intel_framebuffer_pitch_for_width(mode->hdisplay, bpp); + u32 pitch = intel_framebuffer_pitch_for_width(mode->hdisplay, bpp, + false); return ALIGN(pitch * mode->vdisplay, PAGE_SIZE); } @@ -7658,7 +7663,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev, mode_cmd.width = mode->hdisplay; mode_cmd.height = mode->vdisplay; mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(mode_cmd.width, - bpp); + bpp, false); mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth); return intel_framebuffer_create(dev, &mode_cmd, obj); @@ -7682,7 +7687,8 @@ mode_fits_in_fbdev(struct drm_device *dev, fb = &dev_priv->fbdev->ifb.base; if (fb->pitches[0] < intel_framebuffer_pitch_for_width(mode->hdisplay, - fb->bits_per_pixel)) + fb->bits_per_pixel, + false)) return NULL; if (obj->base.size < mode->vdisplay * fb->pitches[0]) -- 1.8.4.2