summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvfx/nv04_2d.h
diff options
context:
space:
mode:
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 e638b8c874..e7d872a2be 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,