broadcom/simulator: enable multisync in the simulator
Use drmSyncobjSignal to signal out_syncobjs when a GPU job submission ends in the simulator. With this, we can enable multisync support in the simulator and keep the multisync approach to process fence by submitting a serialized no-op job that adds the fence to the array of out syncobjs, i.e. syncobjs to be signaled in the kernel when a job completes (job post deps). Signed-off-by: Melissa Wen <mwen@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14768>
This commit is contained in:
parent
5200e1c212
commit
70a219d4a3
|
@ -427,6 +427,32 @@ v3d_simulator_perfmon_switch(int fd, uint32_t perfid)
|
|||
file->active_perfid = perfid;
|
||||
}
|
||||
|
||||
static int
|
||||
v3d_simulator_signal_syncobjs(int fd, struct drm_v3d_multi_sync *ms)
|
||||
{
|
||||
struct drm_v3d_sem *out_syncs = (void *)(uintptr_t)ms->out_syncs;
|
||||
int n_syncobjs = ms->out_sync_count;
|
||||
uint32_t syncobjs[n_syncobjs];
|
||||
|
||||
for (int i = 0; i < n_syncobjs; i++)
|
||||
syncobjs[i] = out_syncs[i].handle;
|
||||
return drmSyncobjSignal(fd, (uint32_t *) &syncobjs, n_syncobjs);
|
||||
}
|
||||
|
||||
static int
|
||||
v3d_simulator_process_post_deps(int fd, struct drm_v3d_extension *ext)
|
||||
{
|
||||
int ret = 0;
|
||||
while (ext && ext->id != DRM_V3D_EXT_ID_MULTI_SYNC)
|
||||
ext = (void *)(uintptr_t) ext->next;
|
||||
|
||||
if (ext) {
|
||||
struct drm_v3d_multi_sync *ms = (struct drm_v3d_multi_sync *) ext;
|
||||
ret = v3d_simulator_signal_syncobjs(fd, ms);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
v3d_simulator_submit_cl_ioctl(int fd, struct drm_v3d_submit_cl *submit)
|
||||
{
|
||||
|
@ -459,7 +485,12 @@ v3d_simulator_submit_cl_ioctl(int fd, struct drm_v3d_submit_cl *submit)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
if (submit->flags & DRM_V3D_SUBMIT_EXTENSION) {
|
||||
struct drm_v3d_extension *ext = (void *)(uintptr_t)submit->extensions;
|
||||
ret = v3d_simulator_process_post_deps(fd, ext);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -590,6 +621,14 @@ v3d_simulator_submit_tfu_ioctl(int fd, struct drm_v3d_submit_tfu *args)
|
|||
|
||||
v3d_simulator_copy_out_handle(file, args->bo_handles[0]);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (args->flags & DRM_V3D_SUBMIT_EXTENSION) {
|
||||
struct drm_v3d_extension *ext = (void *)(uintptr_t)args->extensions;
|
||||
ret = v3d_simulator_process_post_deps(fd, ext);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -614,6 +653,14 @@ v3d_simulator_submit_csd_ioctl(int fd, struct drm_v3d_submit_csd *args)
|
|||
for (int i = 0; i < args->bo_handle_count; i++)
|
||||
v3d_simulator_copy_out_handle(file, bo_handles[i]);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (args->flags & DRM_V3D_SUBMIT_EXTENSION) {
|
||||
struct drm_v3d_extension *ext = (void *)(uintptr_t)args->extensions;
|
||||
ret = v3d_simulator_process_post_deps(fd, ext);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ v3dX(simulator_get_param_ioctl)(struct v3d_hw *v3d,
|
|||
args->value = V3D_VERSION >= 41;
|
||||
return 0;
|
||||
case DRM_V3D_PARAM_SUPPORTS_MULTISYNC_EXT:
|
||||
args->value = 0;
|
||||
args->value = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue