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

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();