From patchwork Sat May 24 01:58:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?St=C3=A9phane_Marchesin?= X-Patchwork-Id: 4236421 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8BD759F1F4 for ; Sat, 24 May 2014 01:58:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88DED202E6 for ; Sat, 24 May 2014 01:58:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A0405202C8 for ; Sat, 24 May 2014 01:58:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4ADED6EF00; Fri, 23 May 2014 18:58:39 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by gabe.freedesktop.org (Postfix) with ESMTP id E22CF6EF00 for ; Fri, 23 May 2014 18:58:37 -0700 (PDT) Received: by mail-pa0-f44.google.com with SMTP id ld10so4837873pab.31 for ; Fri, 23 May 2014 18:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=HFam1H3CyQIL+4Lsr0qYKvEai7iWd5WBvsvuyBgIkLk=; b=fNwHRuEgkhzAKzDGZJ/vTpyYhTZ2rynlUl1h4f8UmC4N9B3j5b3Y3GQPG9eUa36JGh kf5ouOKhCiFzg6rffIN+A6cfy2vlcgj3+61bBh4ENE+cFnH7n+GquomGY2r6Rr0r91o3 BRRW3WJTmfOj+EkHbPz0TViCTjdhL8cj+E8tU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=HFam1H3CyQIL+4Lsr0qYKvEai7iWd5WBvsvuyBgIkLk=; b=N4k/UXplTwqOJN9GUWZwy/KeLsdywq16/EL8VJQ7Pxo1/LxDFeDYjYP2GHo1QVZqlR a5Oyi5V19qMnCoV3hY/axGuHFhhqLFz5LqBPjKr73o5eUcm1OSIR0W8/sQn6gF100eh2 WVYfllzxD1HaI4YX7kQqINCnNZvNCkXhih7B/Ubt979VGwjsnaEdcRISD8xQt2l/8pN3 rt1TB8xeQgE4cNK81zbz3WtIZ+C9qMXroV0loc4Qr/CzW5MSUi4xBnmIIjDSJ+2UfGBY 3Lzw6ADqRK1hwawHjDvAE/pSfhFGpMZAgzvadAFiChyZqQgjJTQYG2r0audB841914ik G4sQ== X-Gm-Message-State: ALoCoQm8yN/si1OWAD1bASUvH8+ocATWbuRNuy3x7hP/8HGWp/aormZ2imOtBarZWjw/nxMNi56Z X-Received: by 10.68.130.6 with SMTP id oa6mr10447060pbb.102.1400896717730; Fri, 23 May 2014 18:58:37 -0700 (PDT) Received: from localhost ([2620:0:1000:1b01:82c1:6eff:fef8:b068]) by mx.google.com with ESMTPSA id yv7sm21596210pac.33.2014.05.23.18.58.36 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 May 2014 18:58:37 -0700 (PDT) From: =?UTF-8?q?St=C3=A9phane=20Marchesin?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] drm/tegra: Align FB pitch Date: Fri, 23 May 2014 18:58:32 -0700 Message-Id: <1400896714-7092-1-git-send-email-marcheu@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a MIME-Version: 1.0 Cc: =?UTF-8?q?St=C3=A9phane=20Marchesin?= , treding@nvidia.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The display controller doesn't handle non-256 byte aligned buffer pitches. If you give it an unaligned buffer, it will stop after the first line and will report underflows in the debug registers (DC_WINBUF_UFLOW_STATUS and friends). So let's make sure that all our framebuffer pitches are 256-byte aligned. Signed-off-by: Stéphane Marchesin --- drivers/gpu/drm/tegra/drm.h | 2 ++ drivers/gpu/drm/tegra/fb.c | 3 ++- drivers/gpu/drm/tegra/gem.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 126332c..6753598 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -251,6 +251,8 @@ static inline int tegra_output_check_mode(struct tegra_output *output, return output ? -ENOSYS : -EINVAL; } +#define DC_PITCH_ALIGNMENT 256 + /* from bus.c */ int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device); void drm_host1x_exit(struct drm_driver *driver, struct host1x_device *device); diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index f7fca09..691e83e 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -207,7 +207,8 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, cmd.width = sizes->surface_width; cmd.height = sizes->surface_height; - cmd.pitches[0] = sizes->surface_width * bytes_per_pixel; + cmd.pitches[0] = round_up(sizes->surface_width * bytes_per_pixel, + DC_PITCH_ALIGNMENT); cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth); diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index bcf9895..9a92a9b 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -16,6 +16,7 @@ #include #include +#include "drm.h" #include "gem.h" static inline struct tegra_bo *host1x_to_tegra_bo(struct host1x_bo *bo) @@ -260,6 +261,7 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm, int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8); struct tegra_bo *bo; + min_pitch = round_up(min_pitch, DC_PITCH_ALIGNMENT); if (args->pitch < min_pitch) args->pitch = min_pitch;