Mesa (openchrome-branch): Revert "openchrome: Use a non-NULL texImage pointer when unmapped."
Thomas Hellstrom
thomash at kemper.freedesktop.org
Tue Mar 24 22:10:01 UTC 2009
Module: Mesa
Branch: openchrome-branch
Commit: 7d24630c7d8bd1f993421cf50f9d8bbb5263ee7f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d24630c7d8bd1f993421cf50f9d8bbb5263ee7f
Author: Thomas Hellstrom <thomas-at-shipmail-dot-org>
Date: Tue Mar 24 21:31:19 2009 +0100
Revert "openchrome: Use a non-NULL texImage pointer when unmapped."
This reverts commit 191afdc821df6dc025672c26b76b3be401544302.
Turns out that when the texImage::Data member is populated,
image storage is always freed before a driver texImage operation.
While the GL specs call for this, it's more attractive to reuse
idle texture memory, particularly as write-combined memory can be
expensive to allocate.
Conflicts:
src/mesa/drivers/dri/openchrome/via_tex.c
Signed-off-by: Thomas Hellstrom <thomas-at-shipmail-dot-org>
---
src/mesa/drivers/dri/openchrome/via_tex.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/mesa/drivers/dri/openchrome/via_tex.c b/src/mesa/drivers/dri/openchrome/via_tex.c
index 9f1b860..3e3f231 100644
--- a/src/mesa/drivers/dri/openchrome/via_tex.c
+++ b/src/mesa/drivers/dri/openchrome/via_tex.c
@@ -47,9 +47,8 @@
#include "via_state.h"
#include "via_ioctl.h"
#include "via_3d_reg.h"
-#include "wsbm_manager.h"
-#define VIA_INVALID_TEXMAP ((void *) 0x00000001UL)
+#include "wsbm_manager.h"
static const struct gl_texture_format *
viaChooseTexFormat(GLcontext * ctx, GLint internalFormat,
@@ -642,12 +641,7 @@ viaTexImage(GLcontext * ctx,
ctx->Driver.TextureMemCpy(texImage->Data, pixels, imageSize);
} else {
ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx,
- dims,
- texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
+ success = texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */
dstRowStride,
texImage->ImageOffsets,
width, height, 1,
@@ -669,7 +663,7 @@ viaTexImage(GLcontext * ctx,
_mesa_unmap_teximage_pbo(ctx, packing);
out:
- texImage->Data = VIA_INVALID_TEXMAP;
+ texImage->Data = NULL;
wsbmBOUnmap(viaImage->buf);
}
@@ -749,7 +743,7 @@ viaTexSubImage2D(GLcontext * ctx,
_mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
height, format, type, pixels, packing, texObj,
texImage);
- texImage->Data = VIA_INVALID_TEXMAP;
+ texImage->Data = NULL;
wsbmBOUnmap(viaImage->buf);
wsbmBOReleaseFromCpu(viaImage->buf, WSBM_SYNCCPU_WRITE);
}
@@ -803,7 +797,7 @@ viaTexSubImage1D(GLcontext * ctx,
_mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
format, type, pixels, packing, texObj,
texImage);
- texImage->Data = VIA_INVALID_TEXMAP;
+ texImage->Data = NULL;
wsbmBOUnmap(viaImage->buf);
wsbmBOReleaseFromCpu(viaImage->buf, WSBM_SYNCCPU_WRITE);
}
@@ -880,7 +874,7 @@ viaGetTexImage(GLcontext * ctx, GLenum target, GLint level,
_mesa_get_teximage(ctx, target, level, format, type, pixels,
texObj, texImage);
- texImage->Data = VIA_INVALID_TEXMAP;
+ texImage->Data = NULL;
wsbmBOUnmap(viaImage->buf);
wsbmBOReleaseFromCpu(viaImage->buf, WSBM_SYNCCPU_READ);
}
@@ -945,7 +939,7 @@ viaCompressedTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
yoffset, width, height, format,
imageSize, data, texObj, texImage);
- texImage->Data = VIA_INVALID_TEXMAP;
+ texImage->Data = NULL;
wsbmBOUnmap(viaImage->buf);
wsbmBOReleaseFromCpu(viaImage->buf, WSBM_SYNCCPU_WRITE);
}
@@ -1095,10 +1089,10 @@ via_map_unmap_texunit(struct gl_texture_unit *tu, GLboolean map)
} else {
if (image->Data != VIA_INVALID_TEXMAP) {
wsbmBOUnmap(vImage->buf);
+ image->Data = NULL;
wsbmBOReleaseFromCpu(vImage->buf,
WSBM_SYNCCPU_READ |
WSBM_SYNCCPU_WRITE);
- image->Data = VIA_INVALID_TEXMAP;
}
}
}
More information about the mesa-commit
mailing list