isl: Define isl_drm_modifier_get_score() [v3]

Return the modifier's score, which indicates the driver's preference for the
modifier relative to others. A higher score is better. Zero means
unsupported.

Intended to assist selection of a modifier from an externally provided list,
such as VkImageDrmFormatModifierListCreateInfoEXT.

v2:
  - Rename anv_drm_format_mod_score to isl_drm_modifier_get_score.
  - Squash all incremental changes to anv_drm_format_mod_score.
v3:
  - Drop redundant 'unlikely'. (for nchery)

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v2)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v3)
This commit is contained in:
Chad Versace
2020-08-25 10:35:24 -07:00
parent b50275a4b6
commit 01bad67a94
2 changed files with 39 additions and 0 deletions

View File

@@ -29,6 +29,7 @@
#include "isl.h"
#include "dev/gen_device_info.h"
#include "dev/gen_debug.h"
uint32_t
isl_tiling_to_i915_tiling(enum isl_tiling tiling)
@@ -121,3 +122,29 @@ isl_drm_modifier_get_info(uint64_t modifier)
return NULL;
}
uint32_t
isl_drm_modifier_get_score(const struct gen_device_info *devinfo,
uint64_t modifier)
{
/* FINISHME: Add gen12 modifiers */
switch (modifier) {
default:
return 0;
case DRM_FORMAT_MOD_LINEAR:
return 1;
case I915_FORMAT_MOD_X_TILED:
return 2;
case I915_FORMAT_MOD_Y_TILED:
return 3;
case I915_FORMAT_MOD_Y_TILED_CCS:
/* Gen12's CCS layout differs from Gen9-11. */
if (devinfo->gen >= 12)
return 0;
if (INTEL_DEBUG & DEBUG_NO_RBC)
return 0;
return 4;
}
}