summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/r600/drm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-09-16 17:18:39 +1000
committerDave Airlie <airlied@redhat.com>2010-09-17 10:57:44 +1000
commitec9d838aa56d2c4bc5649d7c26ac61abb6c4b9bb (patch)
tree511802682639b8a4e991d906c34905c4de8f775a /src/gallium/winsys/r600/drm
parentb54d10b62e536c56774024761942f3b159d7470f (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')
-rw-r--r--src/gallium/winsys/r600/drm/radeon_ctx.c17
-rw-r--r--src/gallium/winsys/r600/drm/radeon_priv.h11
2 files changed, 20 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)
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;