From c9ce2da943a6325014573ea5a508eedf4156d0a8 Mon Sep 17 00:00:00 2001 From: David Riley Date: Tue, 22 May 2018 15:36:31 -0700 Subject: [PATCH] gpu: add force_ctx_0 calls prior to each gpu command BUG=None TEST=build with --features=gpu; null_platform_test Change-Id: Ib7aab8b2f0d7e1523df49360ab99677b59ce6052 Reviewed-on: https://chromium-review.googlesource.com/1073960 Commit-Ready: David Riley Tested-by: David Riley Reviewed-by: Zach Reizner --- devices/src/virtio/gpu/backend.rs | 4 ++++ devices/src/virtio/gpu/mod.rs | 2 ++ gpu_renderer/src/lib.rs | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/devices/src/virtio/gpu/backend.rs b/devices/src/virtio/gpu/backend.rs index 7bf572e881..0a48549e6d 100644 --- a/devices/src/virtio/gpu/backend.rs +++ b/devices/src/virtio/gpu/backend.rs @@ -937,4 +937,8 @@ impl Backend { pub fn fence_poll(&mut self) -> u32 { self.renderer.poll() } + + pub fn force_ctx_0(&mut self) { + self.renderer.force_ctx_0(); + } } diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs index 24b6fe56a9..c4f2272cde 100644 --- a/devices/src/virtio/gpu/mod.rs +++ b/devices/src/virtio/gpu/mod.rs @@ -92,6 +92,8 @@ impl Frontend { cmd: GpuCommand, data: Option) -> GpuResponse { + self.backend.force_ctx_0(); + match cmd { GpuCommand::GetDisplayInfo(_) => { GpuResponse::OkDisplayInfo(self.backend.display_info().to_vec()) diff --git a/gpu_renderer/src/lib.rs b/gpu_renderer/src/lib.rs index 9e687ed97d..09d5949a5c 100644 --- a/gpu_renderer/src/lib.rs +++ b/gpu_renderer/src/lib.rs @@ -594,6 +594,10 @@ impl Renderer { }; ret_to_res(ret) } + + pub fn force_ctx_0(&self) { + unsafe { virgl_renderer_force_ctx_0() }; + } } /// A context in which resources can be attached/detached and commands can be submitted.