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);
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;
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;
enum radeon_bo_domain domain,
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
*/
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.
*