dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/omap: fix tiled buffer stride calculations
@ 2017-05-18 10:28 Tomi Valkeinen
  2017-05-18 10:59 ` Laurent Pinchart
  0 siblings, 1 reply; 7+ messages in thread
From: Tomi Valkeinen @ 2017-05-18 10:28 UTC (permalink / raw)
  To: dri-devel, Laurent Pinchart; +Cc: Tomi Valkeinen, Jyri Sarha

omap_gem uses page alignment for buffer stride. The related calculations
are a bit off, though, as byte stride of 4096 gets aligned to 8192,
instead of 4096. This patch fixes those calculations.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 13abf221d153..4c41000ff4c4 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj,
 	size_t size = PAGE_SIZE * n;
 	loff_t off = mmap_offset(obj) +
 			(entry->obj_pgoff << PAGE_SHIFT);
-	const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE);
+	const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE);
 
 	if (m > 1) {
 		int i;
@@ -424,7 +424,7 @@ static int fault_2d(struct drm_gem_object *obj,
 	 * into account in some of the math, so figure out virtual stride
 	 * in pages
 	 */
-	const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE);
+	const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE);
 
 	/* We don't use vmf->pgoff since that has the fake offset: */
 	pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
-- 
2.7.4

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

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

end of thread, other threads:[~2017-05-18 12:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-18 10:28 [PATCH] drm/omap: fix tiled buffer stride calculations Tomi Valkeinen
2017-05-18 10:59 ` Laurent Pinchart
2017-05-18 11:14   ` Tomi Valkeinen
2017-05-18 11:25     ` Laurent Pinchart
2017-05-18 11:34       ` Tomi Valkeinen
2017-05-18 12:32         ` Laurent Pinchart
2017-05-18 11:32     ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).