freedreno/drm: Make threaded-submit optional

We've had gpu-sched support in the kernel for a while now, so our fence
waits are not synchronous in the ioctl path.  The only reason this path
still exists is that virtgpu does not have gpu-sched.  So lets disable
it on msm.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22098>
This commit is contained in:
Rob Clark
2023-03-24 13:35:33 -07:00
committed by Marge Bot
parent cacbbfd6a8
commit a16533c43e
3 changed files with 23 additions and 6 deletions

View File

@@ -197,7 +197,7 @@ fd_device_del(struct fd_device *dev)
_mesa_hash_table_destroy(dev->handle_table, NULL);
_mesa_hash_table_destroy(dev->name_table, NULL);
if (util_queue_is_initialized(&dev->submit_queue))
if (fd_device_threaded_submit(dev))
util_queue_destroy(&dev->submit_queue);
if (dev->closefd)

View File

@@ -271,6 +271,12 @@ struct fd_device {
struct util_queue submit_queue;
};
static inline bool
fd_device_threaded_submit(struct fd_device *dev)
{
return util_queue_is_initialized(&dev->submit_queue);
}
#define foreach_submit(name, list) \
list_for_each_entry(struct fd_submit, name, list, node)
#define foreach_submit_safe(name, list) \

View File

@@ -292,11 +292,16 @@ flush_deferred_submits(struct fd_device *dev)
DEBUG_MSG("enqueue: %u", submit->fence);
util_queue_add_job(&submit->pipe->dev->submit_queue,
submit, fence,
fd_submit_sp_flush_execute,
fd_submit_sp_flush_cleanup,
0);
if (fd_device_threaded_submit(submit->pipe->dev)) {
util_queue_add_job(&submit->pipe->dev->submit_queue,
submit, fence,
fd_submit_sp_flush_execute,
fd_submit_sp_flush_cleanup,
0);
} else {
fd_submit_sp_flush_execute(submit, NULL, 0);
fd_submit_sp_flush_cleanup(submit, NULL, 0);
}
}
static bool
@@ -393,6 +398,9 @@ fd_pipe_sp_flush(struct fd_pipe *pipe, uint32_t fence)
{
struct fd_device *dev = pipe->dev;
if (!fd_fence_before(pipe->last_submit_fence, fence))
return;
MESA_TRACE_FUNC();
simple_mtx_lock(&dev->submit_lock);
@@ -403,6 +411,9 @@ fd_pipe_sp_flush(struct fd_pipe *pipe, uint32_t fence)
simple_mtx_unlock(&dev->submit_lock);
if (!fd_device_threaded_submit(pipe->dev))
return;
/* Once we are sure that we've enqueued at least up to the requested
* submit, we need to be sure that submitq has caught up and flushed
* them to the kernel