aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuan Song <huans@google.com>2021-05-04 21:03:20 -0700
committerHuan Song <huans@google.com>2021-05-05 12:03:34 -0700
commitcd5a9a9b85b5d6522b31f1f2bfb7451bf23bcd32 (patch)
treecad9670bfe3ecc50216817e5864dcd6527d47fe9
parent38a78326ce3cfe429a8344297abfb162d47e6204 (diff)
downloadcrosvm-cd5a9a9b85b5d6522b31f1f2bfb7451bf23bcd32.tar.gz
Not remove surface when resource_id is 0
This is a workaround to solve the issue of black display Observation is when Surfaceflinger falls back to guest composition, host receives set scanout 0 0, and then set scanout 0 <some valid resid>. The first 0 0 removes the surface, the second creates a new surface with id++, which will be more than 0 and be ignored in vnc or webrtc Test: launch_avd, switch between apps Change-Id: I66516b462201ad2437172c60c8167913071b40a1
-rw-r--r--devices/src/virtio/gpu/virtio_gpu.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/devices/src/virtio/gpu/virtio_gpu.rs b/devices/src/virtio/gpu/virtio_gpu.rs
index e1e29064d..42968d078 100644
--- a/devices/src/virtio/gpu/virtio_gpu.rs
+++ b/devices/src/virtio/gpu/virtio_gpu.rs
@@ -201,14 +201,13 @@ impl VirtioGpu {
scanout_data: Option<VirtioScanoutBlobData>,
) -> VirtioGpuResult {
let mut display = self.display.borrow_mut();
- if resource_id == 0 {
- if let Some(surface_id) = self.scanout_surface_id.take() {
- display.release_surface(surface_id);
- }
- self.scanout_resource_id = None;
- return Ok(OkNoData);
- }
-
+ /// b/186580833.
+ /// Remove the part of deleting surface when resource_id is 0.
+ /// This is a workaround to solve the issue of black display.
+ /// Observation is when Surfaceflinger falls back to client composition,
+ /// host receives set_scanout 0 0, and then set scanout 0 <some valid resid>.
+ /// The first 0 0 removes the surface, the second creates a new surface
+ /// with id++, which will be more than 0 and be ignorned in vnc or webrtc
let resource = self
.resources
.get_mut(&resource_id)