dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/tegra: Align FB pitch
@ 2014-05-24  1:58 Stéphane Marchesin
  2014-05-24  1:58 ` [PATCH 2/3] drm/tegra: Support setting the EMC clock Stéphane Marchesin
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stéphane Marchesin @ 2014-05-24  1:58 UTC (permalink / raw)
  To: dri-devel; +Cc: Stéphane Marchesin, treding

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 <marcheu@chromium.org>
---
 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 <linux/dma-buf.h>
 #include <drm/tegra_drm.h>
 
+#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;
 
-- 
1.9.1.423.g4596e3a

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2014-06-05  9:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-24  1:58 [PATCH 1/3] drm/tegra: Align FB pitch Stéphane Marchesin
2014-05-24  1:58 ` [PATCH 2/3] drm/tegra: Support setting the EMC clock Stéphane Marchesin
2014-05-26  9:07   ` Lucas Stach
2014-05-26  9:28     ` Stéphane Marchesin
     [not found]       ` <CACP_E+J-sCsiiSX-apX3ZqWFHVGxgN5FG9eu9-qTjLQHF22DwA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-05-26  9:35         ` Thierry Reding
2014-05-26  9:52           ` Stéphane Marchesin
2014-05-24  1:58 ` [PATCH 3/3] drm/tegra: Don't hardcode link parameters Stéphane Marchesin
2014-06-05  9:40 ` [PATCH 1/3] drm/tegra: Align FB pitch Thierry Reding

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