summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mader <robert.mader@collabora.com>2022-05-03 09:24:37 +0200
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-04 08:47:25 +0000
commitd73fa7ff377919d94d4ed675cc91a070f0631548 (patch)
tree48060b95821508b45270a07e4dc352037404cc06
parent1d87c8004ccab05e95b9c3f96f71ee1c24304625 (diff)
downloadminigbm-d73fa7ff377919d94d4ed675cc91a070f0631548.tar.gz
minigbm: amdgpu: Update plane count in bo_import
This is required for importing multi-plane modifiers where the format plane count is lower (usually `1`). It will be used by Exo for v3/4 of the `zwp_linux_dmabuf_v1` Wayland potocol, allowing Wayland clients (and thus all clients that build on the Wayland support) to use explicit modifiers which again can increase performance on many GPUs. Also add another fallback path to `dri_num_planes_from_modifier()` for cases when `queryDmaBufFormatModifierAttribs()` fails and do some refactoring there. Without this, some test apparently fail. This includes the amdgpu part of commit 1a733377e91b9e714541ea1f51e1f5808b32897c, partially reverting commit 853b8542fbf5711cca4b00d0e30cd3e559c925fd. Bug:b:224580219 Change-Id: I93b64123420b39f3b83ff1bbbb9c59ddf4bc6105 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3568489 Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org> Tested-by: Robert Mader <robert.mader@collabora.com> Commit-Queue: Robert Mader <robert.mader@collabora.com>
-rw-r--r--amdgpu.c3
-rw-r--r--dri.c21
2 files changed, 13 insertions, 11 deletions
diff --git a/amdgpu.c b/amdgpu.c
index f0053d6..700a8c7 100644
--- a/amdgpu.c
+++ b/amdgpu.c
@@ -625,6 +625,9 @@ static int amdgpu_import_bo(struct bo *bo, struct drv_import_fd_data *data)
dri_tiling = combo->metadata.tiling != TILE_TYPE_LINEAR;
}
+ bo->meta.num_planes = dri_num_planes_from_modifier(bo->drv, data->format,
+ data->format_modifier);
+
if (dri_tiling)
return dri_bo_import(bo, data);
else
diff --git a/dri.c b/dri.c
index ea8c757..7257c31 100644
--- a/dri.c
+++ b/dri.c
@@ -452,19 +452,18 @@ int dri_bo_unmap(struct bo *bo, struct vma *vma)
size_t dri_num_planes_from_modifier(struct driver *drv, uint32_t format, uint64_t modifier)
{
struct dri_driver *dri = drv->priv;
- if (!dri->image_extension->queryDmaBufFormatModifierAttribs) {
- /* We do not do any modifier checks here. The create will fail
- * later if the modifier is not supported. */
- return drv_num_planes_from_format(format);
- }
+ uint64_t planes = 0;
- uint64_t planes;
- unsigned char ret = dri->image_extension->queryDmaBufFormatModifierAttribs(
- dri->device, format, modifier, __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB_PLANE_COUNT, &planes);
- if (!ret)
- return 0;
+ /* We do not do any modifier checks here. The create will fail later if the modifier is not
+ * supported.
+ */
+ if (dri->image_extension->queryDmaBufFormatModifierAttribs &&
+ dri->image_extension->queryDmaBufFormatModifierAttribs(
+ dri->device, format, modifier, __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB_PLANE_COUNT,
+ &planes))
+ return planes;
- return planes;
+ return drv_num_planes_from_format(format);
}
bool dri_query_modifiers(struct driver *drv, uint32_t format, int max, uint64_t *modifiers,