diff options
author | Marek Olšák <[email protected]> | 2011-08-04 01:37:33 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-08-16 09:15:10 +0200 |
commit | e6fb62594fca714883af9bba9795be8838c16900 (patch) | |
tree | a89b19e698a8b4050dc55c437eba9df4ba927ca8 /src/gallium/winsys/r600/drm | |
parent | 685b8345a8ff69460f0c62c678493527b59b18a9 (diff) |
r600g: emit CS using radeon_winsys
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/winsys/r600/drm')
-rw-r--r-- | src/gallium/winsys/r600/drm/evergreen_hw_context.c | 6 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_drm.c | 3 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_hw_context.c | 39 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_priv.h | 9 |
4 files changed, 16 insertions, 41 deletions
diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index cd63c8db156..29da7bea4c6 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -995,11 +995,7 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) goto out_err; } ctx->pm4_ndwords = RADEON_CTX_MAX_PM4; - ctx->pm4 = calloc(ctx->pm4_ndwords, 4); - if (ctx->pm4 == NULL) { - r = -ENOMEM; - goto out_err; - } + ctx->pm4 = ctx->cs->buf; r600_init_cs(ctx); /* save 16dwords space for fence mecanism */ diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index f0ef55e98d5..270a07a3a89 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -292,6 +292,9 @@ struct radeon *radeon_create(struct radeon_winsys *ws) radeon_get_backend_map(radeon); } + /* XXX disable ioctl thread offloading until the porting is done. */ + setenv("RADEON_THREAD", "0", 0); + return radeon; } diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 1950e583121..59450b5ba83 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -776,7 +776,6 @@ void r600_context_fini(struct r600_context *ctx) free(ctx->range); free(ctx->blocks); free(ctx->bo); - free(ctx->pm4); ctx->radeon->ws->cs_destroy(ctx->cs); memset(ctx, 0, sizeof(struct r600_context)); @@ -920,11 +919,7 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) goto out_err; } ctx->pm4_ndwords = RADEON_CTX_MAX_PM4; - ctx->pm4 = calloc(ctx->pm4_ndwords, 4); - if (ctx->pm4 == NULL) { - r = -ENOMEM; - goto out_err; - } + ctx->pm4 = ctx->cs->buf; r600_init_cs(ctx); /* save 16dwords space for fence mecanism */ @@ -1492,10 +1487,6 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) void r600_context_flush(struct r600_context *ctx) { - struct drm_radeon_cs drmib = {}; - struct drm_radeon_cs_chunk chunks[2]; - uint64_t chunk_array[2]; - int r; struct r600_block *enable_block = NULL; if (ctx->pm4_cdwords == ctx->init_dwords) @@ -1513,27 +1504,12 @@ void r600_context_flush(struct r600_context *ctx) ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0, 0); ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | EVENT_INDEX(4); -#if 1 - /* emit cs */ - drmib.num_chunks = 2; - drmib.chunks = (uint64_t)(uintptr_t)chunk_array; - chunks[0].chunk_id = RADEON_CHUNK_ID_IB; - chunks[0].length_dw = ctx->pm4_cdwords; - chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4; - chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS; - chunks[1].length_dw = ctx->creloc * 4; - chunks[1].chunk_data = (uint64_t)(uintptr_t)ctx->reloc; - chunk_array[0] = (uint64_t)(uintptr_t)&chunks[0]; - chunk_array[1] = (uint64_t)(uintptr_t)&chunks[1]; - r = drmCommandWriteRead(ctx->radeon->info.fd, DRM_RADEON_CS, &drmib, - sizeof(struct drm_radeon_cs)); - if (r) { - fprintf(stderr, "radeon: The kernel rejected CS, " - "see dmesg for more information.\n"); - } -#else - *ctx->radeon->cfence = ctx->radeon->fence; -#endif + /* Flush the CS. */ + ctx->cs->cdw = ctx->pm4_cdwords; + ctx->radeon->ws->cs_flush(ctx->cs, 0); + /* We need to get the pointer to the other CS, + * the command streams are double-buffered. */ + ctx->pm4 = ctx->cs->buf; /* restart */ for (int i = 0; i < ctx->creloc; i++) { @@ -1544,7 +1520,6 @@ void r600_context_flush(struct r600_context *ctx) ctx->pm4_dirty_cdwords = 0; ctx->pm4_cdwords = 0; ctx->flags = 0; - ctx->radeon->ws->cs_flush(ctx->cs, 0); r600_init_cs(ctx); diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 5bb515d743e..83e964b7f69 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -134,10 +134,11 @@ static INLINE unsigned r600_context_bo_reloc(struct r600_context *ctx, struct r6 assert(bo != NULL); - reloc_index = ctx->radeon->ws->trans_add_reloc( - ctx->cs, bo->cs_buf, - rbo->domains, rbo->domains, - (void**)&ctx->reloc, &ctx->creloc); + reloc_index = + ctx->radeon->ws->trans_add_reloc(ctx->cs, bo->cs_buf, rbo->domains, rbo->domains); + + if (reloc_index >= ctx->creloc) + ctx->creloc = reloc_index+1; radeon_bo_reference(ctx->radeon, &ctx->bo[reloc_index], bo); return reloc_index * 4; |