intel: Track named regions and make sure we only have one region per named bo

This commit is contained in:
Kristian Høgsberg
2010-02-11 17:18:01 -05:00
parent 93931d9e68
commit 2d99588b35
4 changed files with 41 additions and 1 deletions

View File

@@ -29,6 +29,7 @@
#include "main/context.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "main/hash.h"
#include "utils.h"
#include "xmlpool.h"
@@ -166,6 +167,11 @@ intel_get_param(__DRIscreen *psp, int param, int *value)
return GL_TRUE;
}
static void
nop_callback(GLuint key, void *data, void *userData)
{
}
static void
intelDestroyScreen(__DRIscreen * sPriv)
{
@@ -174,6 +180,12 @@ intelDestroyScreen(__DRIscreen * sPriv)
dri_bufmgr_destroy(intelScreen->bufmgr);
driDestroyOptionInfo(&intelScreen->optionCache);
/* Some regions may still have references to them at this point, so
* flush the hash table to prevent _mesa_DeleteHashTable() from
* complaining about the hash not being empty; */
_mesa_HashDeleteAll(intelScreen->named_regions, nop_callback, NULL);
_mesa_DeleteHashTable(intelScreen->named_regions);
FREE(intelScreen);
sPriv->private = NULL;
}
@@ -324,6 +336,8 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
else
intelScreen->kernel_exec_fencing = GL_FALSE;
intelScreen->named_regions = _mesa_NewHashTable();
return GL_TRUE;
}