Mesa (gallium-fb-dimensions): nv: attempt to update for framebuffer changes

Keith Whitwell keithw at kemper.freedesktop.org
Thu Jan 7 16:28:59 UTC 2010


Module: Mesa
Branch: gallium-fb-dimensions
Commit: 8ad9cbfe69dabc57b17dc74dc6f0796f34ae343a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ad9cbfe69dabc57b17dc74dc6f0796f34ae343a

Author: Keith Whitwell <keithw at vmware.com>
Date:   Thu Jan  7 16:28:00 2010 +0000

nv: attempt to update for framebuffer changes

---

 src/gallium/drivers/nv30/nv30_state_fb.c |   13 ++++++++-----
 src/gallium/drivers/nv40/nv40_state.c    |    3 +++
 src/gallium/drivers/nv40/nv40_state_fb.c |   12 +++++++-----
 src/gallium/drivers/nv50/nv50_state.c    |    4 +++-
 4 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c
index 2ed2ea5..d621628 100644
--- a/src/gallium/drivers/nv30/nv30_state_fb.c
+++ b/src/gallium/drivers/nv30/nv30_state_fb.c
@@ -12,11 +12,12 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
 	int i, colour_format = 0, zeta_format = 0, depth_only = 0;
 	struct nouveau_stateobj *so = so_new(12, 18, 10);
 	unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
-	unsigned w = fb->width;
-	unsigned h = fb->height;
+	unsigned w, h;
 	struct nv30_miptree *nv30mt;
 	int colour_bits = 32, zeta_bits = 32;
 
+        util_framebuffer_uniform_size( fb, &w, &h );
+
 	for (i = 0; i < fb->nr_cbufs; i++) {
 		if (colour_format) {
 			assert(colour_format == fb->cbufs[i]->format);
@@ -38,7 +39,8 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
 	if (rt_enable & (NV34TCL_RT_ENABLE_COLOR0|NV34TCL_RT_ENABLE_COLOR1)) {
 		/* Render to at least a colour buffer */
 		if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
-			assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
+			assert(util_is_power_of_two(w) &&
+                               util_is_power_of_two(h));
 			for (i = 1; i < fb->nr_cbufs; i++)
 				assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
 
@@ -53,8 +55,9 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
 
 		/* Render to depth buffer only */
 		if (!(zeta->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
-			assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
-
+                        assert(util_is_power_of_two(w) &&
+                               util_is_power_of_two(h));
+w
 			rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
 				(log2i(zeta->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) |
 				(log2i(zeta->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT);
diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c
index ed0ca9e..e7eb9f6 100644
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ b/src/gallium/drivers/nv40/nv40_state.c
@@ -626,6 +626,9 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
 {
 	struct nv40_context *nv40 = nv40_context(pipe);
 
+        /* XXX: use util_copy_framebuffer_state to get correct
+         * refcounting.
+         */
 	nv40->framebuffer = *fb;
 	nv40->dirty |= NV40_NEW_FB;
 }
diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c
index a58fe9d..7d6e0bb 100644
--- a/src/gallium/drivers/nv40/nv40_state_fb.c
+++ b/src/gallium/drivers/nv40/nv40_state_fb.c
@@ -21,8 +21,9 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
 	int i, colour_format = 0, zeta_format = 0;
 	struct nouveau_stateobj *so = so_new(18, 24, 10);
 	unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
-	unsigned w = fb->width;
-	unsigned h = fb->height;
+	unsigned w, h;
+
+        util_framebuffer_uniform_size( fb, &w, &h );
 
 	rt_enable = 0;
 	for (i = 0; i < fb->nr_cbufs; i++) {
@@ -45,13 +46,14 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
 	}
 
 	if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
-		assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
+                assert(util_is_power_of_two(w) &&
+                       util_is_power_of_two(h));
 		for (i = 1; i < fb->nr_cbufs; i++)
 			assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
 
 		rt_format = NV40TCL_RT_FORMAT_TYPE_SWIZZLED |
-		            log2i(fb->width) << NV40TCL_RT_FORMAT_LOG2_WIDTH_SHIFT |
-		            log2i(fb->height) << NV40TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT;
+		            log2i(w) << NV40TCL_RT_FORMAT_LOG2_WIDTH_SHIFT |
+		            log2i(h) << NV40TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT;
 	}
 	else
 		rt_format = NV40TCL_RT_FORMAT_TYPE_LINEAR;
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 1f67df8..7358502 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -604,7 +604,9 @@ nv50_set_framebuffer_state(struct pipe_context *pipe,
 			   const struct pipe_framebuffer_state *fb)
 {
 	struct nv50_context *nv50 = nv50_context(pipe);
-
+        
+        /* XXX: util_copy_framebuffer_state() for refcounting: 
+         */
 	nv50->framebuffer = *fb;
 	nv50->dirty |= NV50_NEW_FRAMEBUFFER;
 }




More information about the mesa-commit mailing list