From 37a724e4ae0804745af3ad8954f7389f629c6785 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Mon, 27 Apr 2020 22:54:51 +0000 Subject: [PATCH] anv/dg1: Don't use SET_TILING kernel uapi. It is not available on discrete platforms anymore. Reviewed-by: Jordan Justen Part-of: --- src/intel/vulkan/anv_gem.c | 11 +++++++++++ src/intel/vulkan/anv_image.c | 13 +++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c index c3adc0c3cff..fca72a9803e 100644 --- a/src/intel/vulkan/anv_gem.c +++ b/src/intel/vulkan/anv_gem.c @@ -227,6 +227,11 @@ anv_gem_get_tiling(struct anv_device *device, uint32_t gem_handle) .handle = gem_handle, }; + /* FIXME: On discrete platforms we don't have DRM_IOCTL_I915_GEM_GET_TILING + * anymore, so we will need another way to get the tiling. Apparently this + * is only used in Android code, so we may need some other way to + * communicate the tiling mode. + */ if (gen_ioctl(device->fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling)) { assert(!"Failed to get BO tiling"); return -1; @@ -241,6 +246,12 @@ anv_gem_set_tiling(struct anv_device *device, { int ret; + /* On discrete platforms we don't have DRM_IOCTL_I915_GEM_SET_TILING. So + * nothing needs to be done. + */ + if (!device->info.has_tiling_uapi) + return 0; + /* set_tiling overwrites the input on the error path, so we have to open * code gen_ioctl. */ diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index b6ab727cb37..8fc5dd80f96 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -93,7 +93,8 @@ choose_isl_surf_usage(VkImageCreateFlags vk_create_flags, } static isl_tiling_flags_t -choose_isl_tiling_flags(const struct anv_image_create_info *anv_info, +choose_isl_tiling_flags(const struct gen_device_info *devinfo, + const struct anv_image_create_info *anv_info, const struct isl_drm_modifier_info *isl_mod_info, bool legacy_scanout) { @@ -117,8 +118,12 @@ choose_isl_tiling_flags(const struct anv_image_create_info *anv_info, if (anv_info->isl_tiling_flags) flags &= anv_info->isl_tiling_flags; - if (legacy_scanout) - flags &= ISL_TILING_LINEAR_BIT | ISL_TILING_X_BIT; + if (legacy_scanout) { + isl_tiling_flags_t legacy_mask = ISL_TILING_LINEAR_BIT; + if (devinfo->has_tiling_uapi) + legacy_mask |= ISL_TILING_X_BIT; + flags &= legacy_mask; + } assert(flags); @@ -734,7 +739,7 @@ anv_image_create(VkDevice _device, assert(format != NULL); const isl_tiling_flags_t isl_tiling_flags = - choose_isl_tiling_flags(create_info, isl_mod_info, + choose_isl_tiling_flags(&device->info, create_info, isl_mod_info, image->needs_set_tiling); image->n_planes = format->n_planes; -- 2.30.2