Revert "WayVR: Vulkano dmabuf attempt"

This reverts commit 45ab38c310.
This commit is contained in:
galister
2025-04-07 07:34:56 +09:00
parent b830c826a0
commit 4cb12a2a01
3 changed files with 21 additions and 69 deletions

View File

@@ -2,7 +2,6 @@ use std::sync::Arc;
use super::egl_ex; use super::egl_ex;
use anyhow::anyhow; use anyhow::anyhow;
use smithay::backend::egl::ffi::egl::types::EGLBoolean;
#[derive(Debug)] #[derive(Debug)]
pub struct EGLData { pub struct EGLData {
@@ -135,7 +134,7 @@ impl EGLData {
&mut num_formats, &mut num_formats,
); );
// Retrieve format list // Retrieve formt list
let mut formats: Vec<i32> = vec![0; num_formats as usize]; let mut formats: Vec<i32> = vec![0; num_formats as usize];
egl_query_dmabuf_formats_ext( egl_query_dmabuf_formats_ext(
self.display.as_ptr(), self.display.as_ptr(),
@@ -179,24 +178,23 @@ impl EGLData {
} }
let mut mods: Vec<u64> = vec![0; num_mods as usize]; let mut mods: Vec<u64> = vec![0; num_mods as usize];
let mut external: Vec<EGLBoolean> = vec![2; num_mods as usize];
egl_query_dmabuf_modifiers_ext( egl_query_dmabuf_modifiers_ext(
self.display.as_ptr(), self.display.as_ptr(),
target_fourcc, target_fourcc,
num_mods, num_mods,
mods.as_mut_ptr(), mods.as_mut_ptr(),
external.as_mut_ptr(), std::ptr::null_mut(),
&mut num_mods, &mut num_mods,
); );
/*if mods[0] == 0xFFFF_FFFF_FFFF_FFFF { if mods[0] == 0xFFFF_FFFF_FFFF_FFFF {
anyhow::bail!("modifier is -1") anyhow::bail!("modifier is -1")
} }
/*log::error!("Modifier list:"); log::trace!("Modifier list:");
for modifier in &mods { for modifier in &mods {
log::error!("{modifier:#x}"); log::trace!("{modifier:#x}");
}*/ }
// We should not change these modifier values. Passing all of them to the Vulkan dmabuf // We should not change these modifier values. Passing all of them to the Vulkan dmabuf
// texture system causes significant graphical corruption due to invalid memory layout and // texture system causes significant graphical corruption due to invalid memory layout and
@@ -215,19 +213,10 @@ impl EGLData {
mods = vec![*modifier, 0x0 /* also important (???) */]; mods = vec![*modifier, 0x0 /* also important (???) */];
break; break;
} }
}*/ }
let mods_filtered: Vec<u64> = mods
.into_iter()
.zip(external)
.map(|(modifier, external)| {
log::info!("modifier {modifier}, external {external}");
modifier
})
.collect();
Ok(DMAbufModifierInfo { Ok(DMAbufModifierInfo {
modifiers: mods_filtered, modifiers: mods,
fourcc: target_fourcc as u32, fourcc: target_fourcc as u32,
}) })
} }

View File

@@ -537,7 +537,7 @@ impl OverlayRenderer for ScreenRenderer {
}; };
self.capture self.capture
.init(&dmabuf_formats, user_data, receive_callback); .init(dmabuf_formats, user_data, receive_callback);
self.capture.request_new_frame(); self.capture.request_new_frame();
return Ok(ShouldRender::Unable); return Ok(ShouldRender::Unable);
} }

View File

@@ -1,8 +1,11 @@
use glam::{vec3a, Affine2, Vec3, Vec3A}; use glam::{vec3a, Affine2, Vec3, Vec3A};
use std::{cell::RefCell, collections::HashMap, rc::Rc, sync::Arc}; use std::{cell::RefCell, collections::HashMap, rc::Rc, sync::Arc};
use vulkano::{command_buffer::CommandBufferUsage, image::view::ImageView}; use vulkano::{
command_buffer::CommandBufferUsage,
image::{view::ImageView, SubresourceLayout},
};
use wayvr_ipc::packet_server::{self, PacketServer, WvrStateChanged}; use wayvr_ipc::packet_server::{self, PacketServer, WvrStateChanged};
use wlx_capture::frame::{DmabufFrame, FrameFormat, FramePlane}; use wlx_capture::frame::{DmabufFrame, FourCC, FrameFormat, FramePlane};
use crate::{ use crate::{
backend::{ backend::{
@@ -604,66 +607,26 @@ impl WayVRRenderer {
anyhow::bail!("Failed to fetch WayVR display") anyhow::bail!("Failed to fetch WayVR display")
}; };
let drm_formats = &self.graphics.drm_formats;
let mut drm_format = None;
for fmt in drm_formats {
if fmt.fourcc.value == 0x3432_4258
/* XB24 */
{
drm_format = Some(fmt);
log::info!("format fourcc {} mod {:?}", fmt.fourcc.value, fmt.modifiers);
break;
}
}
let Some(drm_format) = drm_format else {
anyhow::bail!("Couldn't find XB24 dmabuf format");
};
let tex = self.graphics.dmabuf_texture(DmabufFrame {
format: FrameFormat {
width: u32::from(disp.width),
height: u32::from(disp.height),
fourcc: drm_format.fourcc,
modifier: drm_format.modifiers[1], /* FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!! */
..Default::default()
},
num_planes: 1,
planes,
})?;
/*let layouts: Vec<SubresourceLayout> = vec![SubresourceLayout {
offset: data.offset as _,
size: 0,
row_pitch: data.stride as _,
array_pitch: None,
depth_pitch: None,
}];
let frame = DmabufFrame { let frame = DmabufFrame {
format: FrameFormat { format: FrameFormat {
width: u32::from(disp.width), width: u32::from(disp.width),
height: u32::from(disp.height), height: u32::from(disp.height),
fourcc: drm_format.fourcc, fourcc: FourCC {
modifier: DRM_FORMAT_MOD_INVALID, /* possibly not proper? */ value: data.mod_info.fourcc,
},
modifier: data.mod_info.modifiers[0], /* possibly not proper? */
..Default::default() ..Default::default()
}, },
num_planes: 1, num_planes: 1,
planes, planes,
}; };
let tex = self.graphics.dmabuf_texture_ex(
frame,
vulkano::image::ImageTiling::DrmFormatModifier,
layouts,
&data.mod_info.modifiers,
)?;*/
drop(wayvr); drop(wayvr);
let tex = self.graphics.dmabuf_texture(frame)?;
self.vk_image = Some(tex.clone()); self.vk_image = Some(tex.clone());
self.vk_image_view = Some(vulkano::image::view::ImageView::new_default(tex)?); self.vk_image_view = Some(vulkano::image::view::ImageView::new_default(tex).unwrap());
Ok(()) Ok(())
} }
} }