From: Dave Airlie Date: Tue, 17 Feb 2009 01:17:22 +0000 (+1000) Subject: radeon: fixup destroy texture object exit path and update LRU X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7c7ff659ce7684f44b064c09cdca6436d2c2bf64;p=mesa.git 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 --- diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c index 65b0a9a0ce0..1cc039c8440 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 */ #include +#include #include #include #include @@ -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.