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>
This commit is contained in:
David Riley 2019-04-15 19:11:55 -07:00 committed by chrome-bot
parent 800cc56418
commit fd8cad3fd2

View file

@ -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;
}
}
}
};