#include "drm-uapi/i915_drm.h"
-int iris_i915_bo_set_caching(struct iris_bo *bo, bool cached)
-{
- struct drm_i915_gem_caching arg = {
- .handle = bo->gem_handle,
- .caching = cached ? I915_CACHING_CACHED : I915_CACHING_NONE,
- };
- return intel_ioctl(iris_bufmgr_get_fd(bo->bufmgr),
- DRM_IOCTL_I915_GEM_SET_CACHING, &arg);
-}
struct iris_bo;
-int iris_i915_bo_set_caching(struct iris_bo *bo, bool cached);
return madv.retained;
}
+static int
+i915_bo_set_caching(struct iris_bo *bo, bool cached)
+{
+ struct drm_i915_gem_caching arg = {
+ .handle = bo->gem_handle,
+ .caching = cached ? I915_CACHING_CACHED : I915_CACHING_NONE,
+ };
+ return intel_ioctl(iris_bufmgr_get_fd(bo->bufmgr),
+ DRM_IOCTL_I915_GEM_SET_CACHING, &arg);
+}
+
const struct iris_kmd_backend *i915_get_backend(void)
{
static const struct iris_kmd_backend i915_backend = {
.gem_create = i915_gem_create,
.bo_madvise = i915_bo_madvise,
+ .bo_set_caching = i915_bo_set_caching,
};
return &i915_backend;
}
[IRIS_HEAP_DEVICE_LOCAL_PREFERRED] = "local-preferred",
};
-static int iris_bo_set_caching(struct iris_bo *bo, bool cached)
-{
- switch (iris_bufmgr_get_device_info(bo->bufmgr)->kmd_type) {
- case INTEL_KMD_TYPE_I915:
- return iris_i915_bo_set_caching(bo, cached);
- default:
- unreachable("missing");
- return 0;
- }
-}
-
struct iris_bo *
iris_bo_alloc(struct iris_bufmgr *bufmgr,
const char *name,
*/
if ((flags & BO_ALLOC_COHERENT) &&
!bufmgr->devinfo.has_llc && bufmgr->devinfo.has_caching_uapi) {
- if (iris_bo_set_caching(bo, true) != 0)
+ if (bufmgr->kmd_backend->bo_set_caching(bo, true) != 0)
goto err_free;
bo->real.reusable = false;
uint16_t regions_count, uint64_t size,
enum iris_heap heap_flags, unsigned alloc_flags);
bool (*bo_madvise)(struct iris_bo *bo, enum iris_madvice state);
+ int (*bo_set_caching)(struct iris_bo *bo, bool cached);
};
const struct iris_kmd_backend *