.free = intel_aux_map_buffer_free,
};
-static VkResult anv_device_check_status(struct vk_device *vk_device);
-
VkResult anv_CreateDevice(
VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo* pCreateInfo,
}
device->vk.command_buffer_ops = &anv_cmd_buffer_ops;
- device->vk.check_status = anv_device_check_status;
+ device->vk.check_status = anv_i915_device_check_status;
device->vk.create_sync_for_memory = anv_create_sync_for_memory;
vk_device_set_drm_fd(&device->vk, device->fd);
return vk_error(NULL, VK_ERROR_LAYER_NOT_PRESENT);
}
-static VkResult
-anv_device_check_status(struct vk_device *vk_device)
-{
- struct anv_device *device = container_of(vk_device, struct anv_device, vk);
-
- uint32_t active, pending;
- int ret = anv_gem_context_get_reset_stats(device->fd, device->context_id,
- &active, &pending);
- if (ret == -1) {
- /* We don't know the real error. */
- return vk_device_set_lost(&device->vk, "get_reset_stats failed: %m");
- }
-
- if (active) {
- return vk_device_set_lost(&device->vk, "GPU hung on one of our command buffers");
- } else if (pending) {
- return vk_device_set_lost(&device->vk, "GPU hung with commands in-flight");
- }
-
- return VK_SUCCESS;
-}
-
VkResult
anv_device_wait(struct anv_device *device, struct anv_bo *bo,
int64_t timeout)
}
int
-anv_gem_context_get_reset_stats(int fd, int context,
- uint32_t *active, uint32_t *pending)
-{
- struct drm_i915_reset_stats stats = {
- .ctx_id = context,
- };
-
- int ret = intel_ioctl(fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats);
- if (ret == 0) {
- *active = stats.batch_active;
- *pending = stats.batch_pending;
- }
-
- return ret;
-}
-
-int
anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle)
{
struct drm_prime_handle args = {
}
int
-anv_gem_context_get_reset_stats(int fd, int context,
- uint32_t *active, uint32_t *pending)
-{
- unreachable("Unused");
-}
-
-int
anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle)
{
unreachable("Unused");
int anv_gem_set_tiling(struct anv_device *device, uint32_t gem_handle,
uint32_t stride, uint32_t tiling);
int anv_gem_get_tiling(struct anv_device *device, uint32_t gem_handle);
-int anv_gem_context_get_reset_stats(int fd, int context,
- uint32_t *active, uint32_t *pending);
int anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle);
uint32_t anv_gem_fd_to_handle(struct anv_device *device, int fd);
int anv_gem_set_caching(struct anv_device *device, uint32_t gem_handle, uint32_t caching);
intel_gem_destroy_context(device->fd, device->context_id);
return result;
}
+
+static int
+anv_gem_context_get_reset_stats(int fd, int context,
+ uint32_t *active, uint32_t *pending)
+{
+ struct drm_i915_reset_stats stats = {
+ .ctx_id = context,
+ };
+
+ int ret = intel_ioctl(fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats);
+ if (ret == 0) {
+ *active = stats.batch_active;
+ *pending = stats.batch_pending;
+ }
+
+ return ret;
+}
+
+VkResult
+anv_i915_device_check_status(struct vk_device *vk_device)
+{
+ struct anv_device *device = container_of(vk_device, struct anv_device, vk);
+ uint32_t active = 0, pending = 0;
+ int ret = anv_gem_context_get_reset_stats(device->fd, device->context_id,
+ &active, &pending);
+ if (ret == -1) {
+ /* We don't know the real error. */
+ return vk_device_set_lost(&device->vk, "get_reset_stats failed: %m");
+ }
+
+ if (active) {
+ return vk_device_set_lost(&device->vk, "GPU hung on one of our command buffers");
+ } else if (pending) {
+ return vk_device_set_lost(&device->vk, "GPU hung with commands in-flight");
+ }
+
+ return VK_SUCCESS;
+}
#pragma once
#include "vulkan/vulkan_core.h"
+#include "vk_device.h"
struct anv_device;
struct anv_physical_device;
anv_i915_device_setup_context(struct anv_device *device,
const VkDeviceCreateInfo *pCreateInfo,
const uint32_t num_queues);
+
+VkResult anv_i915_device_check_status(struct vk_device *vk_device);