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