screenshots: don't force linear modifier
This commit is contained in:
parent
940aecab96
commit
e11548fd8a
3 changed files with 16 additions and 19 deletions
|
|
@ -161,10 +161,6 @@ pub fn buf_to_bytes(
|
||||||
buf: &DmaBuf,
|
buf: &DmaBuf,
|
||||||
format: ScreenshotFormat,
|
format: ScreenshotFormat,
|
||||||
) -> Result<Vec<u8>, ScreenshotError> {
|
) -> Result<Vec<u8>, ScreenshotError> {
|
||||||
match drm_dev {
|
|
||||||
None => {}
|
|
||||||
Some(_) => {}
|
|
||||||
}
|
|
||||||
let mut allocators =
|
let mut allocators =
|
||||||
Vec::<Box<dyn FnOnce() -> Result<Rc<dyn Allocator>, ScreenshotError>>>::new();
|
Vec::<Box<dyn FnOnce() -> Result<Rc<dyn Allocator>, ScreenshotError>>>::new();
|
||||||
match drm_dev {
|
match drm_dev {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
allocator::{AllocatorError, BufferObject, BO_USE_LINEAR, BO_USE_RENDERING},
|
allocator::{AllocatorError, BufferObject, BO_USE_RENDERING},
|
||||||
format::XRGB8888,
|
format::XRGB8888,
|
||||||
gfx_api::GfxError,
|
gfx_api::GfxError,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
state::State,
|
state::State,
|
||||||
video::{drm::DrmError, INVALID_MODIFIER, LINEAR_MODIFIER},
|
video::drm::DrmError,
|
||||||
},
|
},
|
||||||
jay_config::video::Transform,
|
jay_config::video::Transform,
|
||||||
std::{ops::Deref, rc::Rc},
|
std::{ops::Deref, rc::Rc},
|
||||||
|
|
@ -27,8 +27,8 @@ pub enum ScreenshooterError {
|
||||||
DrmError(#[from] DrmError),
|
DrmError(#[from] DrmError),
|
||||||
#[error("Render context does not support XRGB8888")]
|
#[error("Render context does not support XRGB8888")]
|
||||||
XRGB8888,
|
XRGB8888,
|
||||||
#[error("Render context supports neither linear nor invalid modifier for XRGB8888 rendering")]
|
#[error("Render context supports no modifiers for XRGB8888 rendering")]
|
||||||
Linear,
|
Modifiers,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Screenshot {
|
pub struct Screenshot {
|
||||||
|
|
@ -49,24 +49,25 @@ pub fn take_screenshot(
|
||||||
return Err(ScreenshooterError::EmptyDisplay);
|
return Err(ScreenshooterError::EmptyDisplay);
|
||||||
}
|
}
|
||||||
let formats = ctx.formats();
|
let formats = ctx.formats();
|
||||||
let mut usage = BO_USE_RENDERING;
|
let modifiers: Vec<_> = match formats.get(&XRGB8888.drm) {
|
||||||
let modifiers = match formats.get(&XRGB8888.drm) {
|
|
||||||
None => return Err(ScreenshooterError::XRGB8888),
|
None => return Err(ScreenshooterError::XRGB8888),
|
||||||
Some(f) if f.write_modifiers.contains(&LINEAR_MODIFIER) => &[LINEAR_MODIFIER],
|
Some(f) => f
|
||||||
Some(f) if f.write_modifiers.contains(&INVALID_MODIFIER) => {
|
.write_modifiers
|
||||||
usage |= BO_USE_LINEAR;
|
.intersection(&f.read_modifiers)
|
||||||
&[INVALID_MODIFIER]
|
.copied()
|
||||||
}
|
.collect(),
|
||||||
Some(_) => return Err(ScreenshooterError::Linear),
|
|
||||||
};
|
};
|
||||||
|
if modifiers.is_empty() {
|
||||||
|
return Err(ScreenshooterError::Modifiers);
|
||||||
|
}
|
||||||
let allocator = ctx.allocator();
|
let allocator = ctx.allocator();
|
||||||
let bo = allocator.create_bo(
|
let bo = allocator.create_bo(
|
||||||
&state.dma_buf_ids,
|
&state.dma_buf_ids,
|
||||||
extents.width(),
|
extents.width(),
|
||||||
extents.height(),
|
extents.height(),
|
||||||
XRGB8888,
|
XRGB8888,
|
||||||
modifiers,
|
&modifiers,
|
||||||
usage,
|
BO_USE_RENDERING,
|
||||||
)?;
|
)?;
|
||||||
let fb = ctx.clone().dmabuf_fb(bo.dmabuf())?;
|
let fb = ctx.clone().dmabuf_fb(bo.dmabuf())?;
|
||||||
fb.render_node(
|
fb.render_node(
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ impl ToolClient {
|
||||||
self_id: s.registry,
|
self_id: s.registry,
|
||||||
name: s.jay_compositor.0,
|
name: s.jay_compositor.0,
|
||||||
interface: JayCompositor.name(),
|
interface: JayCompositor.name(),
|
||||||
version: s.jay_compositor.1.min(4),
|
version: s.jay_compositor.1.min(6),
|
||||||
id: id.into(),
|
id: id.into(),
|
||||||
});
|
});
|
||||||
self.jay_compositor.set(Some(id));
|
self.jay_compositor.set(Some(id));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue