@@ -165,7 +165,8 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, struct et
/* update offset for every cmd stream */
for (i = 0; i < submit->nr_cmds; i++)
- submit->cmd[i].obj->offset = submit->cmd[i].size;
+ submit->cmd[i].obj->offset = submit->cmd[i].offset +
+ submit->cmd[i].size;
/* TODO: inter-connect all cmd buffers */
@@ -173,6 +174,11 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, struct et
cmd = submit->cmd[submit->nr_cmds - 1].obj;
CMD_LINK(cmd, 4, buffer->paddr + (back * 4));
+ /* update the size */
+ for (i = 0; i < submit->nr_cmds; i++)
+ submit->cmd[i].size = submit->cmd[i].obj->offset -
+ submit->cmd[i].offset;
+
printk(KERN_ERR "stream link @ 0x%08x\n", cmd->paddr + ((cmd->offset - 1) * 4));
printk(KERN_ERR "stream link @ %p\n", cmd->vaddr + ((cmd->offset - 1) * 4));
@@ -193,7 +199,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, struct et
/* Change WAIT into a LINK command; write the address first. */
i = VIV_FE_LINK_HEADER_OP_LINK | VIV_FE_LINK_HEADER_PREFETCH(submit->cmd[0].size * 2);
- *(lw + 1) = submit->cmd[0].obj->paddr;
+ *(lw + 1) = submit->cmd[0].obj->paddr + submit->cmd[0].offset * 4;
mb();
*(lw)= i;
mb();
@@ -87,6 +87,7 @@ struct etnaviv_gem_submit {
unsigned int nr_bos;
struct {
uint32_t type;
+ uint32_t offset; /* in dwords */
uint32_t size; /* in dwords */
struct etnaviv_gem_object *obj;
} cmd[MAX_CMDS];
@@ -382,6 +382,13 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
goto out;
}
+ if (submit_cmd.submit_offset % 8) {
+ DRM_ERROR("non-aligned cmdstream buffer size: %u\n",
+ submit_cmd.size);
+ ret = -EINVAL;
+ goto out;
+ }
+
/*
* We must have space to add a LINK command at the end of
* the command buffer.
@@ -396,6 +403,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
}
submit->cmd[i].type = submit_cmd.type;
+ submit->cmd[i].offset = submit_cmd.submit_offset / 4;
submit->cmd[i].size = submit_cmd.size / 4;
submit->cmd[i].obj = etnaviv_obj;