summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorAapo Tahkola <aet@rasterburn.org>2005-06-16 10:21:01 +0000
committerAapo Tahkola <aet@rasterburn.org>2005-06-16 10:21:01 +0000
commit0e288e58ef3325d10412dde29f5581a8a655b3dd (patch)
treec068c4addc0c0aba31a68cbc2c787ad8818341a3 /src/mesa/drivers
parent3176f8e2e1195b0f8bd0c9ba2fd44366ff1da520 (diff)
Turn off VBO's.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index f949e92081..ca56db4f2d 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -151,21 +151,42 @@ void r300BufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size,
drm_radeon_mem_alloc_t alloc;
int offset, ret;
+ /* Free previous buffer */
+ if (obj->OnCard) {
+ drm_radeon_mem_free_t memfree;
+
+ memfree.region = RADEON_MEM_REGION_GART;
+ memfree.region_offset = (char *)obj->Data - (char *)rmesa->radeon.radeonScreen->gartTextures.map;
+
+ ret = drmCommandWrite(rmesa->radeon.radeonScreen->driScreen->fd,
+ DRM_RADEON_FREE, &memfree, sizeof(memfree));
+
+ if (ret) {
+ WARN_ONCE("Failed to free GART memroy!\n");
+ }
+ obj->OnCard = GL_FALSE;
+ }
+
alloc.region = RADEON_MEM_REGION_GART;
alloc.alignment = 4;
alloc.size = size;
alloc.region_offset = &offset;
ret = drmCommandWriteRead( rmesa->radeon.dri.fd, DRM_RADEON_ALLOC, &alloc, sizeof(alloc));
- if(ret){
+ if (ret) {
WARN_ONCE("Ran out of GART memory!\n");
+ obj->Data = NULL;
_mesa_buffer_data(ctx, target, size, data, usage, obj);
return ;
}
obj->Data = ((char *)rmesa->radeon.radeonScreen->gartTextures.map) + offset;
- memcpy(obj->Data, data, size);
+
+ if (data)
+ memcpy(obj->Data, data, size);
+
obj->Size = size;
obj->Usage = usage;
+ obj->OnCard = GL_TRUE;
#if 0
fprintf(stderr, "allocated %d bytes at %p, offset=%d\n", size, obj->Data, offset);
#endif
@@ -230,10 +251,13 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
r300InitStateFuncs(&functions);
r300InitTextureFuncs(&functions);
r300InitShaderFuncs(&functions);
- if(hw_tcl_on){
+
+#if 0 /* Needs various Mesa changes... */
+ if (hw_tcl_on) {
functions.BufferData = r300BufferData;
functions.DeleteBuffer = r300DeleteBuffer;
}
+#endif
if (!radeonInitContext(&r300->radeon, &functions,
glVisual, driContextPriv, sharedContextPrivate)) {