mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-18 23:48:22 +02: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> (cherry picked from commitdd508b2bed)
This commit is contained in:
parent
bbb42ffc58
commit
71e14df4f9
2 changed files with 13 additions and 7 deletions
|
|
@ -1057,7 +1057,7 @@
|
|||
"description": "iris: Don't advertise Y-tiled modifiers for scanout buffers on Gfx8",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "c03e79d7831f253b16d6f52f2fb959eb02257a8b"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -75,13 +75,17 @@ static const uint64_t priority_to_modifier[] = {
|
|||
|
||||
static bool
|
||||
modifier_is_supported(const struct gen_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)
|
||||
|
|
@ -137,14 +141,16 @@ modifier_is_supported(const struct gen_device_info *devinfo,
|
|||
}
|
||||
|
||||
static uint64_t
|
||||
select_best_modifier(struct gen_device_info *devinfo, enum pipe_format pfmt,
|
||||
select_best_modifier(struct gen_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]) {
|
||||
|
|
@ -234,7 +240,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) {
|
||||
|
|
@ -261,7 +267,7 @@ iris_is_dmabuf_modifier_supported(struct pipe_screen *pscreen,
|
|||
struct iris_screen *screen = (void *) pscreen;
|
||||
const struct gen_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);
|
||||
|
||||
|
|
@ -945,7 +951,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