From 28f80bd47a4ae87dac7c6bdf6842be7afd8023ae Mon Sep 17 00:00:00 2001 From: Fei Jiang Date: Mon, 29 Jan 2024 19:26:05 +0800 Subject: [PATCH] fix bo create failure when run with prelim kernel It seems prelim kernel doesn't support set_tiling/get_tiling ioctl Some devices virtio has VIRTIO_GPU_F_MODIFIER feature, but some devices have not. If device virtio has not VIRTIO_GPU_F_MODIFIER, android display black screen with qemu + SRIOV. So far, we have not found out why device id of the two ADL device are both 0x46A6, one has VIRTIO_GPU_F_MODIFIER feature, the other one has not. For now, we use LINEAR as WA for the above devices with same device id. Tracked-On: OAM-115771 Signed-off-by: Fei Jiang --- i915.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/i915.c b/i915.c index c5b0f327..d3bfbe80 100644 --- a/i915.c +++ b/i915.c @@ -181,6 +181,16 @@ bool i915_has_tile4(struct driver *drv) return i915->genx10 >= 125; } +bool i915_should_use_linear(struct i915_device *i915) +{ + switch (i915->device_id) { + case 0x46A6: + return true; + default: + return false; + } +} + static uint64_t unset_flags(uint64_t current_flags, uint64_t mask) { uint64_t value = current_flags & ~mask; @@ -282,6 +292,19 @@ static int i915_add_combinations(struct driver *drv) render = unset_flags(render, linear_mask | camera_mask); scanout_and_render = unset_flags(scanout_and_render, linear_mask |camera_mask); + /* TODO(OAM-115771): + * Some devices virtio has VIRTIO_GPU_F_MODIFIER feature, + * but some devices have not. If device virtio has not + * VIRTIO_GPU_F_MODIFIER, android display black screen with + * qemu + SRIOV. So far, we have not found out why device + * id of the two ADL device are both 0x46A6, one has + * VIRTIO_GPU_F_MODIFIER feature, the other one has not. + * + * For now, we use LINEAR as WA for the above devices with + * same device id.. */ + if (is_kvm && i915_should_use_linear(i915)) { + scanout_and_render = unset_flags(scanout_and_render, BO_USE_SCANOUT); + } /* On dGPU, only use linear */ if (i915->genx10 >= 125)