summary refs log tree commit diff
path: root/devices/src/virtio/gpu
diff options
context:
space:
mode:
authorDavid Riley <davidriley@chromium.org>2019-04-15 19:11:55 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-17 17:22:59 -0700
commitfd8cad3fd2ddcc07163586a0aff13b81dc9f4999 (patch)
tree33b5b7f7bcaa76583c90c046d926b43e13538557 /devices/src/virtio/gpu
parent800cc56418ec102b45e66ace1829a677837a4dc1 (diff)
downloadcrosvm-fd8cad3fd2ddcc07163586a0aff13b81dc9f4999.tar
crosvm-fd8cad3fd2ddcc07163586a0aff13b81dc9f4999.tar.gz
crosvm-fd8cad3fd2ddcc07163586a0aff13b81dc9f4999.tar.bz2
crosvm-fd8cad3fd2ddcc07163586a0aff13b81dc9f4999.tar.lz
crosvm-fd8cad3fd2ddcc07163586a0aff13b81dc9f4999.tar.xz
crosvm-fd8cad3fd2ddcc07163586a0aff13b81dc9f4999.tar.zst
crosvm-fd8cad3fd2ddcc07163586a0aff13b81dc9f4999.zip
devices: gpu: Fallback to using non-scanout buffer if minigbm allocation fails.
Only allocate using minigbm if scanout bind is request (which can
indicate that the buffer is to be shared until a proper virgl bind flag
for shared is available), but if that fails because the format is not
supported for scanout, retry the minigbm allocation with the scanout
flag.

BUG=chromium:945033
TEST=None

Change-Id: Ib99bf01c8b9c2a98b1c0d1a8592d5f7c6e1aa859
Reviewed-on: https://chromium-review.googlesource.com/1569025
Commit-Ready: David Riley <davidriley@chromium.org>
Tested-by: David Riley <davidriley@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'devices/src/virtio/gpu')
-rw-r--r--devices/src/virtio/gpu/backend.rs21
1 files changed, 16 insertions, 5 deletions
diff --git a/devices/src/virtio/gpu/backend.rs b/devices/src/virtio/gpu/backend.rs
index 690c94d..0359dd3 100644
--- a/devices/src/virtio/gpu/backend.rs
+++ b/devices/src/virtio/gpu/backend.rs
@@ -770,11 +770,22 @@ impl Backend {
                             ) {
                                 Ok(buffer) => buffer,
                                 Err(e) => {
-                                    error!(
-                                        "failed to create buffer for 3d resource {}: {}",
-                                        format, e
-                                    );
-                                    return GpuResponse::ErrUnspec;
+                                    // Attempt to allocate the buffer without scanout flag.
+                                    match self.device.create_buffer(
+                                        width,
+                                        height,
+                                        Format::from(fourcc),
+                                        Flags::empty().use_rendering(true),
+                                    ) {
+                                        Ok(buffer) => buffer,
+                                        Err(e) => {
+                                            error!(
+                                                "failed to create buffer for 3d resource {}: {}",
+                                                format, e
+                                            );
+                                            return GpuResponse::ErrUnspec;
+                                        }
+                                    }
                                 }
                             };