Mesa (master): dri/nouveau: Clean up the nv04 surface code a bit.
Francisco Jerez
currojerez at kemper.freedesktop.org
Thu Feb 25 18:33:38 UTC 2010
Module: Mesa
Branch: master
Commit: e59e5e3388c9561d58aa02bab20baca99ba86d15
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e59e5e3388c9561d58aa02bab20baca99ba86d15
Author: Francisco Jerez <currojerez at riseup.net>
Date: Mon Feb 22 01:50:04 2010 +0100
dri/nouveau: Clean up the nv04 surface code a bit.
---
src/mesa/drivers/dri/nouveau/nv04_surface.c | 36 +++++++-------------------
1 files changed, 10 insertions(+), 26 deletions(-)
diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index a219779..e8a5409 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -216,8 +216,8 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
/* If area is too large to copy in one shot we must copy it in
* POT chunks to meet alignment requirements */
- assert(sub_w == w || _mesa_is_pow_two(sub_w));
- assert(sub_h == h || _mesa_is_pow_two(sub_h));
+ assert(sub_w == w || _mesa_is_pow_two(w));
+ assert(sub_h == h || _mesa_is_pow_two(h));
nouveau_bo_marko(bctx, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE,
src->bo, bo_flags | NOUVEAU_BO_RD);
@@ -239,8 +239,6 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
for (x = 0; x < w; x += sub_w) {
sub_w = MIN2(sub_w, w - x);
- /* Must be 64-byte aligned */
- assert(!(dst->offset & 63));
MARK_RING(chan, 15, 1);
@@ -277,10 +275,10 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
static void
nv04_surface_copy_m2mf(GLcontext *ctx,
- struct nouveau_surface *dst,
- struct nouveau_surface *src,
- int dx, int dy, int sx, int sy,
- int w, int h)
+ struct nouveau_surface *dst,
+ struct nouveau_surface *src,
+ int dx, int dy, int sx, int sy,
+ int w, int h)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
@@ -484,34 +482,20 @@ nv04_surface_init(GLcontext *ctx)
OUT_RING (chan, NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_LE);
/* Swizzled surface. */
- switch (context_chipset(ctx) & 0xf0) {
- case 0x00:
- case 0x10:
+ if (context_chipset(ctx) < 0x20)
class = NV04_SWIZZLED_SURFACE;
- break;
- case 0x20:
+ else
class = NV20_SWIZZLED_SURFACE;
- break;
- default:
- /* Famous last words: this really can't happen.. */
- assert(0);
- break;
- }
ret = nouveau_grobj_alloc(chan, handle++, class, &hw->swzsurf);
if (ret)
goto fail;
/* Scaled image from memory. */
- switch (context_chipset(ctx) & 0xf0) {
- case 0x00:
+ if (context_chipset(ctx) < 0x10)
class = NV04_SCALED_IMAGE_FROM_MEMORY;
- break;
- case 0x10:
- case 0x20:
+ else
class = NV10_SCALED_IMAGE_FROM_MEMORY;
- break;
- }
ret = nouveau_grobj_alloc(chan, handle++, class, &hw->sifm);
if (ret)
More information about the mesa-commit
mailing list