bo->name = "winsys";
bo->private = false;
+#ifdef USE_VC5_SIMULATOR
+ vc5_simulator_open_from_handle(screen->fd, winsys_stride,
+ bo->handle, bo->size);
+ bo->map = malloc(bo->size);
+#endif
+
struct drm_vc5_get_bo_offset get = {
.handle = handle,
};
if (ret) {
fprintf(stderr, "Failed to get BO offset: %s\n",
strerror(errno));
+ free(bo->map);
free(bo);
return NULL;
}
bo->offset = get.offset;
-#ifdef USE_VC5_SIMULATOR
- vc5_simulator_open_from_handle(screen->fd, winsys_stride,
- bo->handle, bo->size);
- bo->map = malloc(bo->size);
-#endif
-
util_hash_table_set(screen->bo_handles, (void *)(uintptr_t)handle, bo);
done:
return ret;
}
+static int
+vc5_simulator_get_bo_offset_ioctl(int fd, struct drm_vc5_get_bo_offset *args)
+{
+ struct vc5_simulator_file *file = vc5_get_simulator_file_for_fd(fd);
+ struct vc5_simulator_bo *sim_bo = vc5_get_simulator_bo(file,
+ args->handle);
+
+ args->offset = sim_bo->block->ofs;
+
+ return 0;
+}
+
static int
vc5_simulator_gem_close_ioctl(int fd, struct drm_gem_close *args)
{
return vc5_simulator_create_bo_ioctl(fd, args);
case DRM_IOCTL_VC5_MMAP_BO:
return vc5_simulator_mmap_bo_ioctl(fd, args);
+ case DRM_IOCTL_VC5_GET_BO_OFFSET:
+ return vc5_simulator_get_bo_offset_ioctl(fd, args);
case DRM_IOCTL_VC5_WAIT_BO:
/* We do all of the vc5 rendering synchronously, so we just