amdgpu: treat BO_USE_LINEAR as an HW flag

sommelier makes VIRTWL_IOCTL_NEW_DMABUF requests for 2D apps.  crosvm's
virtio-wl allocates linear BOs in response and expects them to be
presentable.

BUG=b:273797429
TEST=xeyes and gedit in crostini

Change-Id: Id5a955e5c22342ee11e9e333720eb95ac08fd175
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4343374
Tested-by: Chia-I Wu <[email protected]>
Reviewed-by: Yiwei Zhang <[email protected]>
Commit-Queue: Chia-I Wu <[email protected]>
diff --git a/amdgpu.c b/amdgpu.c
index a3f5e45..a0d2cfa 100644
--- a/amdgpu.c
+++ b/amdgpu.c
@@ -525,7 +525,10 @@
 
 	stride = drv_stride_from_format(format, width, 0);
 
-	if (use_flags & BO_USE_HW_MASK) {
+	/* some clients (e.g., virtio-wl) set BO_USE_LINEAR to mean
+	 * BO_USE_SCANOUT or BO_USE_TEXTURE
+	 */
+	if (use_flags & (BO_USE_HW_MASK | BO_USE_LINEAR)) {
 		/* GFX9+ requires the stride to be aligned to 256 bytes */
 		stride_align = 256;
 		stride = ALIGN(stride, stride_align);