Exemplo n.º 1
0
/* called under struct_mutex */
void msm_rd_dump_submit(struct msm_gem_submit *submit)
{
    struct drm_device *dev = submit->dev;
    struct msm_drm_private *priv = dev->dev_private;
    struct msm_rd_state *rd = priv->rd;
    char msg[128];
    int i, n;

    if (!rd->open)
        return;

    /* writing into fifo is serialized by caller, and
     * rd->read_lock is used to serialize the reads
     */
    WARN_ON(!mutex_is_locked(&dev->struct_mutex));

    n = snprintf(msg, sizeof(msg), "%.*s/%d: fence=%u",
                 TASK_COMM_LEN, current->comm, task_pid_nr(current),
                 submit->fence->seqno);

    rd_write_section(rd, RD_CMD, msg, ALIGN(n, 4));

    /* could be nice to have an option (module-param?) to snapshot
     * all the bo's associated with the submit.  Handy to see vtx
     * buffers, etc.  For now just the cmdstream bo's is enough.
     */

    for (i = 0; i < submit->nr_cmds; i++) {
        uint32_t idx  = submit->cmd[i].idx;
        uint32_t iova = submit->cmd[i].iova;
        uint32_t szd  = submit->cmd[i].size; /* in dwords */
        struct msm_gem_object *obj = submit->bos[idx].obj;
        const char *buf = msm_gem_vaddr_locked(&obj->base);

        buf += iova - submit->bos[idx].iova;

        rd_write_section(rd, RD_GPUADDR,
        (uint32_t[2]) {
            iova, szd * 4
        }, 8);
        rd_write_section(rd, RD_BUFFER_CONTENTS,
                         buf, szd * 4);

        switch (submit->cmd[i].type) {
        case MSM_SUBMIT_CMD_IB_TARGET_BUF:
            /* ignore IB-targets, we've logged the buffer, the
             * parser tool will follow the IB based on the logged
             * buffer/gpuaddr, so nothing more to do.
             */
            break;
        case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
        case MSM_SUBMIT_CMD_BUF:
            rd_write_section(rd, RD_CMDSTREAM_ADDR,
            (uint32_t[2]) {
                iova, szd
            }, 8);
            break;
        }
    }
}
Exemplo n.º 2
0
struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int size)
{
	struct msm_ringbuffer *ring;
	int ret;

	size = ALIGN(size, 4);   /* size should be dword aligned */

	ring = kzalloc(sizeof(*ring), GFP_KERNEL);
	if (!ring) {
		ret = -ENOMEM;
		goto fail;
	}

	ring->gpu = gpu;
	ring->bo = msm_gem_new(gpu->dev, size, MSM_BO_WC);
	if (IS_ERR(ring->bo)) {
		ret = PTR_ERR(ring->bo);
		ring->bo = NULL;
		goto fail;
	}

	ring->start = msm_gem_vaddr_locked(ring->bo);
	ring->end   = ring->start + (size / 4);
	ring->cur   = ring->start;

	ring->size = size;

	return ring;

fail:
	if (ring)
		msm_ringbuffer_destroy(ring);
	return ERR_PTR(ret);
}
Exemplo n.º 3
0
void *msm_gem_vaddr(struct drm_gem_object *obj)
{
	void *ret;
	mutex_lock(&obj->dev->struct_mutex);
	ret = msm_gem_vaddr_locked(obj);
	mutex_unlock(&obj->dev->struct_mutex);
	return ret;
}