freedreno/drm/virtio: Remove prealloc_list

Now that we are allocating cmdstream from the heap, we shouldn't need
this.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
This commit is contained in:
Rob Clark 2022-12-10 15:17:12 -08:00 committed by Marge Bot
parent 4861067689
commit 4be235af7c
4 changed files with 2 additions and 47 deletions

View file

@ -361,8 +361,8 @@ fail:
}
/* allocate a buffer object: */
static struct fd_bo *
virtio_bo_new_impl(struct fd_device *dev, uint32_t size, uint32_t flags)
struct fd_bo *
virtio_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags)
{
struct virtio_device *virtio_dev = to_virtio_device(dev);
struct drm_virtgpu_resource_create_blob args = {
@ -438,38 +438,3 @@ fail:
}
return NULL;
}
struct fd_bo *
virtio_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags)
{
struct fd_bo *bo = virtio_bo_new_impl(dev, size, flags);
if (bo && (flags == RING_FLAGS) && (size == SUBALLOC_SIZE)) {
struct virtio_device *virtio_dev = to_virtio_device(dev);
/*
* Swap the bo with an earlier pre-allocated one, since we know
* this one will be immediately mmap'd and want to avoid the
* latency hit of waiting for the host to catch up.
*/
simple_mtx_lock(&virtio_dev->eb_lock);
list_addtail(&bo->node, &virtio_dev->prealloc_list);
bo = first_bo(&virtio_dev->prealloc_list);
list_delinit(&bo->node);
simple_mtx_unlock(&virtio_dev->eb_lock);
}
return bo;
}
void virtio_bo_setup_prealloc(struct fd_device *dev)
{
struct virtio_device *virtio_dev = to_virtio_device(dev);
for (int i = 0; i < 16; i++) {
struct fd_bo *bo = virtio_bo_new_impl(dev, SUBALLOC_SIZE, RING_FLAGS);
if (!bo)
break;
list_addtail(&bo->node, &virtio_dev->prealloc_list);
}
}

View file

@ -205,8 +205,6 @@ virtio_device_new(int fd, drmVersionPtr version)
set_debuginfo(dev);
list_inithead(&virtio_dev->prealloc_list);
util_vma_heap_init(&virtio_dev->address_space,
caps.u.msm.va_start,
caps.u.msm.va_size);

View file

@ -220,8 +220,6 @@ init_shmem(struct fd_device *dev)
uint32_t offset = virtio_dev->shmem->rsp_mem_offset;
virtio_dev->rsp_mem_len = fd_bo_size(virtio_dev->shmem_bo) - offset;
virtio_dev->rsp_mem = &((uint8_t *)virtio_dev->shmem)[offset];
virtio_bo_setup_prealloc(dev);
}
simple_mtx_unlock(&virtio_dev->rsp_lock);

View file

@ -81,11 +81,6 @@ struct virtio_device {
struct util_vma_heap address_space;
simple_mtx_t address_space_lock;
/**
* Pre-allocated cmdstream buffers to avoid stalling on mmap.
*/
struct list_head prealloc_list;
uint32_t reqbuf_len;
uint32_t reqbuf_cnt;
uint8_t reqbuf[0x4000];
@ -181,7 +176,6 @@ FD_DEFINE_CAST(fd_bo, virtio_bo);
struct fd_bo *virtio_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags);
struct fd_bo *virtio_bo_from_handle(struct fd_device *dev, uint32_t size,
uint32_t handle);
void virtio_bo_setup_prealloc(struct fd_device *dev);
/*
* Internal helpers: