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

Author: Robert Noland <[email protected]>
Date:   Mon Oct 19 09:47:39 2009 -0500

r600: Fix size calculation for 24 bit depth

size was being calculated based on 3 bytes per pixel with 24 bit depth
instead of 4 bytes.  This caused corruption in the bottom 25% of objects.
This finishes fixing the menu/text corruption in compiz/kde4.

Signed-off-by: Robert Noland <[email protected]>

---

 src/mesa/drivers/dri/r600/r600_texstate.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c 
b/src/mesa/drivers/dri/r600/r600_texstate.c
index 61ff7e8..a30703e 100644
--- a/src/mesa/drivers/dri/r600/r600_texstate.c
+++ b/src/mesa/drivers/dri/r600/r600_texstate.c
@@ -723,7 +723,7 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
        radeonTexObjPtr t = radeon_tex_obj(tObj);
        int firstlevel = t->mt ? t->mt->firstLevel : 0;
        const struct gl_texture_image *firstImage;
-       uint32_t pitch_val, size, row_align;
+       uint32_t pitch_val, size, row_align, bpp;
 
        if (!tObj)
                return;
@@ -733,9 +733,13 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint 
texname,
        if (!offset)
                return;
 
+       bpp = depth / 8;
+       if (bpp == 3) 
+               bpp = 4;
+
        firstImage = t->base.Image[0][firstlevel];
        row_align = rmesa->radeon.texture_row_align - 1;
-       size = ((firstImage->Width * (depth / 8) + row_align) & ~row_align) * 
firstImage->Height;
+       size = ((firstImage->Width * bpp + row_align) & ~row_align) * 
firstImage->Height;
        if (t->bo) {
                radeon_bo_unref(t->bo);
                t->bo = NULL;

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

Reply via email to