summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvfx/nv04_2d.h
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-04 17:12:02 +0200
committerLuca Barbieri <[email protected]>2010-09-04 22:45:21 +0200
commit5bd0e0adb1790cbc36e66c1c37a6a4338a851750 (patch)
treee9f7b65f193046da6ef7db6595fa05faaf7374fb /src/gallium/drivers/nvfx/nv04_2d.h
parent2e6c65722a98066e51d587365fc82f47c0af1158 (diff)
nvfx: fix swizzling of high bpp surfaces
Diffstat (limited to 'src/gallium/drivers/nvfx/nv04_2d.h')
-rw-r--r--src/gallium/drivers/nvfx/nv04_2d.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/nvfx/nv04_2d.h b/src/gallium/drivers/nvfx/nv04_2d.h
index e638b8c8740..e7d872a2be6 100644
--- a/src/gallium/drivers/nvfx/nv04_2d.h
+++ b/src/gallium/drivers/nvfx/nv04_2d.h
@@ -47,6 +47,26 @@ struct nv04_region {
unsigned w, h, d;
};
+static inline void
+nv04_region_try_to_linearize(struct nv04_region* rgn)
+{
+ assert(!rgn->pitch);
+
+ if(rgn->d <= 1)
+ {
+ if(rgn->h <= 1 || rgn->w <= 2)
+ rgn->pitch = rgn->w << rgn->bpps;
+ }
+ else
+ {
+ if(rgn->h <= 2 && rgn->w <= 2)
+ {
+ rgn->pitch = rgn->w << rgn->bpps;
+ rgn->offset += rgn->z * rgn->h * rgn->pitch;
+ }
+ }
+}
+
void
nv04_memcpy(struct nv04_2d_context *ctx,
struct nouveau_bo* dstbo, int dstoff,