mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
devices: gpu: gfxstream: use MemSlot
Not strictly necessary to build gfxstream, but the MemSlot abstraction was recently introduced and it makes sense to use it everywhere. BUG=b/153580313 TEST=gfxstream builds Change-Id: I06c2ca15edd39c553eacf1256dd95c2fc72f67dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2349394 Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Jason Macnak <natsu@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
02a17bb588
commit
3035dd87df
1 changed files with 9 additions and 9 deletions
|
@ -25,7 +25,7 @@ use gpu_renderer::RendererFlags;
|
|||
use msg_socket::{MsgReceiver, MsgSender};
|
||||
use resources::Alloc;
|
||||
use sync::Mutex;
|
||||
use vm_control::{VmMemoryControlRequestSocket, VmMemoryRequest, VmMemoryResponse};
|
||||
use vm_control::{MemSlot, VmMemoryControlRequestSocket, VmMemoryRequest, VmMemoryResponse};
|
||||
use vm_memory::{GuestAddress, GuestMemory};
|
||||
|
||||
use super::protocol::GpuResponse;
|
||||
|
@ -247,7 +247,7 @@ const GFXSTREAM_RENDERER_CALLBACKS: &GfxStreamRendererCallbacks = &GfxStreamRend
|
|||
|
||||
struct VirtioGfxStreamResource {
|
||||
guest_memory_backing: Option<Vec<iovec>>,
|
||||
kvm_slot: Option<u32>,
|
||||
slot: Option<MemSlot>,
|
||||
}
|
||||
|
||||
pub struct VirtioGfxStreamBackend {
|
||||
|
@ -685,7 +685,7 @@ impl Backend for VirtioGfxStreamBackend {
|
|||
Entry::Vacant(entry) => {
|
||||
entry.insert(VirtioGfxStreamResource {
|
||||
guest_memory_backing: None, /* no guest memory attached yet */
|
||||
kvm_slot: None,
|
||||
slot: None,
|
||||
});
|
||||
}
|
||||
Entry::Occupied(_) => {
|
||||
|
@ -826,7 +826,7 @@ impl Backend for VirtioGfxStreamBackend {
|
|||
Entry::Vacant(entry) => {
|
||||
entry.insert(VirtioGfxStreamResource {
|
||||
guest_memory_backing: None, /* no guest memory attached yet */
|
||||
kvm_slot: None,
|
||||
slot: None,
|
||||
});
|
||||
}
|
||||
Entry::Occupied(_) => {
|
||||
|
@ -881,7 +881,7 @@ impl Backend for VirtioGfxStreamBackend {
|
|||
match response {
|
||||
VmMemoryResponse::RegisterMemory { pfn: _, slot } => {
|
||||
// 0x02 for uncached type in map info
|
||||
resource.kvm_slot = Some(slot);
|
||||
resource.slot = Some(slot);
|
||||
GpuResponse::OkMapInfo { map_info: 0x02 }
|
||||
}
|
||||
VmMemoryResponse::Err(e) => {
|
||||
|
@ -901,12 +901,12 @@ impl Backend for VirtioGfxStreamBackend {
|
|||
None => return GpuResponse::ErrInvalidResourceId,
|
||||
};
|
||||
|
||||
let kvm_slot = match resource.kvm_slot {
|
||||
Some(kvm_slot) => kvm_slot,
|
||||
let slot = match resource.slot {
|
||||
Some(slot) => slot,
|
||||
None => return GpuResponse::ErrUnspec,
|
||||
};
|
||||
|
||||
let request = VmMemoryRequest::UnregisterMemory(kvm_slot);
|
||||
let request = VmMemoryRequest::UnregisterMemory(slot);
|
||||
match self.gpu_device_socket.send(&request) {
|
||||
Ok(_) => (),
|
||||
Err(e) => {
|
||||
|
@ -925,7 +925,7 @@ impl Backend for VirtioGfxStreamBackend {
|
|||
|
||||
match response {
|
||||
VmMemoryResponse::Ok => {
|
||||
resource.kvm_slot = None;
|
||||
resource.slot = None;
|
||||
GpuResponse::OkNoData
|
||||
}
|
||||
VmMemoryResponse::Err(e) => {
|
||||
|
|
Loading…
Reference in a new issue