All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/nv50: align size of buffer object to the right boundaries.
@ 2009-12-27 11:41 Maarten Maathuis
       [not found] ` <1261914064-3535-1-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Maarten Maathuis @ 2009-12-27 11:41 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

- Depth and stencil buffers are supposed to be large enough in general.

Signed-off-by: Maarten Maathuis <madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/gpu/drm/nouveau/nouveau_bo.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index e342a41..9fc4bd6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -65,8 +65,9 @@ nouveau_bo_fixup_align(struct drm_device *dev,
 
 	/*
 	 * Some of the tile_flags have a periodic structure of N*4096 bytes,
-	 * align to to that as well as the page size. Overallocate memory to
-	 * avoid corruption of other buffer objects.
+	 * align to to that as well as the page size. Align the size to the
+	 * appropriate boundaries. This does imply that sizes are rounded up
+	 * 3-7 pages, so make sure your "special" buffer sizes are large enough.
 	 */
 	if (dev_priv->card_type == NV_50) {
 		uint32_t block_size = nouveau_mem_fb_amount(dev) >> 15;
@@ -77,22 +78,20 @@ nouveau_bo_fixup_align(struct drm_device *dev,
 		case 0x2800:
 		case 0x4800:
 		case 0x7a00:
-			*size = roundup(*size, block_size);
 			if (is_power_of_2(block_size)) {
-				*size += 3 * block_size;
 				for (i = 1; i < 10; i++) {
 					*align = 12 * i * block_size;
 					if (!(*align % 65536))
 						break;
 				}
 			} else {
-				*size += 6 * block_size;
 				for (i = 1; i < 10; i++) {
 					*align = 8 * i * block_size;
 					if (!(*align % 65536))
 						break;
 				}
 			}
+			*size = roundup(*size, *align);
 			break;
 		default:
 			break;
-- 
1.6.6.rc4

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

end of thread, other threads:[~2009-12-27 21:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-27 11:41 [PATCH 1/2] drm/nv50: align size of buffer object to the right boundaries Maarten Maathuis
     [not found] ` <1261914064-3535-1-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-12-27 11:41   ` [PATCH 2/2] drm/nv50: synchronize user channel after buffer object move on kernel channel Maarten Maathuis
2009-12-27 13:43   ` [PATCH 1/2] drm/nv50: align size of buffer object to the right boundaries Christoph Bumiller
     [not found]     ` <4B37647F.9030402-oe7qfRrRQffzPE21tAIdciO7C/xPubJB@public.gmane.org>
2009-12-27 14:28       ` Maarten Maathuis
     [not found]         ` <6d4bc9fc0912270628l4ccddb11ua1811be230bbb15d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-27 21:36           ` Maarten Maathuis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.