diff options
author | Marek Olšák <[email protected]> | 2014-04-11 20:34:46 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-04-16 14:02:51 +0200 |
commit | b2238b3452b0bcf3c1216c20c9918f9f0664b464 (patch) | |
tree | 2d5c1495530758f977a9c435f0c8632e4d653b37 /src/gallium/winsys/radeon | |
parent | 927213f33d0379c34033048d24592715d3f7ef96 (diff) |
winsys/radeon: remove cs_write_reloc, add simpler cs_get_reloc
The only difference is that it doesn't write to the CS and only returns
the index.
Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 26 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_winsys.h | 19 |
2 files changed, 19 insertions, 26 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index b55eb809d2d..4ce1717ecc9 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -313,6 +313,14 @@ static unsigned radeon_drm_cs_add_reloc(struct radeon_winsys_cs *rcs, return index; } +static int radeon_drm_cs_get_reloc(struct radeon_winsys_cs *rcs, + struct radeon_winsys_cs_handle *buf) +{ + struct radeon_drm_cs *cs = radeon_drm_cs(rcs); + + return radeon_get_reloc(cs->csc, (struct radeon_bo*)buf, NULL); +} + static boolean radeon_drm_cs_validate(struct radeon_winsys_cs *rcs) { struct radeon_drm_cs *cs = radeon_drm_cs(rcs); @@ -359,22 +367,6 @@ static boolean radeon_drm_cs_memory_below_limit(struct radeon_winsys_cs *rcs, ui return status; } -static void radeon_drm_cs_write_reloc(struct radeon_winsys_cs *rcs, - struct radeon_winsys_cs_handle *buf) -{ - struct radeon_drm_cs *cs = radeon_drm_cs(rcs); - struct radeon_bo *bo = (struct radeon_bo*)buf; - unsigned index = radeon_get_reloc(cs->csc, bo, NULL); - - if (index == -1) { - fprintf(stderr, "radeon: Cannot get a relocation in %s.\n", __func__); - return; - } - - OUT_CS(&cs->base, 0xc0001000); - OUT_CS(&cs->base, index * RELOC_DWORDS); -} - void radeon_drm_cs_emit_ioctl_oneshot(struct radeon_drm_cs *cs, struct radeon_cs_context *csc) { unsigned i; @@ -650,9 +642,9 @@ void radeon_drm_cs_init_functions(struct radeon_drm_winsys *ws) ws->base.cs_create = radeon_drm_cs_create; ws->base.cs_destroy = radeon_drm_cs_destroy; ws->base.cs_add_reloc = radeon_drm_cs_add_reloc; + ws->base.cs_get_reloc = radeon_drm_cs_get_reloc; ws->base.cs_validate = radeon_drm_cs_validate; ws->base.cs_memory_below_limit = radeon_drm_cs_memory_below_limit; - ws->base.cs_write_reloc = radeon_drm_cs_write_reloc; ws->base.cs_flush = radeon_drm_cs_flush; ws->base.cs_set_flush_callback = radeon_drm_cs_set_flush; ws->base.cs_is_buffer_referenced = radeon_bo_is_referenced; diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h index 485e9259be3..320989c0788 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -450,6 +450,16 @@ struct radeon_winsys { enum radeon_bo_priority priority); /** + * Return the index of an already-added buffer. + * + * \param cs Command stream + * \param buf Buffer + * \return The buffer index, or -1 if the buffer has not been added. + */ + int (*cs_get_reloc)(struct radeon_winsys_cs *cs, + struct radeon_winsys_cs_handle *buf); + + /** * Return TRUE if there is enough memory in VRAM and GTT for the relocs * added so far. If the validation fails, all the relocations which have * been added since the last call of cs_validate will be removed and @@ -470,15 +480,6 @@ struct radeon_winsys { boolean (*cs_memory_below_limit)(struct radeon_winsys_cs *cs, uint64_t vram, uint64_t gtt); /** - * Write a relocated dword to a command buffer. - * - * \param cs A command stream the relocation is written to. - * \param buf A winsys buffer to write the relocation for. - */ - void (*cs_write_reloc)(struct radeon_winsys_cs *cs, - struct radeon_winsys_cs_handle *buf); - - /** * Flush a command stream. * * \param cs A command stream to flush. |