copy_device: add new utility
This commit is contained in:
parent
f2a0221c9e
commit
fa897f0f76
9 changed files with 2068 additions and 10 deletions
|
|
@ -14,6 +14,7 @@ use {
|
|||
clientmem::{self, ClientMemError},
|
||||
cmm::{cmm_manager::ColorManager, cmm_primaries::Primaries},
|
||||
config::ConfigProxy,
|
||||
copy_device::CopyDeviceRegistry,
|
||||
cpu_worker::{CpuWorker, CpuWorkerError},
|
||||
criteria::{
|
||||
CritMatcherIds,
|
||||
|
|
@ -363,6 +364,7 @@ fn start_compositor2(
|
|||
outputs_without_hc: Default::default(),
|
||||
udmabuf: Default::default(),
|
||||
gfx_ctx_changed: Default::default(),
|
||||
copy_device_registry: Rc::new(CopyDeviceRegistry::new(&ring, &engine)),
|
||||
});
|
||||
state.tracker.register(ClientId::from_raw(0));
|
||||
create_dummy_output(&state);
|
||||
|
|
|
|||
2048
src/copy_device.rs
Normal file
2048
src/copy_device.rs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -221,7 +221,7 @@ pub struct CopyTexture {
|
|||
pub cd: Rc<ColorDescription>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct SyncFile(pub Rc<OwnedFd>);
|
||||
|
||||
impl Deref for SyncFile {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ use {
|
|||
drm::{Drm, sync_obj::SyncObjCtx},
|
||||
gbm::{GBM_BO_USE_RENDERING, GbmDevice},
|
||||
},
|
||||
vulkan_core::{API_VERSION, ApiVersionDisplay, Extensions, map_extension_properties},
|
||||
vulkan_core::{
|
||||
ApiVersionDisplay, Extensions, VULKAN_API_VERSION, map_extension_properties,
|
||||
},
|
||||
},
|
||||
ahash::AHashMap,
|
||||
arrayvec::ArrayVec,
|
||||
|
|
@ -145,7 +147,7 @@ impl VulkanInstance {
|
|||
let mut devices = vec![];
|
||||
for phy_dev in phy_devs {
|
||||
let props = unsafe { self.instance.get_physical_device_properties(phy_dev) };
|
||||
if props.api_version < API_VERSION {
|
||||
if props.api_version < VULKAN_API_VERSION {
|
||||
devices.push((props, None, None));
|
||||
continue;
|
||||
}
|
||||
|
|
@ -218,7 +220,7 @@ impl VulkanInstance {
|
|||
};
|
||||
for phy_dev in phy_devs {
|
||||
let props = unsafe { self.instance.get_physical_device_properties(phy_dev) };
|
||||
if props.api_version < API_VERSION {
|
||||
if props.api_version < VULKAN_API_VERSION {
|
||||
continue;
|
||||
}
|
||||
if props.device_type == PhysicalDeviceType::CPU {
|
||||
|
|
@ -618,7 +620,7 @@ fn log_device(
|
|||
Ustr::from_ptr(props.device_name.as_ptr()).display()
|
||||
);
|
||||
}
|
||||
if props.api_version < API_VERSION {
|
||||
if props.api_version < VULKAN_API_VERSION {
|
||||
log::warn!(" device does not support vulkan 1.3");
|
||||
}
|
||||
if let Some(extensions) = extensions {
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ mod clientmem;
|
|||
mod cmm;
|
||||
mod compositor;
|
||||
mod config;
|
||||
mod copy_device;
|
||||
mod cpu_worker;
|
||||
mod criteria;
|
||||
mod cursor;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use {
|
|||
cmm::{cmm_description::ColorDescription, cmm_manager::ColorManager},
|
||||
compositor::LIBEI_SOCKET,
|
||||
config::ConfigProxy,
|
||||
copy_device::CopyDeviceRegistry,
|
||||
cpu_worker::CpuWorker,
|
||||
criteria::{clm::ClMatcherManager, tlm::TlMatcherManager},
|
||||
cursor::{Cursor, ServerCursors},
|
||||
|
|
@ -292,6 +293,8 @@ pub struct State {
|
|||
pub outputs_without_hc: NumCell<usize>,
|
||||
pub udmabuf: Rc<UdmabufHolder>,
|
||||
pub gfx_ctx_changed: EventSource<WlBuffer>,
|
||||
#[expect(dead_code)]
|
||||
pub copy_device_registry: Rc<CopyDeviceRegistry>,
|
||||
}
|
||||
|
||||
// impl Drop for State {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use {
|
|||
oserror::OsError, page_size::page_size,
|
||||
},
|
||||
video::{
|
||||
LINEAR_MODIFIER, Modifier,
|
||||
LINEAR_MODIFIER, LINEAR_STRIDE_ALIGN, Modifier,
|
||||
dmabuf::{DmaBuf, DmaBufIds, DmaBufPlane, PlaneVec},
|
||||
drm::Drm,
|
||||
},
|
||||
|
|
@ -139,8 +139,7 @@ impl Allocator for Udmabuf {
|
|||
if height > 1 << 16 || width > 1 << 16 {
|
||||
return Err(UdmabufError::Overflow.into());
|
||||
}
|
||||
let stride_mask = 255;
|
||||
let stride = (width * format.bpp as u64 + stride_mask) & !stride_mask;
|
||||
let stride = (width * format.bpp as u64).next_multiple_of(LINEAR_STRIDE_ALIGN);
|
||||
let size_mask = page_size() as u64 - 1;
|
||||
let size = (height * stride + size_mask) & !size_mask;
|
||||
let memfd = match uapi::memfd_create("udmabuf", MFD_ALLOW_SEALING) {
|
||||
|
|
|
|||
|
|
@ -6,3 +6,6 @@ pub type Modifier = u64;
|
|||
|
||||
pub const INVALID_MODIFIER: Modifier = 0x00ff_ffff_ffff_ffff;
|
||||
pub const LINEAR_MODIFIER: Modifier = 0;
|
||||
|
||||
// This is required by AMD and therefore everyone else uses this too.
|
||||
pub const LINEAR_STRIDE_ALIGN: u64 = 256;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ impl VulkanCoreInstance {
|
|||
.map(|c| c.as_ptr())
|
||||
.collect();
|
||||
let app_info = ApplicationInfo::default()
|
||||
.api_version(API_VERSION)
|
||||
.api_version(VULKAN_API_VERSION)
|
||||
.application_name(c"jay")
|
||||
.application_version(1);
|
||||
let mut severity = DebugUtilsMessageSeverityFlagsEXT::empty()
|
||||
|
|
@ -240,4 +240,4 @@ impl Display for ApiVersionDisplay {
|
|||
}
|
||||
}
|
||||
|
||||
pub const API_VERSION: u32 = API_VERSION_1_3;
|
||||
pub const VULKAN_API_VERSION: u32 = API_VERSION_1_3;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue