allocator: don't require render usage for bridged buffers
This commit is contained in:
parent
1bacaa7b02
commit
bf65da4c76
15 changed files with 152 additions and 54 deletions
|
|
@ -323,7 +323,7 @@ fn finish_display_connect(dpy: Rc<PortalDisplayPrelude>) {
|
|||
con: dpy.con.clone(),
|
||||
owner: Default::default(),
|
||||
caps: Default::default(),
|
||||
version: Version(version.min(7)),
|
||||
version: Version(version.min(9)),
|
||||
});
|
||||
dpy.con.add_object(jc.clone());
|
||||
dpy.registry.request_bind(name, jc.version.0, jc.deref());
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ mod screencast_gui;
|
|||
|
||||
use {
|
||||
crate::{
|
||||
allocator::{AllocatorError, BufferObject, BO_USE_RENDERING},
|
||||
allocator::{AllocatorError, BufferObject, BufferUsage, BO_USE_RENDERING},
|
||||
dbus::{prelude::Variant, DbusObject, DictEntry, DynamicType, PendingReply},
|
||||
format::{Format, XRGB8888},
|
||||
ifs::jay_screencast::CLIENT_BUFFERS_SINCE,
|
||||
|
|
@ -204,7 +204,7 @@ impl PwClientNodeOwner for StartingScreencast {
|
|||
}
|
||||
let ptl_format = PwClientNodePortSupportedFormat {
|
||||
format: format.format,
|
||||
modifiers: format.write_modifiers.iter().copied().collect(),
|
||||
modifiers: format.write_modifiers.keys().copied().collect(),
|
||||
};
|
||||
supported_formats.formats.push(ptl_format);
|
||||
}
|
||||
|
|
@ -380,13 +380,28 @@ impl StartedScreencast {
|
|||
let Some(ctx) = self.dpy.render_ctx.get() else {
|
||||
return Err(BufferAllocationError::NoRenderContext);
|
||||
};
|
||||
let mut usage = BO_USE_RENDERING;
|
||||
if let Some(sf) = &ctx.server_formats {
|
||||
if let Some(format) = sf.get(&format.drm) {
|
||||
let no_render_usage = modifiers.iter().all(|m| {
|
||||
format
|
||||
.write_modifiers
|
||||
.get(m)
|
||||
.map(|w| !w.needs_render_usage)
|
||||
.unwrap_or(false)
|
||||
});
|
||||
if no_render_usage {
|
||||
usage = BufferUsage::none();
|
||||
}
|
||||
}
|
||||
}
|
||||
let buffer = ctx.ctx.ctx.allocator().create_bo(
|
||||
&self.dpy.state.dma_buf_ids,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
modifiers,
|
||||
BO_USE_RENDERING,
|
||||
usage,
|
||||
)?;
|
||||
Ok(buffer)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use {
|
||||
crate::{
|
||||
allocator::{BufferObject, BO_USE_RENDERING},
|
||||
allocator::{BufferObject, BufferUsage, BO_USE_RENDERING},
|
||||
async_engine::{Phase, SpawnedFuture},
|
||||
cursor::KnownCursor,
|
||||
fixed::Fixed,
|
||||
format::ARGB8888,
|
||||
gfx_api::{AcquireSync, GfxContext, GfxFramebuffer, ReleaseSync},
|
||||
gfx_api::{needs_render_usage, AcquireSync, GfxContext, GfxFramebuffer, ReleaseSync},
|
||||
ifs::zwlr_layer_shell_v1::OVERLAY,
|
||||
portal::ptl_display::{PortalDisplay, PortalOutput, PortalSeat},
|
||||
renderer::renderer_base::RendererBase,
|
||||
|
|
@ -723,7 +723,11 @@ impl WindowData {
|
|||
log::error!("Render context cannot render to ARGB8888 format");
|
||||
return;
|
||||
}
|
||||
let modifiers: Vec<_> = format.write_modifiers.iter().copied().collect();
|
||||
let modifiers: Vec<_> = format.write_modifiers.keys().copied().collect();
|
||||
let mut usage = BO_USE_RENDERING;
|
||||
if !needs_render_usage(format.write_modifiers.values()) {
|
||||
usage = BufferUsage::none();
|
||||
}
|
||||
for _ in 0..NUM_BUFFERS {
|
||||
let bo = match ctx.ctx.ctx.allocator().create_bo(
|
||||
&self.dpy.state.dma_buf_ids,
|
||||
|
|
@ -731,7 +735,7 @@ impl WindowData {
|
|||
height,
|
||||
ARGB8888,
|
||||
&modifiers,
|
||||
BO_USE_RENDERING,
|
||||
usage,
|
||||
) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue