mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 10:40:11 +01:00
iris: Don't advertise Y-tiled modifiers for scanout buffers on Gfx8
According to isl_gfx7.c:264, the display engine does not support Y tiled buffers prior to Skylake. But we exposed I915_FORMAT_MOD_Y_TILED even when querying for a list of modifiers with PIPE_BIND_SCANOUT set, which we can't support. That led to crashes later when we tried to create such an image, and isl rightly denied it. Fixes crashes in wflinfo sincec03e79d783, but the bug exists before that and it's probably worth a stable backport even without that patch. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4815 Fixes:c03e79d783("loader/dri: hook up createImageWithModifiers2") Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10907>
This commit is contained in:
parent
e9e953ff94
commit
dd508b2bed
1 changed files with 12 additions and 6 deletions
|
|
@ -76,13 +76,17 @@ static const uint64_t priority_to_modifier[] = {
|
|||
|
||||
static bool
|
||||
modifier_is_supported(const struct intel_device_info *devinfo,
|
||||
enum pipe_format pfmt, uint64_t modifier)
|
||||
enum pipe_format pfmt, unsigned bind,
|
||||
uint64_t modifier)
|
||||
{
|
||||
/* Check for basic device support. */
|
||||
switch (modifier) {
|
||||
case DRM_FORMAT_MOD_LINEAR:
|
||||
case I915_FORMAT_MOD_X_TILED:
|
||||
break;
|
||||
case I915_FORMAT_MOD_Y_TILED:
|
||||
if (devinfo->ver <= 8 && (bind & PIPE_BIND_SCANOUT))
|
||||
return false;
|
||||
break;
|
||||
case I915_FORMAT_MOD_Y_TILED_CCS:
|
||||
if (devinfo->ver <= 8 || devinfo->ver >= 12)
|
||||
|
|
@ -138,14 +142,16 @@ modifier_is_supported(const struct intel_device_info *devinfo,
|
|||
}
|
||||
|
||||
static uint64_t
|
||||
select_best_modifier(struct intel_device_info *devinfo, enum pipe_format pfmt,
|
||||
select_best_modifier(struct intel_device_info *devinfo,
|
||||
const struct pipe_resource *templ,
|
||||
const uint64_t *modifiers,
|
||||
int count)
|
||||
{
|
||||
enum modifier_priority prio = MODIFIER_PRIORITY_INVALID;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (!modifier_is_supported(devinfo, pfmt, modifiers[i]))
|
||||
if (!modifier_is_supported(devinfo, templ->format, templ->bind,
|
||||
modifiers[i]))
|
||||
continue;
|
||||
|
||||
switch (modifiers[i]) {
|
||||
|
|
@ -213,7 +219,7 @@ iris_query_dmabuf_modifiers(struct pipe_screen *pscreen,
|
|||
int supported_mods = 0;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(all_modifiers); i++) {
|
||||
if (!modifier_is_supported(devinfo, pfmt, all_modifiers[i]))
|
||||
if (!modifier_is_supported(devinfo, pfmt, 0, all_modifiers[i]))
|
||||
continue;
|
||||
|
||||
if (supported_mods < max) {
|
||||
|
|
@ -240,7 +246,7 @@ iris_is_dmabuf_modifier_supported(struct pipe_screen *pscreen,
|
|||
struct iris_screen *screen = (void *) pscreen;
|
||||
const struct intel_device_info *devinfo = &screen->devinfo;
|
||||
|
||||
if (modifier_is_supported(devinfo, pfmt, modifier)) {
|
||||
if (modifier_is_supported(devinfo, pfmt, 0, modifier)) {
|
||||
if (external_only)
|
||||
*external_only = is_modifier_external_only(pfmt, modifier);
|
||||
|
||||
|
|
@ -986,7 +992,7 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen,
|
|||
return NULL;
|
||||
|
||||
uint64_t modifier =
|
||||
select_best_modifier(devinfo, templ->format, modifiers, modifiers_count);
|
||||
select_best_modifier(devinfo, templ, modifiers, modifiers_count);
|
||||
|
||||
if (modifier == DRM_FORMAT_MOD_INVALID && modifiers_count > 0) {
|
||||
fprintf(stderr, "Unsupported modifier, resource creation failed.\n");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue