iris: Move bo_set_caching to kmd backend

For the platforms that call it, it a function in the hot path so
moving it to kmd backend.

After this patch i915/iris_bufmgr.c is empty but not removing it
as next patch will add functions to it.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21494>
This commit is contained in:
José Roberto de Souza 2023-03-06 09:11:00 -08:00 committed by Marge Bot
parent bdfcc98001
commit 7553d921f6
5 changed files with 14 additions and 22 deletions

View file

@ -27,12 +27,3 @@
#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);
}

View file

@ -26,4 +26,3 @@
struct iris_bo;
int iris_i915_bo_set_caching(struct iris_bo *bo, bool cached);

View file

@ -107,11 +107,23 @@ i915_bo_madvise(struct iris_bo *bo, enum iris_madvice state)
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;
}

View file

@ -1034,17 +1034,6 @@ iris_heap_to_string[IRIS_HEAP_MAX] = {
[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,
@ -1138,7 +1127,7 @@ iris_bo_alloc(struct iris_bufmgr *bufmgr,
*/
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;

View file

@ -39,6 +39,7 @@ struct iris_kmd_backend {
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 *