fix: feedback lacking formats

This commit is contained in:
Nova
2025-07-14 15:58:25 -07:00
parent 7fab72f903
commit 12a3dc26af
2 changed files with 24 additions and 22 deletions

6
Cargo.lock generated
View File

@@ -592,7 +592,7 @@ dependencies = [
[[package]]
name = "bevy-dmabuf"
version = "0.2.0"
source = "git+https://github.com/Schmarni-Dev/bevy-dmabuf#10a071f69300f283a1445666a7f537b8d5f9c7bf"
source = "git+https://github.com/Schmarni-Dev/bevy-dmabuf#8c9e3af6fecc62db684130674d48c64ba4adfe1d"
dependencies = [
"ash",
"bevy",
@@ -4030,7 +4030,7 @@ version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d"
dependencies = [
"proc-macro-crate 3.3.0",
"proc-macro-crate 1.3.1",
"proc-macro2",
"quote",
"syn 2.0.104",
@@ -6717,7 +6717,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.48.0",
]
[[package]]

View File

@@ -1,4 +1,7 @@
use bevy_dmabuf::format_mapping::{drm_fourcc_to_vk_format, vk_format_to_drm_fourcc};
use bevy_dmabuf::{
format_mapping::{drm_fourcc_to_vk_format, vk_format_to_drm_fourcc},
wgpu_init::vulkan_to_wgpu,
};
use drm_fourcc::DrmFourcc;
use memfd::MemfdOptions;
use std::{
@@ -27,6 +30,7 @@ impl DmabufFeedback {
.filter(|f| {
vk_format_to_drm_fourcc((**f).into())
.and_then(drm_fourcc_to_vk_format)
.and_then(vulkan_to_wgpu)
.is_some()
})
.filter_map(|f| {
@@ -48,27 +52,25 @@ impl DmabufFeedback {
// Send format table first
self.send_format_table(client, sender_id, formats).await?;
// let graphics_info = &client.display().graphics_info;
// Get the device information from Vulkan properties
let props = vk.phys_dev.properties();
// Get the DRM device file path using the new method
// let device_file = graphics_info.get_drm_device_file_path()?;
// Create dev_t from the primary node major/minor numbers
let primary_dev_id = {
let major = props.primary_major.unwrap() as u64;
let minor = props.primary_minor.unwrap() as u64;
// On Linux, dev_t is created with makedev(major, minor)
// which is ((major & 0xfffff000) << 32) | ((major & 0xfff) << 8) | (minor & 0xff)
((major & 0xfffff000) << 32) | ((major & 0xfff) << 8) | (minor & 0xff)
};
let dev_id = primary_dev_id.to_ne_bytes().to_vec();
// let dev_stat = std::fs::metadata(device_file)?;
// let dev_id = dev_stat.rdev().to_ne_bytes().to_vec();
// Send main device
self.main_device(client, sender_id, dev_id.clone()).await?;
// self.main_device(client, sender_id, dev_id.clone()).await?;
// Send single tranche with same device since we only support the main GPU
// self.tranche_target_device(client, sender_id, dev_id)
// .await?;
// let props = vk.phys_dev.properties();
// tracing::info!(
// props.primary_major,
// props.primary_minor,
// props.render_major,
// props.render_minor
// );
// Send tranche with same device since we only support the main GPU
self.tranche_target_device(client, sender_id, dev_id)
.await?;
// We only have one format at index 0
let indices = (0..num_formats).flat_map(|i| i.to_ne_bytes()).collect();