summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-02-17 11:17:22 +1000
committerDave Airlie <airlied@redhat.com>2009-02-17 11:17:22 +1000
commit7c7ff659ce7684f44b064c09cdca6436d2c2bf64 (patch)
tree28351c8121d1f5b05db470e93db74038d8452dfd
parent43c71a2d40d417cf721656e8b088e375dc4bdedb (diff)
radeon: fixup destroy texture object exit path and update LRU
the destroy path was doing bad things with structure names, make it do less bad things, use container_of instead
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_bo_legacy.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
index 65b0a9a0ce..1cc039c844 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
@@ -32,6 +32,7 @@
* Jérôme Glisse <glisse@freedesktop.org>
*/
#include <stdio.h>
+#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -51,7 +52,6 @@
struct bo_legacy {
struct radeon_bo base;
- driTextureObject tobj_base;
int map_count;
uint32_t pending;
int is_pending;
@@ -85,11 +85,15 @@ struct bo_manager_legacy {
unsigned *free_handles;
};
+#define container_of(ptr, type, member) ({ \
+ const __typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
static void bo_legacy_tobj_destroy(void *data, driTextureObject *t)
{
- struct bo_legacy *bo_legacy;
+ struct bo_legacy *bo_legacy = container_of(t, struct bo_legacy, dri_texture_obj);
+
- bo_legacy = (struct bo_legacy*)((char*)t)-sizeof(struct radeon_bo);
bo_legacy->got_dri_texture_obj = 0;
bo_legacy->validated = 0;
}
@@ -535,6 +539,9 @@ static int bo_vram_validate(struct radeon_bo *bo,
bo_legacy->got_dri_texture_obj = 1;
bo_legacy->dirty = 1;
}
+
+ if (bo_legacy->got_dri_texture_obj)
+ driUpdateTextureLRU(&bo_legacy->dri_texture_obj);
if (bo_legacy->dirty) {
/* Copy to VRAM using a blit.
* All memory is 4K aligned. We're using 1024 pixels wide blits.