diff options
author | Dave Airlie <airlied@redhat.com> | 2010-09-16 17:18:39 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-09-17 10:57:44 +1000 |
commit | ec9d838aa56d2c4bc5649d7c26ac61abb6c4b9bb (patch) | |
tree | 511802682639b8a4e991d906c34905c4de8f775a /src/gallium/winsys/r600/drm/radeon_ctx.c | |
parent | b54d10b62e536c56774024761942f3b159d7470f (diff) |
r600g: hide radeon_ctx inside winsys.
no need for this info to be exported to pipe driver.
Diffstat (limited to 'src/gallium/winsys/r600/drm/radeon_ctx.c')
-rw-r--r-- | src/gallium/winsys/r600/drm/radeon_ctx.c | 17 |
1 files changed, 9 insertions, 8 deletions
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) |