mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
v3dv: implement vkDeviceWaitIdle
This is really a hack, but it is better than not having anything. In the future we should have a syncobject that we could wait on. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
parent
4279145124
commit
0b08f83817
3 changed files with 23 additions and 4 deletions
|
|
@ -954,6 +954,14 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice,
|
|||
device->devinfo = physical_device->devinfo;
|
||||
device->enabled_extensions = enabled_extensions;
|
||||
|
||||
int ret = drmSyncobjCreate(device->fd,
|
||||
DRM_SYNCOBJ_CREATE_SIGNALED,
|
||||
&device->last_job_sync);
|
||||
if (ret) {
|
||||
result = VK_ERROR_INITIALIZATION_FAILED;
|
||||
goto fail_fd;
|
||||
}
|
||||
|
||||
init_device_dispatch(device);
|
||||
|
||||
*pDevice = v3dv_device_to_handle(device);
|
||||
|
|
@ -973,6 +981,8 @@ v3dv_DestroyDevice(VkDevice _device,
|
|||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
V3DV_FROM_HANDLE(v3dv_device, device, _device);
|
||||
|
||||
drmSyncobjDestroy(device->fd, device->last_job_sync);
|
||||
queue_finish(&device->queue);
|
||||
vk_free2(&default_alloc, pAllocator, device);
|
||||
}
|
||||
|
|
@ -994,7 +1004,13 @@ v3dv_GetDeviceQueue(VkDevice _device,
|
|||
VkResult
|
||||
v3dv_DeviceWaitIdle(VkDevice _device)
|
||||
{
|
||||
/* FIXME: stub */
|
||||
V3DV_FROM_HANDLE(v3dv_device, device, _device);
|
||||
|
||||
int ret =
|
||||
drmSyncobjWait(device->fd, &device->last_job_sync, 1, INT64_MAX, 0, NULL);
|
||||
if (ret)
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,10 @@ struct v3dv_device {
|
|||
struct v3d_device_info devinfo;
|
||||
struct v3dv_queue queue;
|
||||
|
||||
/* FIXME: stub */
|
||||
/* Last command buffer submitted on this device. We use this to check if
|
||||
* the GPU is idle.
|
||||
*/
|
||||
uint32_t last_job_sync;
|
||||
};
|
||||
|
||||
struct v3dv_device_memory {
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ job_submit(struct v3dv_job *job)
|
|||
*/
|
||||
submit.in_sync_rcl = 0; /* FIXME */
|
||||
|
||||
/* Update the sync object for the last rendering by our context. */
|
||||
submit.out_sync = 0; /* FIXME */
|
||||
/* Update the sync object for the last rendering by this device. */
|
||||
submit.out_sync = job->cmd_buffer->device->last_job_sync;
|
||||
|
||||
submit.bcl_start = job->bcl.bo->offset;
|
||||
submit.bcl_end = job->bcl.bo->offset + v3dv_cl_offset(&job->bcl);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue