mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
zink: Revert "zink: enable single-plane modifiers for generic 2D exports"
This reverts commitdf1ff3c711. When clients allocate BOs via GBM's gbm_bo_create(), they expect those BOs to work with KMS without modifiers. Assigning them a modifier and hoping that they then query that modifier even though they used the legacy API to create the BO is pretty mean. In particular, this breaks KWin which doesn't use modifiers if the KMS device doesn't support atomic. Fixes:df1ff3c711("zink: enable single-plane modifiers for generic 2D exports") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33887>
This commit is contained in:
parent
bcff33ff93
commit
78a80b9bf1
1 changed files with 5 additions and 16 deletions
|
|
@ -1727,27 +1727,16 @@ add_resource_bind(struct zink_context *ctx, struct zink_resource *res, unsigned
|
|||
assert((res->base.b.bind & bind) == 0);
|
||||
res->base.b.bind |= bind;
|
||||
struct zink_resource_object *old_obj = res->obj;
|
||||
ASSERTED uint64_t check_mod = false;
|
||||
ASSERTED uint64_t mod = DRM_FORMAT_MOD_INVALID;
|
||||
if (bind & ZINK_BIND_DMABUF && !res->modifiers_count && !res->obj->is_buffer && screen->info.have_EXT_image_drm_format_modifier) {
|
||||
/* it's improbable that drivers support non-linear modifiers for anything but 2D */
|
||||
bool use_modifiers = res->base.b.target == PIPE_TEXTURE_2D;
|
||||
res->modifiers_count = use_modifiers ? screen->modifier_props[res->base.b.format].drmFormatModifierCount : 1;
|
||||
res->modifiers_count = 1;
|
||||
res->modifiers = malloc(res->modifiers_count * sizeof(uint64_t));
|
||||
if (!res->modifiers) {
|
||||
mesa_loge("ZINK: failed to allocate res->modifiers!");
|
||||
return false;
|
||||
}
|
||||
if (use_modifiers) {
|
||||
int idx = 0;
|
||||
for (unsigned i = 0; i < screen->modifier_props[res->base.b.format].drmFormatModifierCount; i++) {
|
||||
if (screen->modifier_props[res->base.b.format].pDrmFormatModifierProperties[i].drmFormatModifierPlaneCount == 1)
|
||||
res->modifiers[idx++] = screen->modifier_props[res->base.b.format].pDrmFormatModifierProperties[i].drmFormatModifier;
|
||||
}
|
||||
res->modifiers_count = idx;
|
||||
} else {
|
||||
res->modifiers[0] = DRM_FORMAT_MOD_LINEAR;
|
||||
}
|
||||
check_mod = true;
|
||||
|
||||
mod = res->modifiers[0] = DRM_FORMAT_MOD_LINEAR;
|
||||
}
|
||||
struct zink_resource_object *new_obj = resource_object_create(screen, &res->base.b, NULL, &res->linear, res->modifiers, res->modifiers_count, NULL, NULL);
|
||||
if (!new_obj) {
|
||||
|
|
@ -1755,7 +1744,7 @@ add_resource_bind(struct zink_context *ctx, struct zink_resource *res, unsigned
|
|||
res->base.b.bind &= ~bind;
|
||||
return false;
|
||||
}
|
||||
assert(!check_mod || new_obj->modifier != DRM_FORMAT_MOD_INVALID);
|
||||
assert(mod == DRM_FORMAT_MOD_INVALID || new_obj->modifier == DRM_FORMAT_MOD_LINEAR);
|
||||
struct zink_resource staging = *res;
|
||||
staging.obj = old_obj;
|
||||
staging.all_binds = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue