void *(*resource_map)(struct virgl_winsys *vws, struct virgl_hw_res *res);
void (*resource_wait)(struct virgl_winsys *vws, struct virgl_hw_res *res);
+ boolean (*resource_is_busy)(struct virgl_winsys *vws,
+ struct virgl_hw_res *res);
struct virgl_hw_res *(*resource_create_from_handle)(struct virgl_winsys *vws,
struct winsys_handle *whandle);
FREE(res);
}
-static boolean virgl_drm_resource_is_busy(struct virgl_drm_winsys *qdws,
+static boolean virgl_drm_resource_is_busy(struct virgl_winsys *vws,
struct virgl_hw_res *res)
{
+ struct virgl_drm_winsys *vdws = virgl_drm_winsys(vws);
struct drm_virtgpu_3d_wait waitcmd;
int ret;
waitcmd.handle = res->bo_handle;
waitcmd.flags = VIRTGPU_WAIT_NOWAIT;
- ret = drmIoctl(qdws->fd, DRM_IOCTL_VIRTGPU_WAIT, &waitcmd);
+ ret = drmIoctl(vdws->fd, DRM_IOCTL_VIRTGPU_WAIT, &waitcmd);
if (ret && errno == EBUSY)
return TRUE;
return FALSE;
if (res->size > size * 2)
return 0;
- if (virgl_drm_resource_is_busy(qdws, res)) {
+ if (virgl_drm_resource_is_busy(&qdws->base, res)) {
return -1;
}
struct pipe_fence_handle *_fence,
uint64_t timeout)
{
- struct virgl_drm_winsys *vdws = virgl_drm_winsys(vws);
struct virgl_drm_fence *fence = virgl_drm_fence(_fence);
if (vws->supports_fences) {
}
if (timeout == 0)
- return !virgl_drm_resource_is_busy(vdws, fence->hw_res);
+ return !virgl_drm_resource_is_busy(vws, fence->hw_res);
if (timeout != PIPE_TIMEOUT_INFINITE) {
int64_t start_time = os_time_get();
timeout /= 1000;
- while (virgl_drm_resource_is_busy(vdws, fence->hw_res)) {
+ while (virgl_drm_resource_is_busy(vws, fence->hw_res)) {
if (os_time_get() - start_time >= timeout)
return FALSE;
os_time_sleep(10);
qdws->base.resource_get_handle = virgl_drm_winsys_resource_get_handle;
qdws->base.resource_map = virgl_drm_resource_map;
qdws->base.resource_wait = virgl_drm_resource_wait;
+ qdws->base.resource_is_busy = virgl_drm_resource_is_busy;
qdws->base.cmd_buf_create = virgl_drm_cmd_buf_create;
qdws->base.cmd_buf_destroy = virgl_drm_cmd_buf_destroy;
qdws->base.submit_cmd = virgl_drm_winsys_submit_cmd;
FREE(res);
}
-static boolean virgl_vtest_resource_is_busy(struct virgl_vtest_winsys *vtws,
+static boolean virgl_vtest_resource_is_busy(struct virgl_winsys *vws,
struct virgl_hw_res *res)
{
+ struct virgl_vtest_winsys *vtws = virgl_vtest_winsys(vws);
+
/* implement busy check */
int ret;
ret = virgl_vtest_busy_wait(vtws, res->res_handle, 0);
if (res->size > size * 2)
return 0;
- if (virgl_vtest_resource_is_busy(vtws, res)) {
+ if (virgl_vtest_resource_is_busy(&vtws->base, res)) {
return -1;
}
struct pipe_fence_handle *fence,
uint64_t timeout)
{
- struct virgl_vtest_winsys *vdws = virgl_vtest_winsys(vws);
struct virgl_hw_res *res = virgl_hw_res(fence);
if (timeout == 0)
- return !virgl_vtest_resource_is_busy(vdws, res);
+ return !virgl_vtest_resource_is_busy(vws, res);
if (timeout != PIPE_TIMEOUT_INFINITE) {
int64_t start_time = os_time_get();
timeout /= 1000;
- while (virgl_vtest_resource_is_busy(vdws, res)) {
+ while (virgl_vtest_resource_is_busy(vws, res)) {
if (os_time_get() - start_time >= timeout)
return FALSE;
os_time_sleep(10);
vtws->base.resource_unref = virgl_vtest_winsys_resource_unref;
vtws->base.resource_map = virgl_vtest_resource_map;
vtws->base.resource_wait = virgl_vtest_resource_wait;
+ vtws->base.resource_is_busy = virgl_vtest_resource_is_busy;
vtws->base.cmd_buf_create = virgl_vtest_cmd_buf_create;
vtws->base.cmd_buf_destroy = virgl_vtest_cmd_buf_destroy;
vtws->base.submit_cmd = virgl_vtest_winsys_submit_cmd;