Lines Matching +full:3 +full:rd
9 * tail -f /sys/kernel/debug/dri/<minor>/rd > logfile.rd
18 * tail -f /sys/kernel/debug/dri/<minor>/hangrd > logfile.rd
45 MODULE_PARM_DESC(rd_full, "If true, $debugfs/.../rd will snapshot all buffer contents");
102 static void rd_write(struct msm_rd_state *rd, const void *buf, int sz) in rd_write() argument
104 struct circ_buf *fifo = &rd->fifo; in rd_write()
111 wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0 || !rd->open); in rd_write()
112 if (!rd->open) in rd_write()
119 n = min(sz, circ_space_to_end(&rd->fifo)); in rd_write()
126 wake_up_all(&rd->fifo_event); in rd_write()
130 static void rd_write_section(struct msm_rd_state *rd, in rd_write_section() argument
133 rd_write(rd, &type, 4); in rd_write_section()
134 rd_write(rd, &sz, 4); in rd_write_section()
135 rd_write(rd, buf, sz); in rd_write_section()
141 struct msm_rd_state *rd = file->private_data; in rd_read() local
142 struct circ_buf *fifo = &rd->fifo; in rd_read()
146 mutex_lock(&rd->read_lock); in rd_read()
148 ret = wait_event_interruptible(rd->fifo_event, in rd_read()
149 circ_count(&rd->fifo) > 0); in rd_read()
157 n = min_t(int, sz, circ_count_to_end(&rd->fifo)); in rd_read()
166 wake_up_all(&rd->fifo_event); in rd_read()
169 mutex_unlock(&rd->read_lock); in rd_read()
177 struct msm_rd_state *rd = inode->i_private; in rd_open() local
178 struct drm_device *dev = rd->dev; in rd_open()
191 if (rd->open) { in rd_open()
196 file->private_data = rd; in rd_open()
197 rd->open = true; in rd_open()
200 rd->fifo.head = rd->fifo.tail = 0; in rd_open()
210 rd_write_section(rd, RD_GPU_ID, &gpu_id, sizeof(gpu_id)); in rd_open()
213 rd_write_section(rd, RD_CHIP_ID, &val, sizeof(val)); in rd_open()
222 struct msm_rd_state *rd = inode->i_private; in rd_release() local
224 rd->open = false; in rd_release()
225 wake_up_all(&rd->fifo_event); in rd_release()
240 static void rd_cleanup(struct msm_rd_state *rd) in rd_cleanup() argument
242 if (!rd) in rd_cleanup()
245 mutex_destroy(&rd->read_lock); in rd_cleanup()
246 kfree(rd); in rd_cleanup()
251 struct msm_rd_state *rd; in rd_init() local
253 rd = kzalloc(sizeof(*rd), GFP_KERNEL); in rd_init()
254 if (!rd) in rd_init()
257 rd->dev = minor->dev; in rd_init()
258 rd->fifo.buf = rd->buf; in rd_init()
260 mutex_init(&rd->read_lock); in rd_init()
262 init_waitqueue_head(&rd->fifo_event); in rd_init()
264 debugfs_create_file(name, S_IFREG | S_IRUGO, minor->debugfs_root, rd, in rd_init()
267 return rd; in rd_init()
273 struct msm_rd_state *rd; in msm_rd_debugfs_init() local
277 if (priv->rd) in msm_rd_debugfs_init()
280 rd = rd_init(minor, "rd"); in msm_rd_debugfs_init()
281 if (IS_ERR(rd)) { in msm_rd_debugfs_init()
282 ret = PTR_ERR(rd); in msm_rd_debugfs_init()
286 priv->rd = rd; in msm_rd_debugfs_init()
288 rd = rd_init(minor, "hangrd"); in msm_rd_debugfs_init()
289 if (IS_ERR(rd)) { in msm_rd_debugfs_init()
290 ret = PTR_ERR(rd); in msm_rd_debugfs_init()
294 priv->hangrd = rd; in msm_rd_debugfs_init()
305 rd_cleanup(priv->rd); in msm_rd_debugfs_cleanup()
306 priv->rd = NULL; in msm_rd_debugfs_cleanup()
312 static void snapshot_buf(struct msm_rd_state *rd, in snapshot_buf() argument
331 rd_write_section(rd, RD_GPUADDR, in snapshot_buf()
332 (uint32_t[3]){ iova, size, iova >> 32 }, 12); in snapshot_buf()
348 rd_write_section(rd, RD_BUFFER_CONTENTS, buf, size); in snapshot_buf()
357 void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, in msm_rd_dump_submit() argument
364 if (!rd->open) in msm_rd_dump_submit()
368 * rd->read_lock is used to serialize the reads in msm_rd_dump_submit()
379 rd_write_section(rd, RD_CMD, msg, ALIGN(n, 4)); in msm_rd_dump_submit()
394 rd_write_section(rd, RD_CMD, msg, ALIGN(n, 4)); in msm_rd_dump_submit()
397 snapshot_buf(rd, submit, i, 0, 0, should_dump(submit, i)); in msm_rd_dump_submit()
404 snapshot_buf(rd, submit, submit->cmd[i].idx, in msm_rd_dump_submit()
422 rd_write_section(rd, RD_CMDSTREAM_ADDR, in msm_rd_dump_submit()
423 (uint32_t[3]){ iova, szd, iova >> 32 }, 12); in msm_rd_dump_submit()