virtgpu_crossdomain: Handle buffer special case

Blob formats (aka buffers) get represented as R8 textures with height
of one and width==size.  These actually have no particular stride
requirement, even though the host might ask for a pitch that would make
sense for a 2D R8 texture with height greater than one.

BUG=b:239335026
TEST=cts-tradefed run cts -m CtsNNAPITestCases

Change-Id: I293f03b1c4292ed50252ea272f7d9e47e6c64ee2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3770014
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Rob Clark <robdclark@chromium.org>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
This commit is contained in:
Rob Clark 2022-07-18 14:34:20 -07:00 committed by Chromeos LUCI
parent 0495473b90
commit 8513e1f542

View file

@ -198,6 +198,11 @@ static int cross_domain_metadata_query(struct driver *drv, struct bo_metadata *m
metadata->memory_idx = addr[14];
metadata->physical_device_idx = addr[15];
/* Detect buffers, which have no particular stride alignment requirement: */
if ((metadata->height == 1) && (metadata->format == DRM_FORMAT_R8)) {
metadata->strides[0] = metadata->width;
}
remaining_size = metadata->total_size;
for (plane = 0; plane < metadata->num_planes; plane++) {
if (plane != 0) {