mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 04:00:10 +01:00
freedreno/drm/virtio: Add some atrace
Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18111>
This commit is contained in:
parent
b69cbc0caa
commit
bacb04ef62
4 changed files with 20 additions and 7 deletions
|
|
@ -35,7 +35,7 @@ bo_allocate(struct virtio_bo *virtio_bo)
|
|||
};
|
||||
int ret;
|
||||
|
||||
ret = drmIoctl(bo->dev->fd, DRM_IOCTL_VIRTGPU_MAP, &req);
|
||||
ret = virtio_ioctl(bo->dev->fd, VIRTGPU_MAP, &req);
|
||||
if (ret) {
|
||||
ERROR_MSG("alloc failed: %s", strerror(errno));
|
||||
return ret;
|
||||
|
|
@ -67,7 +67,7 @@ virtio_bo_cpu_prep_guest(struct fd_bo *bo)
|
|||
int ret;
|
||||
|
||||
/* Side note, this ioctl is defined as IO_WR but should be IO_W: */
|
||||
ret = drmIoctl(bo->dev->fd, DRM_IOCTL_VIRTGPU_WAIT, &args);
|
||||
ret = virtio_ioctl(bo->dev->fd, VIRTGPU_WAIT, &args);
|
||||
if (ret && errno == EBUSY)
|
||||
return -EBUSY;
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
|
|||
};
|
||||
int ret;
|
||||
|
||||
ret = drmCommandWriteRead(dev->fd, DRM_VIRTGPU_RESOURCE_INFO, &args, sizeof(args));
|
||||
ret = virtio_ioctl(dev->fd, VIRTGPU_RESOURCE_INFO, &args);
|
||||
if (ret) {
|
||||
INFO_MSG("failed to get resource info: %s", strerror(errno));
|
||||
free(virtio_bo);
|
||||
|
|
@ -383,7 +383,7 @@ virtio_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags)
|
|||
simple_mtx_lock(&virtio_dev->eb_lock);
|
||||
if (args.cmd)
|
||||
req.hdr.seqno = ++virtio_dev->next_seqno;
|
||||
ret = drmIoctl(dev->fd, DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_BLOB, &args);
|
||||
ret = virtio_ioctl(dev->fd, VIRTGPU_RESOURCE_CREATE_BLOB, &args);
|
||||
simple_mtx_unlock(&virtio_dev->eb_lock);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ get_capset(int fd, struct virgl_renderer_capset_drm *caps)
|
|||
|
||||
memset(caps, 0, sizeof(*caps));
|
||||
|
||||
return drmIoctl(fd, DRM_IOCTL_VIRTGPU_GET_CAPS, &args);
|
||||
return virtio_ioctl(fd, VIRTGPU_GET_CAPS, &args);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -73,7 +73,7 @@ set_context(int fd)
|
|||
.ctx_set_params = VOID2U64(params),
|
||||
};
|
||||
|
||||
return drmIoctl(fd, DRM_IOCTL_VIRTGPU_CONTEXT_INIT, &args);
|
||||
return virtio_ioctl(fd, VIRTGPU_CONTEXT_INIT, &args);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -258,7 +258,7 @@ execbuf_locked(struct fd_device *dev, void *cmd, uint32_t cmd_size,
|
|||
.num_bo_handles = num_handles,
|
||||
};
|
||||
|
||||
int ret = drmIoctl(dev->fd, DRM_IOCTL_VIRTGPU_EXECBUFFER, &eb);
|
||||
int ret = virtio_ioctl(dev->fd, VIRTGPU_EXECBUFFER, &eb);
|
||||
if (ret) {
|
||||
ERROR_MSG("EXECBUFFER failed: %s", strerror(errno));
|
||||
return ret;
|
||||
|
|
@ -359,9 +359,11 @@ out_unlock:
|
|||
return ret;
|
||||
|
||||
if (sync) {
|
||||
MESA_TRACE_BEGIN("virtio_execbuf sync");
|
||||
sync_wait(fence_fd, -1);
|
||||
close(fence_fd);
|
||||
virtio_host_sync(dev, req);
|
||||
MESA_TRACE_END();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,13 @@ struct virtio_device {
|
|||
};
|
||||
FD_DEFINE_CAST(fd_device, virtio_device);
|
||||
|
||||
#define virtio_ioctl(fd, name, args) ({ \
|
||||
MESA_TRACE_BEGIN(#name); \
|
||||
int ret = drmIoctl((fd), DRM_IOCTL_ ## name, (args)); \
|
||||
MESA_TRACE_END(); \
|
||||
ret; \
|
||||
})
|
||||
|
||||
struct fd_device *virtio_device_new(int fd, drmVersionPtr version);
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ retire_execute(void *job, void *gdata, int thread_index)
|
|||
{
|
||||
struct fd_submit_sp *fd_submit = job;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
sync_wait(fd_submit->out_fence_fd, -1);
|
||||
close(fd_submit->out_fence_fd);
|
||||
}
|
||||
|
|
@ -56,6 +58,8 @@ flush_submit_list(struct list_head *submit_list)
|
|||
|
||||
unsigned nr_cmds = 0;
|
||||
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
/* Determine the number of extra cmds's from deferred submits that
|
||||
* we will be merging in:
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue