From ec9d838aa56d2c4bc5649d7c26ac61abb6c4b9bb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 16 Sep 2010 17:18:39 +1000 Subject: r600g: hide radeon_ctx inside winsys. no need for this info to be exported to pipe driver. --- src/gallium/winsys/r600/drm/radeon_ctx.c | 17 +++++++++-------- src/gallium/winsys/r600/drm/radeon_priv.h | 11 +++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'src/gallium/winsys/r600/drm') diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c index a3ce7df756..9f166b209a 100644 --- a/src/gallium/winsys/r600/drm/radeon_ctx.c +++ b/src/gallium/winsys/r600/drm/radeon_ctx.c @@ -82,29 +82,30 @@ void radeon_ctx_clear(struct radeon_ctx *ctx) ctx->nbo = 0; } -int radeon_ctx_init(struct radeon_ctx *ctx, struct radeon *radeon) +struct radeon_ctx *radeon_ctx_init(struct radeon *radeon) { + struct radeon_ctx *ctx; if (radeon == NULL) - return -EINVAL; - memset(ctx, 0, sizeof(struct radeon_ctx)); + return NULL; + ctx = calloc(1, sizeof(struct radeon_ctx)); ctx->radeon = radeon_incref(radeon); radeon_ctx_clear(ctx); ctx->pm4 = malloc(RADEON_CTX_MAX_PM4 * 4); if (ctx->pm4 == NULL) { radeon_ctx_fini(ctx); - return -ENOMEM; + return NULL; } ctx->reloc = malloc(sizeof(struct radeon_cs_reloc) * RADEON_CTX_MAX_PM4); if (ctx->reloc == NULL) { radeon_ctx_fini(ctx); - return -ENOMEM; + return NULL; } ctx->bo = malloc(sizeof(void *) * RADEON_CTX_MAX_PM4); if (ctx->bo == NULL) { radeon_ctx_fini(ctx); - return -ENOMEM; + return NULL; } - return 0; + return ctx; } void radeon_ctx_fini(struct radeon_ctx *ctx) @@ -121,7 +122,7 @@ void radeon_ctx_fini(struct radeon_ctx *ctx) free(ctx->bo); free(ctx->pm4); free(ctx->reloc); - memset(ctx, 0, sizeof(struct radeon_ctx)); + free(ctx); } static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *state) diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h index bcaa91d028..b5a4eeae6b 100644 --- a/src/gallium/winsys/r600/drm/radeon_priv.h +++ b/src/gallium/winsys/r600/drm/radeon_priv.h @@ -53,6 +53,17 @@ struct radeon_stype_info { unsigned npm4; }; +struct radeon_ctx { + struct radeon *radeon; + u32 *pm4; + int cdwords; + int ndwords; + unsigned nreloc; + struct radeon_cs_reloc *reloc; + unsigned nbo; + struct radeon_bo **bo; +}; + struct radeon { int fd; int refcount; -- cgit v1.2.3