Module: Mesa
Branch: master
Commit: 2e6c65722a98066e51d587365fc82f47c0af1158
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e6c65722a98066e51d587365fc82f47c0af1158

Author: Luca Barbieri <[email protected]>
Date:   Sat Sep  4 21:22:02 2010 +0200

nvfx: fix some subrectangle copies

Actually, we may want to get rid of the x/y coordinates for linear
surfaces, and realign the origin from scratch if necessary, instead
of doing this "on-demand realignment".

---

 src/gallium/drivers/nvfx/nv04_2d.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nv04_2d.c 
b/src/gallium/drivers/nvfx/nv04_2d.c
index ef07e54..bc6012f 100644
--- a/src/gallium/drivers/nvfx/nv04_2d.c
+++ b/src/gallium/drivers/nvfx/nv04_2d.c
@@ -365,19 +365,21 @@ nv04_region_do_align_offset(struct nv04_region* rgn, 
unsigned w, unsigned h, int
 {
        if(rgn->pitch > 0)
        {
-               int delta;
-
                assert(!(rgn->offset & ((1 << rgn->bpps) - 1))); // fatal!
-               delta = rgn->offset & ((1 << shift) - 1);
 
                if(h <= 1)
                {
-                       rgn->x += delta >> rgn->bpps;
+                       int delta;
+                       rgn->offset += rgn->y * rgn->pitch + (rgn->x << 
rgn->bpps);
+                       delta = rgn->offset & ((1 << shift) - 1);
+                       rgn->y = 0;
+                       rgn->x = delta >> rgn->bpps;
                        rgn->offset -= delta;
                        rgn->pitch = align((rgn->x + w) << rgn->bpps, 1 << 
shift);
                }
                else
                {
+                       int delta = rgn->offset & ((1 << shift) - 1);
                        int newxo = (rgn->x << rgn->bpps) + delta;
                        int dy = newxo / rgn->pitch;
                        newxo -= dy * rgn->pitch;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to