mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
wl: indicate no pfn when using shmem regions
Indicate when a vfd has no associated pfn when using a shared memory region by sending the pfn offset corresponding to the size of the shared memory region. BUG=b:213532601 TEST=crostini.CopyPaste.wayland_to_x11_buster_stable Change-Id: Ia2cee6a58c91b474e90837c389dd12dea55e54e5 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3789167 Tested-by: David Stevens <stevensd@chromium.org> Reviewed-by: Ryan Neph <ryanneph@google.com> Commit-Queue: David Stevens <stevensd@chromium.org>
This commit is contained in:
parent
7bf0d05bd7
commit
b1dec9172b
2 changed files with 14 additions and 7 deletions
|
@ -238,7 +238,7 @@ impl VhostUserBackend for WlBackend {
|
|||
resource_bridge.take(),
|
||||
#[cfg(feature = "minigbm")]
|
||||
gralloc,
|
||||
0, /* address_offset */
|
||||
None, /* address_offset */
|
||||
)))
|
||||
})
|
||||
.clone();
|
||||
|
|
|
@ -1071,7 +1071,7 @@ pub struct WlState {
|
|||
#[cfg(feature = "gpu")]
|
||||
signaled_fence: Option<SafeDescriptor>,
|
||||
use_send_vfd_v2: bool,
|
||||
address_offset: u64,
|
||||
address_offset: Option<u64>,
|
||||
}
|
||||
|
||||
impl WlState {
|
||||
|
@ -1083,7 +1083,7 @@ impl WlState {
|
|||
use_send_vfd_v2: bool,
|
||||
resource_bridge: Option<Tube>,
|
||||
#[cfg(feature = "minigbm")] gralloc: RutabagaGralloc,
|
||||
address_offset: u64,
|
||||
address_offset: Option<u64>,
|
||||
) -> WlState {
|
||||
WlState {
|
||||
wayland_paths,
|
||||
|
@ -1676,7 +1676,14 @@ impl WlState {
|
|||
}
|
||||
|
||||
fn compute_pfn(&self, offset: &Option<u64>) -> u64 {
|
||||
let addr = offset.map_or(0, |o| o + self.address_offset);
|
||||
let addr = match (offset, self.address_offset) {
|
||||
(Some(o), Some(address_offset)) => o + address_offset,
|
||||
(Some(o), None) => *o,
|
||||
// without shmem, 0 is the special address for "no_pfn"
|
||||
(None, Some(_)) => 0,
|
||||
// with shmem, WL_SHMEM_SIZE is the special address for "no_pfn"
|
||||
(None, None) => WL_SHMEM_SIZE,
|
||||
};
|
||||
addr >> VIRTIO_WL_PFN_SHIFT
|
||||
}
|
||||
}
|
||||
|
@ -1819,7 +1826,7 @@ impl Worker {
|
|||
use_send_vfd_v2: bool,
|
||||
resource_bridge: Option<Tube>,
|
||||
#[cfg(feature = "minigbm")] gralloc: RutabagaGralloc,
|
||||
address_offset: u64,
|
||||
address_offset: Option<u64>,
|
||||
) -> Worker {
|
||||
Worker {
|
||||
interrupt,
|
||||
|
@ -2070,9 +2077,9 @@ impl VirtioDevice for Wl {
|
|||
.take()
|
||||
.expect("gralloc already passed to worker");
|
||||
let address_offset = if !self.use_shmem {
|
||||
self.address_offset.expect("missing address offset")
|
||||
self.address_offset
|
||||
} else {
|
||||
0
|
||||
None
|
||||
};
|
||||
let worker_result =
|
||||
thread::Builder::new()
|
||||
|
|
Loading…
Reference in a new issue