diff options
author | Keith Whitwell <keithw@vmware.com> | 2010-01-07 16:28:00 +0000 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2010-01-07 16:28:00 +0000 |
commit | 8ad9cbfe69dabc57b17dc74dc6f0796f34ae343a (patch) | |
tree | 4bee4981d064cdb76812279da66fb880418cabaa | |
parent | 397ad1ccbc583a5d18a547027542122eb30e0d09 (diff) |
nv: attempt to update for framebuffer changes
-rw-r--r-- | src/gallium/drivers/nv30/nv30_state_fb.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/nv40/nv40_state.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/nv40/nv40_state_fb.c | 12 | ||||
-rw-r--r-- | 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 2ed2ea55e8..d621628a91 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 ed0ca9e02c..e7eb9f6ff8 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 a58fe9ddb1..7d6e0bb2b3 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 1f67df814b..7358502970 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; } |