From 56c458e0f2027bc19b45ed3112e84b6ace67920f Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sat, 15 Nov 2008 10:40:32 +0100 Subject: [PATCH] radeon: update to libdrm-radeon API changes --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 8 ++++---- src/mesa/drivers/dri/radeon/radeon_bo_legacy.c | 16 +++++++++------- src/mesa/drivers/dri/radeon/radeon_bo_legacy.h | 4 ++-- src/mesa/drivers/dri/radeon/radeon_cs_legacy.c | 4 ++-- src/mesa/drivers/dri/radeon/radeon_cs_legacy.h | 4 ++-- src/mesa/drivers/dri/radeon/radeon_screen.c | 8 ++++---- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 517860da435..b8740e298ba 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -746,9 +746,9 @@ void r300InitCmdBuf(r300ContextPtr r300) if (r300->radeon.radeonScreen->driScreen->dri2.enabled) { int fd = r300->radeon.radeonScreen->driScreen->fd; - r300->cmdbuf.csm = radeon_cs_manager_gem(fd); + r300->cmdbuf.csm = radeon_cs_manager_gem_ctor(fd); } else { - r300->cmdbuf.csm = radeon_cs_manager_legacy(&r300->radeon); + r300->cmdbuf.csm = radeon_cs_manager_legacy_ctor(&r300->radeon); } if (r300->cmdbuf.csm == NULL) { /* FIXME: fatal error */ @@ -771,8 +771,8 @@ void r300DestroyCmdBuf(r300ContextPtr r300) FREE(atom->cmd); } if (r300->radeon.radeonScreen->driScreen->dri2.enabled) { - radeon_cs_manager_gem_shutdown(r300->cmdbuf.csm); + radeon_cs_manager_gem_dtor(r300->cmdbuf.csm); } else { - radeon_cs_manager_legacy_shutdown(r300->cmdbuf.csm); + radeon_cs_manager_legacy_dtor(r300->cmdbuf.csm); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c index d57b19de8dd..3aa1d869f10 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c @@ -407,7 +407,7 @@ static void bo_ref(struct radeon_bo *bo) { } -static void bo_unref(struct radeon_bo *bo) +static struct radeon_bo *bo_unref(struct radeon_bo *bo) { struct bo_legacy *bo_legacy = (struct bo_legacy*)bo; @@ -419,7 +419,9 @@ static void bo_unref(struct radeon_bo *bo) if (!bo_legacy->is_pending) { bo_free(bo_legacy); } + return NULL; } + return bo; } static int bo_map(struct radeon_bo *bo, int write) @@ -589,7 +591,7 @@ void radeon_bo_legacy_pending(struct radeon_bo *bo, uint32_t pending) boml->cpendings++; } -void radeon_bo_manager_legacy_shutdown(struct radeon_bo_manager *bom) +void radeon_bo_manager_legacy_dtor(struct radeon_bo_manager *bom) { struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bom; struct bo_legacy *bo_legacy; @@ -609,7 +611,7 @@ void radeon_bo_manager_legacy_shutdown(struct radeon_bo_manager *bom) free(boml); } -struct radeon_bo_manager *radeon_bo_manager_legacy(struct radeon_screen *scrn) +struct radeon_bo_manager *radeon_bo_manager_legacy_ctor(struct radeon_screen *scrn) { struct bo_manager_legacy *bom; struct bo_legacy *bo; @@ -646,7 +648,7 @@ struct radeon_bo_manager *radeon_bo_manager_legacy(struct radeon_screen *scrn) bom->nfree_handles = 0x400; bom->free_handles = (uint32_t*)malloc(bom->nfree_handles * 4); if (bom->free_handles == NULL) { - radeon_bo_manager_legacy_shutdown((struct radeon_bo_manager*)bom); + radeon_bo_manager_legacy_dtor((struct radeon_bo_manager*)bom); return NULL; } @@ -655,7 +657,7 @@ struct radeon_bo_manager *radeon_bo_manager_legacy(struct radeon_screen *scrn) /* allocate front */ bo = bo_allocate(bom, size, 0, RADEON_GEM_DOMAIN_VRAM, 0); if (bo == NULL) { - radeon_bo_manager_legacy_shutdown((struct radeon_bo_manager*)bom); + radeon_bo_manager_legacy_dtor((struct radeon_bo_manager*)bom); return NULL; } if (scrn->sarea->tiling_enabled) { @@ -671,7 +673,7 @@ struct radeon_bo_manager *radeon_bo_manager_legacy(struct radeon_screen *scrn) /* allocate back */ bo = bo_allocate(bom, size, 0, RADEON_GEM_DOMAIN_VRAM, 0); if (bo == NULL) { - radeon_bo_manager_legacy_shutdown((struct radeon_bo_manager*)bom); + radeon_bo_manager_legacy_dtor((struct radeon_bo_manager*)bom); return NULL; } if (scrn->sarea->tiling_enabled) { @@ -687,7 +689,7 @@ struct radeon_bo_manager *radeon_bo_manager_legacy(struct radeon_screen *scrn) /* allocate depth */ bo = bo_allocate(bom, size, 0, RADEON_GEM_DOMAIN_VRAM, 0); if (bo == NULL) { - radeon_bo_manager_legacy_shutdown((struct radeon_bo_manager*)bom); + radeon_bo_manager_legacy_dtor((struct radeon_bo_manager*)bom); return NULL; } bo->base.flags = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.h b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.h index 316b023fb0f..208171e3720 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.h +++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.h @@ -39,8 +39,8 @@ void radeon_bo_legacy_pending(struct radeon_bo *bo, uint32_t pending); int radeon_bo_legacy_validate(struct radeon_bo *bo, uint32_t *soffset, uint32_t *eoffset); -struct radeon_bo_manager *radeon_bo_manager_legacy(struct radeon_screen *scrn); -void radeon_bo_manager_legacy_shutdown(struct radeon_bo_manager *bom); +struct radeon_bo_manager *radeon_bo_manager_legacy_ctor(struct radeon_screen *scrn); +void radeon_bo_manager_legacy_dtor(struct radeon_bo_manager *bom); void radeon_bo_legacy_texture_age(struct radeon_bo_manager *bom); unsigned radeon_bo_legacy_relocs_size(struct radeon_bo *bo); diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c index b69537bc656..6bc41bca3bf 100644 --- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c @@ -397,7 +397,7 @@ static struct radeon_cs_funcs radeon_cs_legacy_funcs = { cs_need_flush }; -struct radeon_cs_manager *radeon_cs_manager_legacy(struct radeon_context *ctx) +struct radeon_cs_manager *radeon_cs_manager_legacy_ctor(struct radeon_context *ctx) { struct cs_manager_legacy *csm; @@ -413,7 +413,7 @@ struct radeon_cs_manager *radeon_cs_manager_legacy(struct radeon_context *ctx) return (struct radeon_cs_manager*)csm; } -void radeon_cs_manager_legacy_shutdown(struct radeon_cs_manager *csm) +void radeon_cs_manager_legacy_dtor(struct radeon_cs_manager *csm) { free(csm); } diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.h b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.h index cf0f20ec309..71a4dad58d4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.h +++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.h @@ -35,7 +35,7 @@ #include "radeon_cs.h" #include "radeon_context.h" -struct radeon_cs_manager *radeon_cs_manager_legacy(struct radeon_context *ctx); -void radeon_cs_manager_legacy_shutdown(struct radeon_cs_manager *csm); +struct radeon_cs_manager *radeon_cs_manager_legacy_ctor(struct radeon_context *ctx); +void radeon_cs_manager_legacy_dtor(struct radeon_cs_manager *csm); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 93131d269cd..79cc4c8c8ef 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -973,7 +973,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->sarea_priv_offset = dri_priv->sarea_priv_offset; screen->sarea = (drm_radeon_sarea_t *) ((GLubyte *) sPriv->pSAREA + screen->sarea_priv_offset); - screen->bom = radeon_bo_manager_legacy(screen); + screen->bom = radeon_bo_manager_legacy_ctor(screen); if (screen->bom == NULL) { free(screen); return NULL; @@ -1040,7 +1040,7 @@ radeonCreateScreen2(__DRIscreenPrivate *sPriv) sPriv->extensions = screen->extensions; screen->driScreen = sPriv; - screen->bom = radeon_bo_manager_gem(sPriv->fd); + screen->bom = radeon_bo_manager_gem_ctor(sPriv->fd); if (screen->bom == NULL) { free(screen); return NULL; @@ -1060,9 +1060,9 @@ radeonDestroyScreen( __DRIscreenPrivate *sPriv ) if (sPriv->dri2.enabled) { radeon_tracker_print(&screen->bom->tracker, stderr); - radeon_bo_manager_gem_shutdown(screen->bom); + radeon_bo_manager_gem_dtor(screen->bom); } else { - radeon_bo_manager_legacy_shutdown(screen->bom); + radeon_bo_manager_legacy_dtor(screen->bom); if ( screen->gartTextures.map ) { drmUnmap( screen->gartTextures.map, screen->gartTextures.size ); -- 2.30.2