Run cargo +nightly fmt --all
This commit is contained in:
parent
ddc4c1267f
commit
0ebbbe9587
225 changed files with 758 additions and 769 deletions
|
|
@ -2,8 +2,8 @@ use std::{io::Read, time::Duration};
|
|||
|
||||
use tracing::warn;
|
||||
use xcursor::{
|
||||
parser::{parse_xcursor, Image},
|
||||
CursorTheme,
|
||||
parser::{Image, parse_xcursor},
|
||||
};
|
||||
|
||||
static FALLBACK_CURSOR_DATA: &[u8] = include_bytes!("../resources/cursor.rgba");
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
use smithay::{
|
||||
backend::renderer::{
|
||||
Color32F, ImportAll, ImportMem, Renderer, Texture,
|
||||
element::{
|
||||
AsRenderElements, Kind,
|
||||
memory::{MemoryRenderBuffer, MemoryRenderBufferRenderElement},
|
||||
surface::WaylandSurfaceRenderElement,
|
||||
AsRenderElements, Kind,
|
||||
},
|
||||
Color32F, ImportAll, ImportMem, Renderer, Texture,
|
||||
},
|
||||
input::pointer::CursorImageStatus,
|
||||
render_elements,
|
||||
|
|
@ -16,11 +16,11 @@ use smithay::{
|
|||
#[cfg(feature = "debug")]
|
||||
use smithay::{
|
||||
backend::renderer::{
|
||||
Frame,
|
||||
element::{Element, Id, RenderElement},
|
||||
utils::CommitCounter,
|
||||
Frame,
|
||||
},
|
||||
utils::{user_data::UserDataMap, Buffer, Logical, Rectangle, Size, Transform},
|
||||
utils::{Buffer, Logical, Rectangle, Size, Transform, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
pub static CLEAR_COLOR: Color32F = Color32F::new(0.8, 0.8, 0.9, 1.0);
|
||||
|
|
@ -86,19 +86,21 @@ where
|
|||
// Always render `Default` for a named shape.
|
||||
CursorImageStatus::Named(_) => {
|
||||
if let Some(buffer) = self.buffer.as_ref() {
|
||||
vec![PointerRenderElement::<R>::from(
|
||||
MemoryRenderBufferRenderElement::from_buffer(
|
||||
renderer,
|
||||
location.to_f64(),
|
||||
buffer,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Kind::Cursor,
|
||||
vec![
|
||||
PointerRenderElement::<R>::from(
|
||||
MemoryRenderBufferRenderElement::from_buffer(
|
||||
renderer,
|
||||
location.to_f64(),
|
||||
buffer,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Kind::Cursor,
|
||||
)
|
||||
.expect("Lost system pointer buffer"),
|
||||
)
|
||||
.expect("Lost system pointer buffer"),
|
||||
)
|
||||
.into()]
|
||||
.into(),
|
||||
]
|
||||
} else {
|
||||
vec![]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
use std::{borrow::Cow, sync::Arc};
|
||||
|
||||
#[cfg(feature = "xwayland")]
|
||||
use smithay::xwayland::xwm::XwmOfferData;
|
||||
#[cfg(feature = "xwayland")]
|
||||
use smithay::xwayland::X11Surface;
|
||||
#[cfg(feature = "xwayland")]
|
||||
use smithay::xwayland::xwm::XwmOfferData;
|
||||
pub use smithay::{
|
||||
backend::input::KeyState,
|
||||
desktop::{LayerSurface, PopupKind},
|
||||
input::{
|
||||
Seat,
|
||||
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
|
||||
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
|
||||
Seat,
|
||||
},
|
||||
reexports::wayland_server::{backend::ObjectId, protocol::wl_surface::WlSurface, Resource},
|
||||
reexports::wayland_server::{Resource, backend::ObjectId, protocol::wl_surface::WlSurface},
|
||||
utils::{IsAlive, Serial},
|
||||
wayland::seat::WaylandFocus,
|
||||
};
|
||||
|
|
@ -32,7 +32,7 @@ use smithay::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
shell::{WindowElement, SSD},
|
||||
shell::{SSD, WindowElement},
|
||||
state::{AnvilState, Backend},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::{convert::TryInto, process::Command, sync::atomic::Ordering};
|
||||
|
||||
use crate::{focus::PointerFocusTarget, shell::FullscreenSurface, AnvilState};
|
||||
use crate::{AnvilState, focus::PointerFocusTarget, shell::FullscreenSurface};
|
||||
|
||||
#[cfg(feature = "udev")]
|
||||
use crate::udev::UdevData;
|
||||
|
|
@ -12,9 +12,9 @@ use smithay::{
|
|||
self, Axis, AxisSource, Event, InputBackend, InputEvent, KeyState, KeyboardKeyEvent,
|
||||
PointerAxisEvent, PointerButtonEvent,
|
||||
},
|
||||
desktop::{layer_map_for_output, WindowSurfaceType},
|
||||
desktop::{WindowSurfaceType, layer_map_for_output},
|
||||
input::{
|
||||
keyboard::{keysyms as xkb, FilterResult, Keysym, ModifiersState},
|
||||
keyboard::{FilterResult, Keysym, ModifiersState, keysyms as xkb},
|
||||
pointer::{AxisFrame, ButtonEvent, MotionEvent},
|
||||
},
|
||||
output::Scale,
|
||||
|
|
@ -22,7 +22,7 @@ use smithay::{
|
|||
wayland_protocols::xdg::decoration::zv1::server::zxdg_toplevel_decoration_v1,
|
||||
wayland_server::protocol::wl_pointer,
|
||||
},
|
||||
utils::{Logical, Point, Serial, Transform, SERIAL_COUNTER as SCOUNTER},
|
||||
utils::{Logical, Point, SERIAL_COUNTER as SCOUNTER, Serial, Transform},
|
||||
wayland::{
|
||||
input_method::InputMethodSeat,
|
||||
keyboard_shortcuts_inhibit::KeyboardShortcutsInhibitorSeat,
|
||||
|
|
@ -58,7 +58,7 @@ use smithay::{
|
|||
},
|
||||
reexports::wayland_server::DisplayHandle,
|
||||
wayland::{
|
||||
pointer_constraints::{with_pointer_constraint, PointerConstraint},
|
||||
pointer_constraints::{PointerConstraint, with_pointer_constraint},
|
||||
seat::WaylandFocus,
|
||||
tablet_manager::{TabletDescriptor, TabletSeatTrait},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
use smithay::{
|
||||
backend::renderer::{
|
||||
Color32F, ImportAll, ImportMem, Renderer,
|
||||
damage::{Error as OutputDamageTrackerError, OutputDamageTracker, RenderOutputResult},
|
||||
element::{
|
||||
AsRenderElements, RenderElement, Wrap,
|
||||
surface::WaylandSurfaceRenderElement,
|
||||
utils::{
|
||||
ConstrainAlign, ConstrainScaleBehavior, CropRenderElement, RelocateRenderElement,
|
||||
RescaleRenderElement,
|
||||
},
|
||||
AsRenderElements, RenderElement, Wrap,
|
||||
},
|
||||
Color32F, ImportAll, ImportMem, Renderer,
|
||||
},
|
||||
desktop::space::{
|
||||
constrain_space_element, ConstrainBehavior, ConstrainReference, Space, SpaceRenderElements,
|
||||
ConstrainBehavior, ConstrainReference, Space, SpaceRenderElements, constrain_space_element,
|
||||
},
|
||||
output::Output,
|
||||
utils::{Point, Rectangle, Size},
|
||||
|
|
@ -21,7 +21,7 @@ use smithay::{
|
|||
#[cfg(feature = "debug")]
|
||||
use crate::drawing::FpsElement;
|
||||
use crate::{
|
||||
drawing::{PointerRenderElement, CLEAR_COLOR, CLEAR_COLOR_FULLSCREEN},
|
||||
drawing::{CLEAR_COLOR, CLEAR_COLOR_FULLSCREEN, PointerRenderElement},
|
||||
shell::{FullscreenSurface, WindowElement, WindowRenderElement},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,20 +2,20 @@ use std::{borrow::Cow, time::Duration};
|
|||
|
||||
use smithay::{
|
||||
backend::renderer::{
|
||||
element::{solid::SolidColorRenderElement, surface::WaylandSurfaceRenderElement, AsRenderElements},
|
||||
ImportAll, ImportMem, Renderer, Texture,
|
||||
element::{AsRenderElements, solid::SolidColorRenderElement, surface::WaylandSurfaceRenderElement},
|
||||
},
|
||||
desktop::{
|
||||
space::SpaceElement, utils::OutputPresentationFeedback, Window, WindowSurface, WindowSurfaceType,
|
||||
Window, WindowSurface, WindowSurfaceType, space::SpaceElement, utils::OutputPresentationFeedback,
|
||||
},
|
||||
input::{
|
||||
Seat,
|
||||
pointer::{
|
||||
AxisFrame, ButtonEvent, GestureHoldBeginEvent, GestureHoldEndEvent, GesturePinchBeginEvent,
|
||||
GesturePinchEndEvent, GesturePinchUpdateEvent, GestureSwipeBeginEvent, GestureSwipeEndEvent,
|
||||
GestureSwipeUpdateEvent, MotionEvent, PointerTarget, RelativeMotionEvent,
|
||||
},
|
||||
touch::TouchTarget,
|
||||
Seat,
|
||||
},
|
||||
output::Output,
|
||||
reexports::{
|
||||
|
|
@ -23,12 +23,12 @@ use smithay::{
|
|||
wayland_server::protocol::wl_surface::WlSurface,
|
||||
},
|
||||
render_elements,
|
||||
utils::{user_data::UserDataMap, IsAlive, Logical, Physical, Point, Rectangle, Scale, Serial},
|
||||
utils::{IsAlive, Logical, Physical, Point, Rectangle, Scale, Serial, user_data::UserDataMap},
|
||||
wayland::{compositor::SurfaceData as WlSurfaceData, dmabuf::DmabufFeedback, seat::WaylandFocus},
|
||||
};
|
||||
|
||||
use super::ssd::HEADER_BAR_HEIGHT;
|
||||
use crate::{focus::PointerFocusTarget, state::Backend, AnvilState};
|
||||
use crate::{AnvilState, focus::PointerFocusTarget, state::Backend};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct WindowElement(pub Window);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::cell::RefCell;
|
||||
|
||||
use smithay::{
|
||||
desktop::{space::SpaceElement, WindowSurface},
|
||||
desktop::{WindowSurface, space::SpaceElement},
|
||||
input::{
|
||||
pointer::{
|
||||
AxisFrame, ButtonEvent, GestureHoldBeginEvent, GestureHoldEndEvent, GesturePinchBeginEvent,
|
||||
|
|
|
|||
|
|
@ -9,25 +9,25 @@ use smithay::wayland::drm_syncobj::DrmSyncobjCachedState;
|
|||
use smithay::{
|
||||
backend::renderer::utils::on_commit_buffer_handler,
|
||||
desktop::{
|
||||
layer_map_for_output, space::SpaceElement, LayerSurface, PopupKind, PopupManager, Space,
|
||||
WindowSurfaceType,
|
||||
LayerSurface, PopupKind, PopupManager, Space, WindowSurfaceType, layer_map_for_output,
|
||||
space::SpaceElement,
|
||||
},
|
||||
input::pointer::{CursorImageStatus, CursorImageSurfaceData},
|
||||
output::Output,
|
||||
reexports::{
|
||||
calloop::Interest,
|
||||
wayland_server::{
|
||||
protocol::{wl_buffer::WlBuffer, wl_output, wl_surface::WlSurface},
|
||||
Client, Resource,
|
||||
protocol::{wl_buffer::WlBuffer, wl_output, wl_surface::WlSurface},
|
||||
},
|
||||
},
|
||||
utils::{IsAlive, Logical, Point, Rectangle, Size},
|
||||
wayland::{
|
||||
buffer::BufferHandler,
|
||||
compositor::{
|
||||
add_blocker, add_pre_commit_hook, get_parent, is_sync_subsurface, with_states,
|
||||
with_surface_tree_upward, BufferAssignment, CompositorClientState, CompositorHandler,
|
||||
CompositorState, SurfaceAttributes, TraversalAction,
|
||||
BufferAssignment, CompositorClientState, CompositorHandler, CompositorState, SurfaceAttributes,
|
||||
TraversalAction, add_blocker, add_pre_commit_hook, get_parent, is_sync_subsurface, with_states,
|
||||
with_surface_tree_upward,
|
||||
},
|
||||
dmabuf::get_dmabuf,
|
||||
shell::{
|
||||
|
|
@ -41,8 +41,8 @@ use smithay::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
state::{AnvilState, Backend},
|
||||
ClientState,
|
||||
state::{AnvilState, Backend},
|
||||
};
|
||||
|
||||
mod element;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use smithay::{
|
||||
backend::renderer::{
|
||||
element::{
|
||||
solid::{SolidColorBuffer, SolidColorRenderElement},
|
||||
AsRenderElements, Kind,
|
||||
},
|
||||
Renderer,
|
||||
element::{
|
||||
AsRenderElements, Kind,
|
||||
solid::{SolidColorBuffer, SolidColorRenderElement},
|
||||
},
|
||||
},
|
||||
desktop::WindowSurface,
|
||||
input::Seat,
|
||||
|
|
@ -14,7 +14,7 @@ use smithay::{
|
|||
|
||||
use std::cell::{RefCell, RefMut};
|
||||
|
||||
use crate::{state::Backend, AnvilState};
|
||||
use crate::{AnvilState, state::Backend};
|
||||
|
||||
use super::WindowElement;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
use std::{cell::RefCell, os::unix::io::OwnedFd};
|
||||
|
||||
use smithay::{
|
||||
desktop::{space::SpaceElement, Window},
|
||||
desktop::{Window, space::SpaceElement},
|
||||
input::pointer::Focus,
|
||||
utils::{Logical, Rectangle, SERIAL_COUNTER},
|
||||
wayland::{
|
||||
compositor::with_states,
|
||||
selection::{
|
||||
SelectionTarget,
|
||||
data_device::{
|
||||
clear_data_device_selection, current_data_device_selection_userdata,
|
||||
request_data_device_client_selection, set_data_device_selection,
|
||||
|
|
@ -15,22 +16,21 @@ use smithay::{
|
|||
clear_primary_selection, current_primary_selection_userdata,
|
||||
request_primary_client_selection, set_primary_selection,
|
||||
},
|
||||
SelectionTarget,
|
||||
},
|
||||
xwayland_shell::{XWaylandShellHandler, XWaylandShellState},
|
||||
},
|
||||
xwayland::{
|
||||
xwm::{Reorder, ResizeEdge as X11ResizeEdge, XwmId},
|
||||
X11Surface, X11Wm, XwmHandler,
|
||||
xwm::{Reorder, ResizeEdge as X11ResizeEdge, XwmId},
|
||||
},
|
||||
};
|
||||
use tracing::{error, trace};
|
||||
|
||||
use crate::{focus::KeyboardFocusTarget, state::Backend, AnvilState};
|
||||
use crate::{AnvilState, focus::KeyboardFocusTarget, state::Backend};
|
||||
|
||||
use super::{
|
||||
place_new_window, FullscreenSurface, PointerMoveSurfaceGrab, PointerResizeSurfaceGrab, ResizeData,
|
||||
ResizeState, SurfaceData, TouchMoveSurfaceGrab, WindowElement,
|
||||
FullscreenSurface, PointerMoveSurfaceGrab, PointerResizeSurfaceGrab, ResizeData, ResizeState,
|
||||
SurfaceData, TouchMoveSurfaceGrab, WindowElement, place_new_window,
|
||||
};
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@ use std::cell::RefCell;
|
|||
|
||||
use smithay::{
|
||||
desktop::{
|
||||
find_popup_root_surface, get_popup_toplevel_coords, layer_map_for_output, space::SpaceElement,
|
||||
PopupKeyboardGrab, PopupKind, PopupPointerGrab, PopupUngrabStrategy, Space, Window,
|
||||
WindowSurfaceType,
|
||||
WindowSurfaceType, find_popup_root_surface, get_popup_toplevel_coords, layer_map_for_output,
|
||||
space::SpaceElement,
|
||||
},
|
||||
input::{pointer::Focus, Seat},
|
||||
input::{Seat, pointer::Focus},
|
||||
output::Output,
|
||||
reexports::{
|
||||
wayland_protocols::xdg::{decoration as xdg_decoration, shell::server::xdg_toplevel},
|
||||
wayland_server::{
|
||||
protocol::{wl_output, wl_seat, wl_surface::WlSurface},
|
||||
Resource,
|
||||
protocol::{wl_output, wl_seat, wl_surface::WlSurface},
|
||||
},
|
||||
},
|
||||
utils::{Logical, Point, Serial},
|
||||
|
|
@ -34,8 +34,8 @@ use crate::{
|
|||
};
|
||||
|
||||
use super::{
|
||||
fullscreen_output_geometry, place_new_window, FullscreenSurface, PointerMoveSurfaceGrab,
|
||||
PointerResizeSurfaceGrab, ResizeData, ResizeEdge, ResizeState, SurfaceData, WindowElement,
|
||||
FullscreenSurface, PointerMoveSurfaceGrab, PointerResizeSurfaceGrab, ResizeData, ResizeEdge, ResizeState,
|
||||
SurfaceData, WindowElement, fullscreen_output_geometry, place_new_window,
|
||||
};
|
||||
|
||||
impl<BackendData: Backend> XdgShellHandler for AnvilState<BackendData> {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
use std::os::unix::io::OwnedFd;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{atomic::AtomicBool, Arc},
|
||||
sync::{Arc, atomic::AtomicBool},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ use smithay::{
|
|||
backend::{
|
||||
input::TabletToolDescriptor,
|
||||
renderer::element::{
|
||||
default_primary_scanout_output_compare, utils::select_dmabuf_feedback, RenderElementStates,
|
||||
RenderElementStates, default_primary_scanout_output_compare, utils::select_dmabuf_feedback,
|
||||
},
|
||||
},
|
||||
delegate_compositor, delegate_data_control, delegate_data_device, delegate_fixes,
|
||||
|
|
@ -23,39 +23,40 @@ use smithay::{
|
|||
delegate_viewporter, delegate_virtual_keyboard_manager, delegate_xdg_activation, delegate_xdg_decoration,
|
||||
delegate_xdg_shell,
|
||||
desktop::{
|
||||
PopupKind, PopupManager, Space,
|
||||
space::SpaceElement,
|
||||
utils::{
|
||||
surface_presentation_feedback_flags_from_states, surface_primary_scanout_output,
|
||||
update_surface_primary_scanout_output, with_surfaces_surface_tree, OutputPresentationFeedback,
|
||||
OutputPresentationFeedback, surface_presentation_feedback_flags_from_states,
|
||||
surface_primary_scanout_output, update_surface_primary_scanout_output,
|
||||
with_surfaces_surface_tree,
|
||||
},
|
||||
PopupKind, PopupManager, Space,
|
||||
},
|
||||
input::{
|
||||
Seat, SeatHandler, SeatState,
|
||||
dnd::{DnDGrab, DndGrabHandler, DndTarget, GrabType, Source},
|
||||
keyboard::{Keysym, LedState, XkbConfig},
|
||||
pointer::{CursorImageStatus, Focus, PointerHandle},
|
||||
Seat, SeatHandler, SeatState,
|
||||
},
|
||||
output::Output,
|
||||
reexports::{
|
||||
calloop::{generic::Generic, Interest, LoopHandle, Mode, PostAction},
|
||||
calloop::{Interest, LoopHandle, Mode, PostAction, generic::Generic},
|
||||
wayland_protocols::xdg::decoration::{
|
||||
self as xdg_decoration, zv1::server::zxdg_toplevel_decoration_v1::Mode as DecorationMode,
|
||||
},
|
||||
wayland_server::{
|
||||
Client, Display, DisplayHandle, Resource,
|
||||
backend::{ClientData, ClientId, DisconnectReason},
|
||||
protocol::wl_surface::WlSurface,
|
||||
Client, Display, DisplayHandle, Resource,
|
||||
},
|
||||
},
|
||||
utils::{Clock, Logical, Monotonic, Point, Rectangle, Serial, Time},
|
||||
wayland::{
|
||||
commit_timing::{CommitTimerBarrierStateUserData, CommitTimingManagerState},
|
||||
compositor::{get_parent, with_states, CompositorClientState, CompositorHandler, CompositorState},
|
||||
compositor::{CompositorClientState, CompositorHandler, CompositorState, get_parent, with_states},
|
||||
dmabuf::DmabufFeedback,
|
||||
fifo::{FifoBarrierCachedState, FifoManagerState},
|
||||
fixes::FixesState,
|
||||
fractional_scale::{with_fractional_scale, FractionalScaleHandler, FractionalScaleManagerState},
|
||||
fractional_scale::{FractionalScaleHandler, FractionalScaleManagerState, with_fractional_scale},
|
||||
image_capture_source::{
|
||||
ImageCaptureSource, ImageCaptureSourceHandler, ImageCaptureSourceState,
|
||||
OutputCaptureSourceHandler, OutputCaptureSourceState,
|
||||
|
|
@ -68,7 +69,7 @@ use smithay::{
|
|||
KeyboardShortcutsInhibitHandler, KeyboardShortcutsInhibitState, KeyboardShortcutsInhibitor,
|
||||
},
|
||||
output::{OutputHandler, OutputManagerState},
|
||||
pointer_constraints::{with_pointer_constraint, PointerConstraintsHandler, PointerConstraintsState},
|
||||
pointer_constraints::{PointerConstraintsHandler, PointerConstraintsState, with_pointer_constraint},
|
||||
pointer_gestures::PointerGesturesState,
|
||||
presentation::PresentationState,
|
||||
relative_pointer::RelativePointerManagerState,
|
||||
|
|
@ -77,16 +78,16 @@ use smithay::{
|
|||
SecurityContext, SecurityContextHandler, SecurityContextListenerSource, SecurityContextState,
|
||||
},
|
||||
selection::{
|
||||
data_device::{set_data_device_focus, DataDeviceHandler, DataDeviceState, WaylandDndGrabHandler},
|
||||
primary_selection::{set_primary_focus, PrimarySelectionHandler, PrimarySelectionState},
|
||||
wlr_data_control::{DataControlHandler, DataControlState},
|
||||
SelectionHandler,
|
||||
data_device::{DataDeviceHandler, DataDeviceState, WaylandDndGrabHandler, set_data_device_focus},
|
||||
primary_selection::{PrimarySelectionHandler, PrimarySelectionState, set_primary_focus},
|
||||
wlr_data_control::{DataControlHandler, DataControlState},
|
||||
},
|
||||
shell::{
|
||||
wlr_layer::WlrLayerShellState,
|
||||
xdg::{
|
||||
decoration::{XdgDecorationHandler, XdgDecorationState},
|
||||
ToplevelSurface, XdgShellState,
|
||||
decoration::{XdgDecorationHandler, XdgDecorationState},
|
||||
},
|
||||
},
|
||||
shm::{ShmHandler, ShmState},
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use std::{
|
|||
io,
|
||||
ops::Not,
|
||||
path::Path,
|
||||
sync::{atomic::Ordering, Mutex, Once},
|
||||
sync::{Mutex, Once, atomic::Ordering},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ use crate::{
|
|||
drawing::*,
|
||||
render::*,
|
||||
shell::WindowElement,
|
||||
state::{take_presentation_feedback, update_primary_scanout_output, AnvilState, Backend},
|
||||
state::{AnvilState, Backend, take_presentation_feedback, update_primary_scanout_output},
|
||||
};
|
||||
use crate::{
|
||||
shell::WindowRenderElement,
|
||||
|
|
@ -24,38 +24,38 @@ use smithay::backend::drm::compositor::PrimaryPlaneElement;
|
|||
#[cfg(feature = "egl")]
|
||||
use smithay::backend::renderer::ImportEgl;
|
||||
#[cfg(feature = "debug")]
|
||||
use smithay::backend::renderer::{multigpu::MultiTexture, ImportMem};
|
||||
use smithay::backend::renderer::{ImportMem, multigpu::MultiTexture};
|
||||
use smithay::{
|
||||
backend::{
|
||||
SwapBuffersError,
|
||||
allocator::{
|
||||
Fourcc, Modifier,
|
||||
dmabuf::Dmabuf,
|
||||
format::FormatSet,
|
||||
gbm::{GbmAllocator, GbmBufferFlags, GbmDevice},
|
||||
Fourcc, Modifier,
|
||||
},
|
||||
drm::{
|
||||
CreateDrmNodeError, DrmAccessError, DrmDevice, DrmDeviceFd, DrmError, DrmEvent, DrmEventMetadata,
|
||||
DrmEventTime, DrmNode, DrmSurface, GbmBufferedSurface, NodeType,
|
||||
compositor::{DrmCompositor, FrameFlags},
|
||||
exporter::gbm::GbmFramebufferExporter,
|
||||
output::{DrmOutput, DrmOutputManager, DrmOutputRenderElements},
|
||||
CreateDrmNodeError, DrmAccessError, DrmDevice, DrmDeviceFd, DrmError, DrmEvent, DrmEventMetadata,
|
||||
DrmEventTime, DrmNode, DrmSurface, GbmBufferedSurface, NodeType,
|
||||
},
|
||||
egl::{self, context::ContextPriority, EGLContext, EGLDevice, EGLDisplay},
|
||||
egl::{self, EGLContext, EGLDevice, EGLDisplay, context::ContextPriority},
|
||||
input::InputEvent,
|
||||
libinput::{LibinputInputBackend, LibinputSessionInterface},
|
||||
renderer::{
|
||||
damage::Error as OutputDamageTrackerError,
|
||||
element::{memory::MemoryRenderBuffer, AsRenderElements, RenderElementStates},
|
||||
gles::{Capability, GlesRenderer},
|
||||
multigpu::{gbm::GbmGlesBackend, GpuManager, MultiRenderer},
|
||||
DebugFlags, ImportDma, ImportMemWl,
|
||||
damage::Error as OutputDamageTrackerError,
|
||||
element::{AsRenderElements, RenderElementStates, memory::MemoryRenderBuffer},
|
||||
gles::{Capability, GlesRenderer},
|
||||
multigpu::{GpuManager, MultiRenderer, gbm::GbmGlesBackend},
|
||||
},
|
||||
session::{
|
||||
libseat::{self, LibSeatSession},
|
||||
Event as SessionEvent, Session,
|
||||
libseat::{self, LibSeatSession},
|
||||
},
|
||||
udev::{all_gpus, primary_gpu, UdevBackend, UdevEvent},
|
||||
SwapBuffersError,
|
||||
udev::{UdevBackend, UdevEvent, all_gpus, primary_gpu},
|
||||
},
|
||||
delegate_dmabuf, delegate_drm_lease,
|
||||
desktop::{
|
||||
|
|
@ -69,12 +69,12 @@ use smithay::{
|
|||
output::{Mode as WlMode, Output, PhysicalProperties},
|
||||
reexports::{
|
||||
calloop::{
|
||||
timer::{TimeoutAction, Timer},
|
||||
EventLoop, RegistrationToken,
|
||||
timer::{TimeoutAction, Timer},
|
||||
},
|
||||
drm::{
|
||||
control::{connector, crtc, Device, ModeTypeFlags},
|
||||
Device as _,
|
||||
control::{Device, ModeTypeFlags, connector, crtc},
|
||||
},
|
||||
input::{DeviceCapability, Libinput},
|
||||
rustix::fs::OFlags,
|
||||
|
|
@ -82,7 +82,7 @@ use smithay::{
|
|||
linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1,
|
||||
presentation_time::server::wp_presentation_feedback,
|
||||
},
|
||||
wayland_server::{backend::GlobalId, protocol::wl_surface, Display, DisplayHandle},
|
||||
wayland_server::{Display, DisplayHandle, backend::GlobalId, protocol::wl_surface},
|
||||
},
|
||||
utils::{DeviceFd, IsAlive, Logical, Monotonic, Point, Scale, Time, Transform},
|
||||
wayland::{
|
||||
|
|
@ -91,7 +91,7 @@ use smithay::{
|
|||
drm_lease::{
|
||||
DrmLease, DrmLeaseBuilder, DrmLeaseHandler, DrmLeaseRequest, DrmLeaseState, LeaseRejected,
|
||||
},
|
||||
drm_syncobj::{supports_syncobj_eventfd, DrmSyncobjHandler, DrmSyncobjState},
|
||||
drm_syncobj::{DrmSyncobjHandler, DrmSyncobjState, supports_syncobj_eventfd},
|
||||
presentation::Refresh,
|
||||
},
|
||||
};
|
||||
|
|
@ -1360,8 +1360,7 @@ impl AnvilState<UdevData> {
|
|||
} else {
|
||||
trace!(
|
||||
"scheduling repaint timer with delay {:?} on {:?}",
|
||||
repaint_delay,
|
||||
crtc
|
||||
repaint_delay, crtc
|
||||
);
|
||||
Timer::from_duration(repaint_delay)
|
||||
};
|
||||
|
|
@ -1529,8 +1528,7 @@ impl AnvilState<UdevData> {
|
|||
Duration::from(next_frame_target).saturating_sub(self.clock.now().into());
|
||||
trace!(
|
||||
"reschedule repaint timer with delay {:?} on {:?}",
|
||||
reschedule_timeout,
|
||||
crtc,
|
||||
reschedule_timeout, crtc,
|
||||
);
|
||||
let timer = Timer::from_duration(reschedule_timeout);
|
||||
self.handle
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use std::{
|
||||
sync::{atomic::Ordering, Mutex},
|
||||
sync::{Mutex, atomic::Ordering},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
|
|
@ -13,16 +13,16 @@ use smithay::{
|
|||
|
||||
use smithay::{
|
||||
backend::{
|
||||
SwapBuffersError,
|
||||
allocator::dmabuf::Dmabuf,
|
||||
egl::EGLDevice,
|
||||
renderer::{
|
||||
ImportDma, ImportMemWl,
|
||||
damage::{Error as OutputDamageTrackerError, OutputDamageTracker},
|
||||
element::AsRenderElements,
|
||||
gles::GlesRenderer,
|
||||
ImportDma, ImportMemWl,
|
||||
},
|
||||
winit::{self, WinitEvent, WinitGraphicsBackend},
|
||||
SwapBuffersError,
|
||||
},
|
||||
delegate_dmabuf,
|
||||
input::{
|
||||
|
|
@ -33,7 +33,7 @@ use smithay::{
|
|||
reexports::{
|
||||
calloop::EventLoop,
|
||||
wayland_protocols::wp::presentation_time::server::wp_presentation_feedback,
|
||||
wayland_server::{protocol::wl_surface, Display},
|
||||
wayland_server::{Display, protocol::wl_surface},
|
||||
winit::platform::pump_events::PumpStatus,
|
||||
},
|
||||
utils::{IsAlive, Scale, Transform},
|
||||
|
|
@ -47,7 +47,7 @@ use smithay::{
|
|||
};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
use crate::state::{take_presentation_feedback, AnvilState, Backend};
|
||||
use crate::state::{AnvilState, Backend, take_presentation_feedback};
|
||||
use crate::{drawing::*, render::*};
|
||||
|
||||
pub const OUTPUT_NAME: &str = "winit";
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use std::{
|
||||
sync::{atomic::Ordering, Mutex},
|
||||
sync::{Mutex, atomic::Ordering},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
drawing::*,
|
||||
render::*,
|
||||
state::{take_presentation_feedback, AnvilState, Backend},
|
||||
state::{AnvilState, Backend, take_presentation_feedback},
|
||||
};
|
||||
#[cfg(feature = "egl")]
|
||||
use smithay::backend::renderer::ImportEgl;
|
||||
|
|
@ -22,10 +22,10 @@ use smithay::{
|
|||
},
|
||||
egl::{EGLContext, EGLDisplay},
|
||||
renderer::{
|
||||
damage::OutputDamageTracker, element::AsRenderElements, gles::GlesRenderer, Bind, ImportDma,
|
||||
ImportMemWl,
|
||||
Bind, ImportDma, ImportMemWl, damage::OutputDamageTracker, element::AsRenderElements,
|
||||
gles::GlesRenderer,
|
||||
},
|
||||
vulkan::{version::Version, Instance, PhysicalDevice},
|
||||
vulkan::{Instance, PhysicalDevice, version::Version},
|
||||
x11::{WindowBuilder, X11Backend, X11Event, X11Surface},
|
||||
},
|
||||
delegate_dmabuf,
|
||||
|
|
@ -39,7 +39,7 @@ use smithay::{
|
|||
calloop::EventLoop,
|
||||
gbm,
|
||||
wayland_protocols::wp::presentation_time::server::wp_presentation_feedback,
|
||||
wayland_server::{protocol::wl_surface, Display},
|
||||
wayland_server::{Display, protocol::wl_surface},
|
||||
},
|
||||
utils::{DeviceFd, IsAlive, Scale},
|
||||
wayland::{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
use smithay::utils::user_data::UserDataMap;
|
||||
|
||||
fn criterion_benchmark(c: &mut Criterion) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
use rand::Rng;
|
||||
use smithay::utils::{Physical, Rectangle, Size};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,19 +4,19 @@ use clap::{Args, Parser, Subcommand, ValueEnum};
|
|||
use smithay::{
|
||||
backend::{
|
||||
allocator::{
|
||||
Allocator, Fourcc, Modifier,
|
||||
dmabuf::{AnyError, Dmabuf, DmabufAllocator},
|
||||
dumb::DumbAllocator,
|
||||
gbm::{GbmAllocator, GbmBufferFlags, GbmDevice},
|
||||
vulkan::{ImageUsageFlags, VulkanAllocator},
|
||||
Allocator, Fourcc, Modifier,
|
||||
},
|
||||
drm::{DrmDeviceFd, DrmNode},
|
||||
egl::{EGLContext, EGLDevice, EGLDisplay},
|
||||
renderer::{
|
||||
gles::{GlesRenderbuffer, GlesRenderer},
|
||||
Bind, Color32F, ExportMem, Frame, ImportDma, Offscreen, Renderer,
|
||||
gles::{GlesRenderbuffer, GlesRenderer},
|
||||
},
|
||||
vulkan::{version::Version, Instance, PhysicalDevice},
|
||||
vulkan::{Instance, PhysicalDevice, version::Version},
|
||||
},
|
||||
utils::{DeviceFd, Rectangle, Transform},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,29 +5,29 @@ use smithay::{
|
|||
backend::{
|
||||
input::{InputEvent, KeyboardKeyEvent},
|
||||
renderer::{
|
||||
Color32F, Frame, Renderer,
|
||||
element::{
|
||||
surface::{render_elements_from_surface_tree, WaylandSurfaceRenderElement},
|
||||
Kind,
|
||||
surface::{WaylandSurfaceRenderElement, render_elements_from_surface_tree},
|
||||
},
|
||||
gles::GlesRenderer,
|
||||
utils::{draw_render_elements, on_commit_buffer_handler},
|
||||
Color32F, Frame, Renderer,
|
||||
},
|
||||
winit::{self, WinitEvent},
|
||||
},
|
||||
delegate_compositor, delegate_data_device, delegate_seat, delegate_shm, delegate_xdg_shell,
|
||||
input::{keyboard::FilterResult, Seat, SeatHandler, SeatState},
|
||||
reexports::wayland_server::{protocol::wl_seat, Display},
|
||||
input::{Seat, SeatHandler, SeatState, keyboard::FilterResult},
|
||||
reexports::wayland_server::{Display, protocol::wl_seat},
|
||||
utils::{Rectangle, Serial, Transform},
|
||||
wayland::{
|
||||
buffer::BufferHandler,
|
||||
compositor::{
|
||||
with_surface_tree_downward, CompositorClientState, CompositorHandler, CompositorState,
|
||||
SurfaceAttributes, TraversalAction,
|
||||
CompositorClientState, CompositorHandler, CompositorState, SurfaceAttributes, TraversalAction,
|
||||
with_surface_tree_downward,
|
||||
},
|
||||
selection::{
|
||||
data_device::{DataDeviceHandler, DataDeviceState, WaylandDndGrabHandler},
|
||||
SelectionHandler,
|
||||
data_device::{DataDeviceHandler, DataDeviceState, WaylandDndGrabHandler},
|
||||
},
|
||||
shell::xdg::{PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState},
|
||||
shm::{ShmHandler, ShmState},
|
||||
|
|
@ -35,12 +35,12 @@ use smithay::{
|
|||
};
|
||||
use wayland_protocols::xdg::shell::server::xdg_toplevel;
|
||||
use wayland_server::{
|
||||
Client, ListeningSocket,
|
||||
backend::{ClientData, ClientId, DisconnectReason},
|
||||
protocol::{
|
||||
wl_buffer,
|
||||
wl_surface::{self, WlSurface},
|
||||
},
|
||||
Client, ListeningSocket,
|
||||
};
|
||||
|
||||
impl BufferHandler for App {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use smithay::input::{keyboard::FilterResult, Seat, SeatHandler, SeatState};
|
||||
use smithay::input::{Seat, SeatHandler, SeatState, keyboard::FilterResult};
|
||||
use smithay::reexports::wayland_server::{
|
||||
Display, ListeningSocket,
|
||||
backend::{ClientData, ClientId, DisconnectReason},
|
||||
protocol::wl_surface::WlSurface,
|
||||
Display, ListeningSocket,
|
||||
};
|
||||
use smithay::wayland::compositor::{CompositorClientState, CompositorHandler, CompositorState};
|
||||
use smithay::{delegate_compositor, delegate_seat};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use drm_fourcc::{DrmFourcc, DrmModifier};
|
||||
use smithay::backend::{
|
||||
allocator::{
|
||||
Allocator, Buffer,
|
||||
dmabuf::AsDmabuf,
|
||||
vulkan::{ImageUsageFlags, VulkanAllocator},
|
||||
Allocator, Buffer,
|
||||
},
|
||||
vulkan::{version::Version, Instance, PhysicalDevice},
|
||||
vulkan::{Instance, PhysicalDevice, version::Version},
|
||||
};
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
use crate::{grabs::resize_grab, state::ClientState, Smallvil};
|
||||
use crate::{Smallvil, grabs::resize_grab, state::ClientState};
|
||||
use smithay::{
|
||||
backend::renderer::utils::on_commit_buffer_handler,
|
||||
delegate_compositor, delegate_shm,
|
||||
reexports::wayland_server::{
|
||||
protocol::{wl_buffer, wl_surface::WlSurface},
|
||||
Client,
|
||||
protocol::{wl_buffer, wl_surface::WlSurface},
|
||||
},
|
||||
wayland::{
|
||||
buffer::BufferHandler,
|
||||
compositor::{
|
||||
get_parent, is_sync_subsurface, CompositorClientState, CompositorHandler, CompositorState,
|
||||
CompositorClientState, CompositorHandler, CompositorState, get_parent, is_sync_subsurface,
|
||||
},
|
||||
shm::{ShmHandler, ShmState},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ use crate::Smallvil;
|
|||
use smithay::input::dnd::{DnDGrab, DndGrabHandler, GrabType, Source};
|
||||
use smithay::input::pointer::Focus;
|
||||
use smithay::input::{Seat, SeatHandler, SeatState};
|
||||
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
|
||||
use smithay::reexports::wayland_server::Resource;
|
||||
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
|
||||
use smithay::utils::Serial;
|
||||
use smithay::wayland::output::OutputHandler;
|
||||
use smithay::wayland::selection::data_device::{
|
||||
set_data_device_focus, DataDeviceHandler, DataDeviceState, WaylandDndGrabHandler,
|
||||
};
|
||||
use smithay::wayland::selection::SelectionHandler;
|
||||
use smithay::wayland::selection::data_device::{
|
||||
DataDeviceHandler, DataDeviceState, WaylandDndGrabHandler, set_data_device_focus,
|
||||
};
|
||||
use smithay::{delegate_data_device, delegate_output, delegate_seat};
|
||||
|
||||
impl SeatHandler for Smallvil {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
use smithay::{
|
||||
delegate_xdg_shell,
|
||||
desktop::{find_popup_root_surface, get_popup_toplevel_coords, PopupKind, PopupManager, Space, Window},
|
||||
desktop::{PopupKind, PopupManager, Space, Window, find_popup_root_surface, get_popup_toplevel_coords},
|
||||
input::{
|
||||
pointer::{Focus, GrabStartData as PointerGrabStartData},
|
||||
Seat,
|
||||
pointer::{Focus, GrabStartData as PointerGrabStartData},
|
||||
},
|
||||
reexports::{
|
||||
wayland_protocols::xdg::shell::server::xdg_toplevel,
|
||||
wayland_server::{
|
||||
protocol::{wl_seat, wl_surface::WlSurface},
|
||||
Resource,
|
||||
protocol::{wl_seat, wl_surface::WlSurface},
|
||||
},
|
||||
},
|
||||
utils::{Rectangle, Serial},
|
||||
|
|
@ -23,8 +23,8 @@ use smithay::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
grabs::{MoveSurfaceGrab, ResizeSurfaceGrab},
|
||||
Smallvil,
|
||||
grabs::{MoveSurfaceGrab, ResizeSurfaceGrab},
|
||||
};
|
||||
|
||||
impl XdgShellHandler for Smallvil {
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ use smithay::{
|
|||
desktop::{PopupManager, Space, Window, WindowSurfaceType},
|
||||
input::{Seat, SeatState},
|
||||
reexports::{
|
||||
calloop::{generic::Generic, EventLoop, Interest, LoopSignal, Mode, PostAction},
|
||||
calloop::{EventLoop, Interest, LoopSignal, Mode, PostAction, generic::Generic},
|
||||
wayland_server::{
|
||||
Display, DisplayHandle,
|
||||
backend::{ClientData, ClientId, DisconnectReason},
|
||||
protocol::wl_surface::WlSurface,
|
||||
Display, DisplayHandle,
|
||||
},
|
||||
},
|
||||
utils::{Logical, Point},
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ use smithay_drm_extras::{
|
|||
use smithay::{
|
||||
backend::{
|
||||
drm::{self, DrmDeviceFd, DrmNode},
|
||||
session::{libseat::LibSeatSession, Session},
|
||||
session::{Session, libseat::LibSeatSession},
|
||||
udev::{UdevBackend, UdevEvent},
|
||||
},
|
||||
reexports::{
|
||||
calloop::{timer::Timer, EventLoop, LoopHandle},
|
||||
calloop::{EventLoop, LoopHandle, timer::Timer},
|
||||
rustix::fs::OFlags,
|
||||
},
|
||||
utils::DeviceFd,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//! println!("Manufacturer name: {}", info.make());
|
||||
//! ```
|
||||
|
||||
use drm::control::{connector, Device as ControlDevice};
|
||||
use drm::control::{Device as ControlDevice, connector};
|
||||
use libdisplay_info::info::Info;
|
||||
|
||||
/// Try to read the [`Info`] from the connector EDID property
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//! ```
|
||||
use std::collections::HashMap;
|
||||
|
||||
use drm::control::{connector, crtc, Device as ControlDevice};
|
||||
use drm::control::{Device as ControlDevice, connector, crtc};
|
||||
|
||||
mod connector_scanner;
|
||||
pub use connector_scanner::{ConnectorScanEvent, ConnectorScanResult, ConnectorScanner};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use drm::control::{connector, Device as ControlDevice};
|
||||
use drm::control::{Device as ControlDevice, connector};
|
||||
|
||||
/// Responsible for tracking connected/disconnected events.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use drm::control::{connector, crtc, Device as ControlDevice};
|
||||
use drm::control::{Device as ControlDevice, connector, crtc};
|
||||
|
||||
/// CRTC Mapper trait
|
||||
///
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ use crate::utils::{Buffer as BufferCoords, Size};
|
|||
use crate::wayland::compositor::{Blocker, BlockerState};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::os::unix::io::{AsFd, BorrowedFd, OwnedFd};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
#[cfg(feature = "backend_drm")]
|
||||
use std::sync::Mutex;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::{error, fmt};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ use std::fmt;
|
|||
use std::io;
|
||||
|
||||
use drm::buffer::Buffer as DrmBuffer;
|
||||
use drm::control::{dumbbuffer::DumbBuffer as Handle, Device as ControlDevice};
|
||||
use drm::control::{Device as ControlDevice, dumbbuffer::DumbBuffer as Handle};
|
||||
use tracing::instrument;
|
||||
|
||||
use super::dmabuf::{AsDmabuf, Dmabuf, DmabufFlags};
|
||||
use super::{format::get_bpp, Allocator, Buffer, Format, Fourcc, Modifier};
|
||||
use super::{Allocator, Buffer, Format, Fourcc, Modifier, format::get_bpp};
|
||||
use crate::backend::drm::DrmDeviceFd;
|
||||
use crate::backend::drm::DrmNode;
|
||||
use crate::utils::{Buffer as BufferCoords, Size};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
//! conversions to and from [dmabufs](super::dmabuf).
|
||||
|
||||
use super::{
|
||||
dmabuf::{AsDmabuf, Dmabuf, DmabufFlags, MAX_PLANES},
|
||||
Allocator, Buffer, Format, Fourcc, Modifier,
|
||||
dmabuf::{AsDmabuf, Dmabuf, DmabufFlags, MAX_PLANES},
|
||||
};
|
||||
use crate::backend::drm::DrmNode;
|
||||
use crate::utils::{Buffer as BufferCoords, Size};
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ use std::{
|
|||
fmt,
|
||||
ops::Deref,
|
||||
sync::{
|
||||
atomic::{AtomicBool, AtomicU8, Ordering},
|
||||
Arc,
|
||||
atomic::{AtomicBool, AtomicU8, Ordering},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -207,11 +207,7 @@ where
|
|||
let res = other_slot
|
||||
.age
|
||||
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |age| {
|
||||
if age > 0 {
|
||||
age.checked_add(1)
|
||||
} else {
|
||||
Some(0)
|
||||
}
|
||||
if age > 0 { age.checked_add(1) } else { Some(0) }
|
||||
});
|
||||
// If the age overflows the slot was not used for a long time. Lets clear it
|
||||
if res.is_err() {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use std::{
|
|||
ffi::CStr,
|
||||
fmt,
|
||||
os::unix::io::{FromRawFd, OwnedFd},
|
||||
sync::{mpsc, Arc, Weak},
|
||||
sync::{Arc, Weak, mpsc},
|
||||
};
|
||||
|
||||
use ash::{ext, khr, vk};
|
||||
|
|
@ -37,14 +37,14 @@ use crate::backend::drm::DrmNode;
|
|||
use crate::{
|
||||
backend::{
|
||||
allocator::dmabuf::DmabufFlags,
|
||||
vulkan::{version::Version, PhysicalDevice},
|
||||
vulkan::{PhysicalDevice, version::Version},
|
||||
},
|
||||
utils::{Buffer as BufferCoord, Size},
|
||||
};
|
||||
|
||||
use super::{
|
||||
dmabuf::{AsDmabuf, Dmabuf, MAX_PLANES},
|
||||
Allocator, Buffer,
|
||||
dmabuf::{AsDmabuf, Dmabuf, MAX_PLANES},
|
||||
};
|
||||
|
||||
bitflags! {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use crate::{
|
||||
backend::renderer::{
|
||||
Color32F, Frame, Renderer,
|
||||
element::{Element, Id, RenderElement},
|
||||
utils::{CommitCounter, DamageSet, OpaqueRegions},
|
||||
Color32F, Frame, Renderer,
|
||||
},
|
||||
render_elements,
|
||||
utils::{user_data::UserDataMap, Buffer, Physical, Rectangle, Scale, Transform},
|
||||
utils::{Buffer, Physical, Rectangle, Scale, Transform, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
render_elements! {
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@ use std::collections::HashSet;
|
|||
use crate::{
|
||||
backend::{
|
||||
allocator::{
|
||||
dmabuf::{AsDmabuf, Dmabuf},
|
||||
Buffer, Slot,
|
||||
dmabuf::{AsDmabuf, Dmabuf},
|
||||
},
|
||||
drm::Framebuffer,
|
||||
renderer::{
|
||||
Bind, Blit, Color32F, Frame, Renderer,
|
||||
damage::OutputDamageTracker,
|
||||
element::{Element, Id, RenderElement, RenderElementStates},
|
||||
sync::SyncPoint,
|
||||
utils::{CommitCounter, DamageSet, DamageSnapshot, OpaqueRegions},
|
||||
Bind, Blit, Color32F, Frame, Renderer,
|
||||
},
|
||||
},
|
||||
output::OutputNoMode,
|
||||
|
|
|
|||
|
|
@ -134,31 +134,32 @@ use std::{
|
|||
};
|
||||
|
||||
use drm::{
|
||||
control::{connector, crtc, framebuffer, plane, Device as _, Mode, PlaneType},
|
||||
Device, DriverCapability,
|
||||
control::{Device as _, Mode, PlaneType, connector, crtc, framebuffer, plane},
|
||||
};
|
||||
use drm_fourcc::{DrmFormat, DrmFourcc, DrmModifier};
|
||||
use indexmap::{IndexMap, IndexSet};
|
||||
use smallvec::SmallVec;
|
||||
use tracing::{debug, error, info, info_span, instrument, trace, warn};
|
||||
use wayland_server::{protocol::wl_buffer::WlBuffer, Resource};
|
||||
use wayland_server::{Resource, protocol::wl_buffer::WlBuffer};
|
||||
|
||||
#[cfg(feature = "renderer_pixman")]
|
||||
use crate::backend::renderer::{
|
||||
pixman::{PixmanError, PixmanRenderer, PixmanTexture},
|
||||
Frame as _, ImportAll,
|
||||
pixman::{PixmanError, PixmanRenderer, PixmanTexture},
|
||||
};
|
||||
use crate::{
|
||||
backend::{
|
||||
SwapBuffersError,
|
||||
allocator::{
|
||||
Allocator, Buffer, Slot, Swapchain,
|
||||
dmabuf::{AsDmabuf, Dmabuf},
|
||||
format::{get_opaque, has_alpha},
|
||||
gbm::{GbmAllocator, GbmBuffer, GbmBufferFlags, GbmDevice},
|
||||
Allocator, Buffer, Slot, Swapchain,
|
||||
},
|
||||
drm::{plane_has_property, DrmError, PlaneDamageClips},
|
||||
drm::{DrmError, PlaneDamageClips, plane_has_property},
|
||||
renderer::{
|
||||
buffer_y_inverted,
|
||||
Bind, Color32F, DebugFlags, Renderer, RendererSuper, Texture, buffer_y_inverted,
|
||||
damage::{Error as OutputDamageTrackerError, OutputDamageTracker},
|
||||
element::{
|
||||
Element, Id, Kind, RenderElement, RenderElementPresentationState, RenderElementState,
|
||||
|
|
@ -166,9 +167,7 @@ use crate::{
|
|||
},
|
||||
sync::SyncPoint,
|
||||
utils::{CommitCounter, DamageBag},
|
||||
Bind, Color32F, DebugFlags, Renderer, RendererSuper, Texture,
|
||||
},
|
||||
SwapBuffersError,
|
||||
},
|
||||
output::OutputModeSource,
|
||||
utils::{Buffer as BufferCoords, DevPath, Physical, Point, Rectangle, Scale, Size, Transform},
|
||||
|
|
@ -176,10 +175,10 @@ use crate::{
|
|||
};
|
||||
|
||||
use super::{
|
||||
error::AccessError,
|
||||
exporter::{gbm::GbmFramebufferExporter, gbm::NodeFilter, ExportBuffer, ExportFramebuffer},
|
||||
surface::VrrSupport,
|
||||
DrmSurface, Framebuffer, PlaneClaim, PlaneInfo, Planes,
|
||||
error::AccessError,
|
||||
exporter::{ExportBuffer, ExportFramebuffer, gbm::GbmFramebufferExporter, gbm::NodeFilter},
|
||||
surface::VrrSupport,
|
||||
};
|
||||
|
||||
mod elements;
|
||||
|
|
@ -3513,8 +3512,7 @@ where
|
|||
if cached_fb.is_none() {
|
||||
trace!(
|
||||
"no cached fb, exporting new fb for element {:?} underlying storage {:?}",
|
||||
element_id,
|
||||
&underlying_storage
|
||||
element_id, &underlying_storage
|
||||
);
|
||||
|
||||
let fb = self
|
||||
|
|
@ -3532,8 +3530,7 @@ where
|
|||
if fb.is_err() {
|
||||
trace!(
|
||||
"could not import framebuffer for element {:?} underlying storage {:?}",
|
||||
element_id,
|
||||
&underlying_storage
|
||||
element_id, &underlying_storage
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -3541,8 +3538,7 @@ where
|
|||
} else {
|
||||
trace!(
|
||||
"using cached fb for element {:?} underlying storage {:?}",
|
||||
element_id,
|
||||
&underlying_storage
|
||||
element_id, &underlying_storage
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -3808,9 +3804,7 @@ where
|
|||
if frame_state.is_assigned(plane.handle) {
|
||||
trace!(
|
||||
"skipping {:?} with zpos {:?} for element {:?}, already has element assigned, skipping",
|
||||
plane.handle,
|
||||
plane.zpos,
|
||||
element_id,
|
||||
plane.handle, plane.zpos, element_id,
|
||||
);
|
||||
return Err(None);
|
||||
}
|
||||
|
|
@ -3822,9 +3816,7 @@ where
|
|||
if is_underlay && !(element_is_opaque && primary_plane_has_alpha) {
|
||||
trace!(
|
||||
"skipping direct scan-out on underlay {:?} with zpos {:?}, element {:?} is not opaque or primary plane has no alpha channel",
|
||||
plane.handle,
|
||||
plane.zpos,
|
||||
element_id
|
||||
plane.handle, plane.zpos, element_id
|
||||
);
|
||||
return Err(None);
|
||||
}
|
||||
|
|
@ -3834,7 +3826,8 @@ where
|
|||
// we can not assign it to any overlay plane
|
||||
if overlaps_with_primary_plane_element && !is_underlay {
|
||||
trace!(
|
||||
"skipping direct scan-out on {:?} with zpos {:?}, element {:?} overlaps with element on primary plane", plane.handle, plane.zpos, element_id,
|
||||
"skipping direct scan-out on {:?} with zpos {:?}, element {:?} overlaps with element on primary plane",
|
||||
plane.handle, plane.zpos, element_id,
|
||||
);
|
||||
return Err(None);
|
||||
}
|
||||
|
|
@ -3856,7 +3849,8 @@ where
|
|||
// plane for direct scan-out
|
||||
if overlaps_with_plane_underneath {
|
||||
trace!(
|
||||
"skipping direct scan-out on {:?} with zpos {:?}, element {:?} geometry {:?} overlaps with plane underneath", plane.handle, plane.zpos, element_id, element_config.geometry,
|
||||
"skipping direct scan-out on {:?} with zpos {:?}, element {:?} geometry {:?} overlaps with plane underneath",
|
||||
plane.handle, plane.zpos, element_id, element_config.geometry,
|
||||
);
|
||||
return Err(None);
|
||||
}
|
||||
|
|
@ -3870,10 +3864,7 @@ where
|
|||
if let Ok(plane_assignment) = test_overlay_plane(plane, &element_config) {
|
||||
trace!(
|
||||
"assigned element {:?} geometry {:?} to compatible {:?} with zpos {:?}",
|
||||
element_id,
|
||||
element_config.geometry,
|
||||
plane.handle,
|
||||
plane.zpos,
|
||||
element_id, element_config.geometry, plane.handle, plane.zpos,
|
||||
);
|
||||
return Ok(plane_assignment);
|
||||
}
|
||||
|
|
@ -3885,7 +3876,8 @@ where
|
|||
// if the tested element state already tells us that this failed skip the test
|
||||
if element_config.failed_planes.overlay_bitmask & (1 << index) != 0 {
|
||||
trace!(
|
||||
"skipping direct scan-out on {:?} with zpos {:?}, element {:?} geometry {:?}, test already known to fail", plane.handle, plane.zpos, element_id, element_config.geometry,
|
||||
"skipping direct scan-out on {:?} with zpos {:?}, element {:?} geometry {:?}, test already known to fail",
|
||||
plane.handle, plane.zpos, element_id, element_config.geometry,
|
||||
);
|
||||
rendering_reason = rendering_reason.or(Some(RenderingReason::ScanoutFailed));
|
||||
continue;
|
||||
|
|
@ -3937,15 +3929,15 @@ where
|
|||
};
|
||||
|
||||
// Try to assign the element to a plane
|
||||
trace!("testing direct scan-out for element {:?} on {:?} with zpos {:?}: fb: {:?}, element_geometry: {:?}", element_id, plane.handle, plane.zpos, &element_config.buffer.fb, element_config.geometry);
|
||||
trace!(
|
||||
"testing direct scan-out for element {:?} on {:?} with zpos {:?}: fb: {:?}, element_geometry: {:?}",
|
||||
element_id, plane.handle, plane.zpos, &element_config.buffer.fb, element_config.geometry
|
||||
);
|
||||
|
||||
if !plane.formats.contains(&element_config.properties.format) {
|
||||
trace!(
|
||||
"skipping direct scan-out on {:?} with zpos {:?} for element {:?}, format {:?} not supported",
|
||||
plane.handle,
|
||||
plane.zpos,
|
||||
element_id,
|
||||
element_config.properties.format,
|
||||
plane.handle, plane.zpos, element_id, element_config.properties.format,
|
||||
);
|
||||
return Err(Some(RenderingReason::FormatUnsupported));
|
||||
}
|
||||
|
|
@ -4035,9 +4027,7 @@ where
|
|||
let res = if is_compatible {
|
||||
trace!(
|
||||
"skipping atomic test for compatible element {:?} on {:?} with zpos {:?}",
|
||||
element_id,
|
||||
plane.handle,
|
||||
plane.zpos,
|
||||
element_id, plane.handle, plane.zpos,
|
||||
);
|
||||
frame_state.set_state(plane.handle, plane_state);
|
||||
true
|
||||
|
|
@ -4056,18 +4046,14 @@ where
|
|||
if res {
|
||||
trace!(
|
||||
"successfully assigned element {:?} to {:?} with zpos {:?} for direct scan-out",
|
||||
element_id,
|
||||
plane.handle,
|
||||
plane.zpos,
|
||||
element_id, plane.handle, plane.zpos,
|
||||
);
|
||||
|
||||
Ok(plane.into())
|
||||
} else {
|
||||
trace!(
|
||||
"skipping direct scan-out on {:?} with zpos {:?} for element {:?}, test failed",
|
||||
plane.handle,
|
||||
plane.zpos,
|
||||
element_id
|
||||
plane.handle, plane.zpos, element_id
|
||||
);
|
||||
|
||||
Err(Some(RenderingReason::ScanoutFailed))
|
||||
|
|
@ -4394,10 +4380,10 @@ where
|
|||
}
|
||||
|
||||
impl<
|
||||
A: std::error::Error + Send + Sync + 'static,
|
||||
B: std::error::Error + Send + Sync + 'static,
|
||||
F: std::error::Error + Send + Sync + 'static,
|
||||
> From<FrameError<A, B, F>> for SwapBuffersError
|
||||
A: std::error::Error + Send + Sync + 'static,
|
||||
B: std::error::Error + Send + Sync + 'static,
|
||||
F: std::error::Error + Send + Sync + 'static,
|
||||
> From<FrameError<A, B, F>> for SwapBuffersError
|
||||
{
|
||||
#[inline]
|
||||
fn from(err: FrameError<A, B, F>) -> SwapBuffersError {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, RwLock,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
|
||||
use drm::control::atomic::AtomicModeReq;
|
||||
use drm::control::{
|
||||
connector, crtc, framebuffer, plane, property, AtomicCommitFlags, Device as ControlDevice,
|
||||
PropertyValueSet, ResourceHandle,
|
||||
AtomicCommitFlags, Device as ControlDevice, PropertyValueSet, ResourceHandle, connector, crtc,
|
||||
framebuffer, plane, property,
|
||||
};
|
||||
|
||||
use super::DrmDeviceFd;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use drm::{control::Device as ControlDevice, Device as BasicDevice};
|
||||
use drm::{Device as BasicDevice, control::Device as ControlDevice};
|
||||
use std::{
|
||||
os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd},
|
||||
sync::{Arc, Weak},
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
|
||||
use drm::control::{connector, crtc, Device as ControlDevice};
|
||||
use drm::control::{Device as ControlDevice, connector, crtc};
|
||||
|
||||
use super::DrmDeviceFd;
|
||||
use crate::backend::drm::error::{AccessError, Error};
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ use std::collections::HashMap;
|
|||
use std::io;
|
||||
use std::os::unix::io::{AsFd, BorrowedFd};
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::{atomic::AtomicBool, Arc, Mutex, Weak};
|
||||
use std::sync::{Arc, Mutex, Weak, atomic::AtomicBool};
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use calloop::{EventSource, Interest, Poll, PostAction, Readiness, Token, TokenFactory};
|
||||
use drm::control::{connector, crtc, plane, Device as ControlDevice, Event, Mode, ResourceHandles};
|
||||
use drm::control::{Device as ControlDevice, Event, Mode, ResourceHandles, connector, crtc, plane};
|
||||
use drm::{ClientCapability, Device as BasicDevice, DriverCapability};
|
||||
use libc::dev_t;
|
||||
|
||||
|
|
@ -17,8 +17,8 @@ pub(super) mod legacy;
|
|||
use crate::utils::{Buffer, DevPath, Size};
|
||||
|
||||
use super::error::AccessError;
|
||||
use super::surface::{atomic::AtomicDrmSurface, legacy::LegacyDrmSurface, DrmSurface, DrmSurfaceInternal};
|
||||
use super::{error::Error, planes, Planes};
|
||||
use super::surface::{DrmSurface, DrmSurfaceInternal, atomic::AtomicDrmSurface, legacy::LegacyDrmSurface};
|
||||
use super::{Planes, error::Error, planes};
|
||||
use atomic::AtomicDrmDevice;
|
||||
use legacy::LegacyDrmDevice;
|
||||
|
||||
|
|
@ -83,11 +83,7 @@ impl PlaneClaimStorage {
|
|||
) -> Option<PlaneClaim> {
|
||||
let mut guard = self.claimed_planes.lock().unwrap();
|
||||
if let Some(claim) = guard.get(&plane).and_then(|claim| claim.upgrade()) {
|
||||
if claim.crtc() == crtc {
|
||||
Some(claim)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if claim.crtc() == crtc { Some(claim) } else { None }
|
||||
} else {
|
||||
let claim = PlaneClaim {
|
||||
claim: Arc::new(PlaneClaimInner {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use drm_fourcc::{DrmFormat, DrmModifier};
|
|||
|
||||
use drm::{
|
||||
buffer::{Buffer as DrmBuffer, PlanarBuffer},
|
||||
control::{framebuffer, Device, FbCmd2Flags},
|
||||
control::{Device, FbCmd2Flags, framebuffer},
|
||||
};
|
||||
use tracing::{trace, warn};
|
||||
|
||||
|
|
@ -12,16 +12,16 @@ use crate::utils::DevPath;
|
|||
use crate::{
|
||||
backend::{
|
||||
allocator::{
|
||||
Buffer, Fourcc,
|
||||
dumb::DumbBuffer,
|
||||
format::{get_bpp, get_depth, get_opaque},
|
||||
Buffer, Fourcc,
|
||||
},
|
||||
drm::DrmDeviceFd,
|
||||
},
|
||||
utils::{Buffer as BufferCoords, Size},
|
||||
};
|
||||
|
||||
use super::{error::AccessError, warn_legacy_fb_export, Framebuffer};
|
||||
use super::{Framebuffer, error::AccessError, warn_legacy_fb_export};
|
||||
|
||||
/// A GBM backed framebuffer
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::backend::SwapBuffersError;
|
||||
use drm::control::{connector, crtc, plane, Mode, RawResourceHandle};
|
||||
use drm::control::{Mode, RawResourceHandle, connector, crtc, plane};
|
||||
use std::{
|
||||
io::{self, ErrorKind},
|
||||
path::PathBuf,
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ use super::{ExportBuffer, ExportFramebuffer};
|
|||
use crate::backend::{
|
||||
allocator::dumb::DumbBuffer,
|
||||
drm::{
|
||||
dumb::{framebuffer_from_dumb_buffer, DumbFramebuffer},
|
||||
error::AccessError,
|
||||
DrmDeviceFd,
|
||||
dumb::{DumbFramebuffer, framebuffer_from_dumb_buffer},
|
||||
error::AccessError,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ use crate::backend::{
|
|||
gbm::{GbmBuffer, GbmConvertError},
|
||||
},
|
||||
drm::{
|
||||
gbm::{framebuffer_from_bo, framebuffer_from_dmabuf, Error as GbmError, GbmFramebuffer},
|
||||
DrmDeviceFd,
|
||||
gbm::{Error as GbmError, GbmFramebuffer, framebuffer_from_bo, framebuffer_from_dmabuf},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use thiserror::Error;
|
|||
|
||||
use drm::{
|
||||
buffer::PlanarBuffer,
|
||||
control::{framebuffer, Device, FbCmd2Flags},
|
||||
control::{Device, FbCmd2Flags, framebuffer},
|
||||
};
|
||||
use drm_fourcc::DrmModifier;
|
||||
use tracing::{trace, warn};
|
||||
|
|
@ -17,16 +17,16 @@ use wayland_server::protocol::wl_buffer::WlBuffer;
|
|||
use crate::backend::allocator::Buffer;
|
||||
use crate::backend::{
|
||||
allocator::{
|
||||
Fourcc,
|
||||
dmabuf::Dmabuf,
|
||||
format::{get_bpp, get_depth, get_opaque},
|
||||
gbm::GbmBuffer,
|
||||
Fourcc,
|
||||
},
|
||||
drm::DrmDeviceFd,
|
||||
};
|
||||
use crate::utils::DevPath;
|
||||
|
||||
use super::{error::AccessError, warn_legacy_fb_export, Framebuffer};
|
||||
use super::{Framebuffer, error::AccessError, warn_legacy_fb_export};
|
||||
|
||||
/// A GBM backed framebuffer
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ pub use surface::gbm::{Error as GbmBufferedSurfaceError, GbmBufferedSurface};
|
|||
pub use surface::{DrmSurface, PlaneConfig, PlaneDamageClips, PlaneState, VrrSupport};
|
||||
|
||||
use drm::{
|
||||
control::{crtc, framebuffer, plane, Device as ControlDevice, PlaneType},
|
||||
DriverCapability,
|
||||
control::{Device as ControlDevice, PlaneType, crtc, framebuffer, plane},
|
||||
};
|
||||
use tracing::trace;
|
||||
|
||||
|
|
@ -402,8 +402,7 @@ fn plane_formats(dev: &(impl ControlDevice + DevPath), plane: plane::Handle) ->
|
|||
|
||||
trace!(
|
||||
"Supported scan-out formats for plane ({:?}): {:?}",
|
||||
plane,
|
||||
formats
|
||||
plane, formats
|
||||
);
|
||||
|
||||
Ok(FormatSet::from_formats(formats))
|
||||
|
|
|
|||
|
|
@ -8,28 +8,28 @@ use std::{
|
|||
sync::{Arc, Mutex, RwLock, RwLockWriteGuard, TryLockError},
|
||||
};
|
||||
|
||||
use drm::control::{self, connector, crtc, Mode};
|
||||
use drm::control::{self, Mode, connector, crtc};
|
||||
use drm_fourcc::{DrmFormat, DrmFourcc, DrmModifier};
|
||||
|
||||
use crate::{
|
||||
backend::{
|
||||
allocator::{
|
||||
Allocator,
|
||||
dmabuf::{AsDmabuf, Dmabuf},
|
||||
gbm::GbmDevice,
|
||||
Allocator,
|
||||
},
|
||||
renderer::{element::RenderElement, Bind, Color32F, DebugFlags, Renderer, RendererSuper, Texture},
|
||||
renderer::{Bind, Color32F, DebugFlags, Renderer, RendererSuper, Texture, element::RenderElement},
|
||||
},
|
||||
output::OutputModeSource,
|
||||
};
|
||||
|
||||
use super::{
|
||||
DrmDevice, DrmError, Planes,
|
||||
compositor::{
|
||||
DrmCompositor, FrameError, FrameFlags, FrameResult, PrimaryPlaneElement, RenderFrameError,
|
||||
RenderFrameErrorType, RenderFrameResult,
|
||||
},
|
||||
exporter::ExportFramebuffer,
|
||||
DrmDevice, DrmError, Planes,
|
||||
};
|
||||
|
||||
type CompositorList<A, F, U, G> = Arc<RwLock<HashMap<crtc::Handle, Mutex<DrmCompositor<A, F, U, G>>>>>;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use drm::control::Device as ControlDevice;
|
||||
use drm::control::atomic::AtomicModeReq;
|
||||
use drm::control::connector::Interface;
|
||||
use drm::control::property::ValueType;
|
||||
use drm::control::Device as ControlDevice;
|
||||
use drm::control::{
|
||||
connector, crtc, dumbbuffer::DumbBuffer, framebuffer, plane, property, AtomicCommitFlags, Mode, PlaneType,
|
||||
AtomicCommitFlags, Mode, PlaneType, connector, crtc, dumbbuffer::DumbBuffer, framebuffer, plane, property,
|
||||
};
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
|
|
@ -13,8 +13,8 @@ use std::collections::HashSet;
|
|||
use std::fmt;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, Mutex, RwLock,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
|
||||
use crate::backend::drm::error::AccessError;
|
||||
|
|
@ -23,10 +23,11 @@ use crate::{
|
|||
backend::{
|
||||
allocator::format::{get_bpp, get_depth},
|
||||
drm::{
|
||||
device::atomic::{map_props, PropMapping},
|
||||
DrmDeviceFd,
|
||||
device::DrmDeviceInternal,
|
||||
device::atomic::{PropMapping, map_props},
|
||||
error::Error,
|
||||
plane_type, DrmDeviceFd,
|
||||
plane_type,
|
||||
},
|
||||
},
|
||||
utils::DevPath,
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
use std::os::unix::io::AsFd;
|
||||
use std::sync::Arc;
|
||||
|
||||
use drm::control::{connector, crtc, plane, Mode};
|
||||
use drm::control::{Mode, connector, crtc, plane};
|
||||
use drm::{Device, DriverCapability};
|
||||
use indexmap::IndexSet;
|
||||
|
||||
use crate::backend::SwapBuffersError;
|
||||
use crate::backend::allocator::dmabuf::{AsDmabuf, Dmabuf};
|
||||
use crate::backend::allocator::format::get_opaque;
|
||||
use crate::backend::allocator::gbm::{GbmBuffer, GbmConvertError};
|
||||
use crate::backend::allocator::{Allocator, Format, Fourcc, Modifier, Slot, Swapchain};
|
||||
use crate::backend::drm::error::AccessError;
|
||||
use crate::backend::drm::gbm::{framebuffer_from_bo, GbmFramebuffer};
|
||||
use crate::backend::drm::{plane_has_property, DrmError, DrmSurface};
|
||||
use crate::backend::drm::gbm::{GbmFramebuffer, framebuffer_from_bo};
|
||||
use crate::backend::drm::{DrmError, DrmSurface, plane_has_property};
|
||||
use crate::backend::renderer::sync::SyncPoint;
|
||||
use crate::backend::SwapBuffersError;
|
||||
use crate::utils::{DevPath, Physical, Rectangle, Transform};
|
||||
|
||||
use tracing::{debug, info_span, instrument, trace, warn};
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
use drm::control::{connector, crtc, encoder, framebuffer, Device as ControlDevice, Mode, PageFlipFlags};
|
||||
use drm::control::{Device as ControlDevice, Mode, PageFlipFlags, connector, crtc, encoder, framebuffer};
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, Mutex, RwLock,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
|
||||
use crate::backend::drm::error::AccessError;
|
||||
use crate::{
|
||||
backend::drm::{
|
||||
device::legacy::set_connector_state, device::DrmDeviceInternal, error::Error, DrmDeviceFd,
|
||||
DrmDeviceFd, device::DrmDeviceInternal, device::legacy::set_connector_state, error::Error,
|
||||
},
|
||||
utils::DevPath,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use std::io;
|
||||
use std::os::unix::io::{AsFd, BorrowedFd};
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use drm::control::{connector, crtc, framebuffer, plane, Device as ControlDevice, Mode};
|
||||
use drm::Device as BasicDevice;
|
||||
use drm::control::{Device as ControlDevice, Mode, connector, crtc, framebuffer, plane};
|
||||
|
||||
use libc::dev_t;
|
||||
|
||||
|
|
@ -13,8 +13,8 @@ pub(super) mod atomic;
|
|||
pub(super) mod gbm;
|
||||
pub(super) mod legacy;
|
||||
use super::{
|
||||
device::PlaneClaimStorage, error::Error, plane_type, DrmDeviceFd, PlaneClaim, PlaneInfo, PlaneType,
|
||||
Planes,
|
||||
DrmDeviceFd, PlaneClaim, PlaneInfo, PlaneType, Planes, device::PlaneClaimStorage, error::Error,
|
||||
plane_type,
|
||||
};
|
||||
use crate::utils::DevPath;
|
||||
use crate::utils::{Buffer, Physical, Point, Rectangle, Transform};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
//! EGL context related structs
|
||||
use std::{
|
||||
os::raw::c_int,
|
||||
sync::{atomic::Ordering, Arc},
|
||||
sync::{Arc, atomic::Ordering},
|
||||
};
|
||||
|
||||
use libc::c_void;
|
||||
|
||||
use super::{ffi, wrap_egl_call_bool, wrap_egl_call_ptr, EGLError, Error, MakeCurrentError};
|
||||
use super::{EGLError, Error, MakeCurrentError, ffi, wrap_egl_call_bool, wrap_egl_call_ptr};
|
||||
use crate::{
|
||||
backend::{
|
||||
allocator::format::FormatSet,
|
||||
egl::{
|
||||
display::{EGLDisplay, PixelFormat},
|
||||
EGLSurface,
|
||||
display::{EGLDisplay, PixelFormat},
|
||||
},
|
||||
},
|
||||
utils::user_data::UserDataMap,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
use std::{ffi::CStr, os::raw::c_void, path::PathBuf, ptr};
|
||||
|
||||
use super::{
|
||||
EGLDisplay, EGLError, Error,
|
||||
ffi::{self, egl::types::EGLDeviceEXT},
|
||||
wrap_egl_call_bool, wrap_egl_call_ptr, EGLDisplay, EGLError, Error,
|
||||
wrap_egl_call_bool, wrap_egl_call_ptr,
|
||||
};
|
||||
|
||||
#[cfg(feature = "backend_drm")]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
ffi::{c_int, CStr},
|
||||
ffi::{CStr, c_int},
|
||||
hash::{Hash, Hasher},
|
||||
mem::MaybeUninit,
|
||||
ops::Deref,
|
||||
|
|
@ -13,7 +13,7 @@ use std::{
|
|||
use indexmap::IndexSet;
|
||||
use libc::c_void;
|
||||
#[cfg(all(feature = "use_system_lib", feature = "wayland_frontend"))]
|
||||
use wayland_server::{protocol::wl_buffer::WlBuffer, DisplayHandle, Resource};
|
||||
use wayland_server::{DisplayHandle, Resource, protocol::wl_buffer::WlBuffer};
|
||||
#[cfg(all(feature = "use_system_lib", feature = "wayland_frontend"))]
|
||||
use wayland_sys::server::wl_display;
|
||||
|
||||
|
|
@ -24,13 +24,14 @@ use crate::backend::egl::EGLDevice;
|
|||
use crate::backend::egl::{BufferAccessError, EGLBuffer, Format};
|
||||
use crate::{
|
||||
backend::{
|
||||
allocator::{dmabuf::Dmabuf, Buffer as _, Format as DrmFormat, Fourcc, Modifier},
|
||||
allocator::{Buffer as _, Format as DrmFormat, Fourcc, Modifier, dmabuf::Dmabuf},
|
||||
egl::{
|
||||
EGLError, Error,
|
||||
context::{GlAttributes, PixelFormatRequirements},
|
||||
ffi,
|
||||
ffi::egl::types::EGLImage,
|
||||
native::EGLNativeDisplay,
|
||||
wrap_egl_call_bool, wrap_egl_call_ptr, EGLError, Error,
|
||||
wrap_egl_call_bool, wrap_egl_call_ptr,
|
||||
},
|
||||
},
|
||||
utils::{Buffer as BufferCoords, Size},
|
||||
|
|
@ -181,7 +182,8 @@ unsafe fn select_platform_display<N: EGLNativeDisplay + 'static>(
|
|||
|
||||
if !missing_extensions.is_empty() {
|
||||
info!(
|
||||
"Skipping EGL platform because one or more required extensions are not supported. Missing extensions: {:?}", missing_extensions
|
||||
"Skipping EGL platform because one or more required extensions are not supported. Missing extensions: {:?}",
|
||||
missing_extensions
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1077,13 +1079,13 @@ impl EGLBufferReader {
|
|||
x if x == ffi::egl::TEXTURE_RGBA as i32 => Format::RGBA,
|
||||
ffi::egl::TEXTURE_EXTERNAL_WL => Format::External,
|
||||
ffi::egl::TEXTURE_Y_UV_WL => {
|
||||
return Err(BufferAccessError::UnsupportedMultiPlanarFormat(Format::Y_UV))
|
||||
return Err(BufferAccessError::UnsupportedMultiPlanarFormat(Format::Y_UV));
|
||||
}
|
||||
ffi::egl::TEXTURE_Y_U_V_WL => {
|
||||
return Err(BufferAccessError::UnsupportedMultiPlanarFormat(Format::Y_U_V))
|
||||
return Err(BufferAccessError::UnsupportedMultiPlanarFormat(Format::Y_U_V));
|
||||
}
|
||||
ffi::egl::TEXTURE_Y_XUXV_WL => {
|
||||
return Err(BufferAccessError::UnsupportedMultiPlanarFormat(Format::Y_XUXV))
|
||||
return Err(BufferAccessError::UnsupportedMultiPlanarFormat(Format::Y_XUXV));
|
||||
}
|
||||
x => panic!("EGL returned invalid texture type: {x}"),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,10 +31,14 @@ pub enum Error {
|
|||
#[error("Failed to configure the EGL context")]
|
||||
ConfigFailed(#[source] EGLError),
|
||||
/// Context creation failed as one or more requirements could not be met. Try removing some gl attributes or pixel format requirements
|
||||
#[error("Context creation failed as one or more requirements could not be met. Try removing some gl attributes or pixel format requirements. Err: {0:}")]
|
||||
#[error(
|
||||
"Context creation failed as one or more requirements could not be met. Try removing some gl attributes or pixel format requirements. Err: {0:}"
|
||||
)]
|
||||
CreationFailed(#[source] EGLError),
|
||||
/// The required EGL extension is not supported by the underlying EGL implementation
|
||||
#[error("None of the following EGL extensions is supported by the underlying EGL implementation, at least one is required: {0:?}")]
|
||||
#[error(
|
||||
"None of the following EGL extensions is supported by the underlying EGL implementation, at least one is required: {0:?}"
|
||||
)]
|
||||
EglExtensionNotSupported(&'static [&'static str]),
|
||||
/// Only one EGLDisplay may be bound to a given `WlDisplay` at any time
|
||||
#[error("Only one EGLDisplay may be bound to a given `WlDisplay` at any time")]
|
||||
|
|
@ -69,9 +73,7 @@ pub enum Error {
|
|||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum EGLError {
|
||||
/// EGL is not initialized, or could not be initialized, for the specified EGL display connection.
|
||||
#[error(
|
||||
"EGL is not initialized, or could not be initialized, for the specified EGL display connection."
|
||||
)]
|
||||
#[error("EGL is not initialized, or could not be initialized, for the specified EGL display connection.")]
|
||||
NotInitialized,
|
||||
/// EGL cannot access a requested resource (for example a context is bound in another thread).
|
||||
#[error("EGL cannot access a requested resource (for example a context is bound in another thread).")]
|
||||
|
|
@ -89,7 +91,9 @@ pub enum EGLError {
|
|||
#[error("An EGLConfig argument does not name a valid EGL frame buffer configuration.")]
|
||||
BadConfig,
|
||||
/// The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid.
|
||||
#[error("The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid.")]
|
||||
#[error(
|
||||
"The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid."
|
||||
)]
|
||||
BadCurrentSurface,
|
||||
/// An EGLDevice argument is not valid for this display.
|
||||
#[error("An EGLDevice argument is not valid for this display.")]
|
||||
|
|
@ -98,10 +102,14 @@ pub enum EGLError {
|
|||
#[error("An EGLDisplay argument does not name a valid EGL display connection.")]
|
||||
BadDisplay,
|
||||
/// An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.
|
||||
#[error("An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.")]
|
||||
#[error(
|
||||
"An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering."
|
||||
)]
|
||||
BadSurface,
|
||||
/// Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface).
|
||||
#[error("Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface).")]
|
||||
#[error(
|
||||
"Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface)."
|
||||
)]
|
||||
BadMatch,
|
||||
/// One or more argument values are invalid.
|
||||
#[error("One or more argument values are invalid.")]
|
||||
|
|
@ -113,10 +121,14 @@ pub enum EGLError {
|
|||
#[error("A NativeWindowType argument does not refer to a valid native window.")]
|
||||
BadNativeWindow,
|
||||
/// The EGL operation failed due to temporary unavailability of a requested resource, but the arguments were otherwise valid, and a subsequent attempt may succeed.
|
||||
#[error("The EGL operation failed due to temporary unavailability of a requested resource, but the arguments were otherwise valid, and a subsequent attempt may succeed.")]
|
||||
#[error(
|
||||
"The EGL operation failed due to temporary unavailability of a requested resource, but the arguments were otherwise valid, and a subsequent attempt may succeed."
|
||||
)]
|
||||
ResourceBusy,
|
||||
/// A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering.
|
||||
#[error("A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering.")]
|
||||
#[error(
|
||||
"A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering."
|
||||
)]
|
||||
ContextLost,
|
||||
/// An unknown error
|
||||
#[error("An unknown error ({0:x})")]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use std::sync::Arc;
|
|||
use std::time::Duration;
|
||||
|
||||
use crate::backend::egl::{
|
||||
ffi, wrap_egl_call, wrap_egl_call_bool, wrap_egl_call_ptr, EGLDisplay, EGLDisplayHandle, Error,
|
||||
EGLDisplay, EGLDisplayHandle, Error, ffi, wrap_egl_call, wrap_egl_call_bool, wrap_egl_call_ptr,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ pub mod egl {
|
|||
}
|
||||
|
||||
mod wayland_storage {
|
||||
use super::{FnPtr, __gl_imports::raw};
|
||||
use super::{__gl_imports::raw, FnPtr};
|
||||
pub static mut BindWaylandDisplayWL: FnPtr = FnPtr {
|
||||
f: super::missing_fn_panic as *const raw::c_void,
|
||||
is_loaded: false,
|
||||
|
|
@ -255,8 +255,8 @@ pub mod egl {
|
|||
|
||||
#[allow(non_snake_case)]
|
||||
pub mod DebugMessageControlKHR {
|
||||
use super::FnPtr;
|
||||
use super::__gl_imports::raw;
|
||||
use super::FnPtr;
|
||||
use super::{metaloadfn, wayland_storage};
|
||||
|
||||
#[inline]
|
||||
|
|
@ -279,7 +279,7 @@ pub mod egl {
|
|||
|
||||
#[allow(non_snake_case)]
|
||||
pub mod BindWaylandDisplayWL {
|
||||
use super::{FnPtr, __gl_imports::raw, metaloadfn, wayland_storage};
|
||||
use super::{__gl_imports::raw, FnPtr, metaloadfn, wayland_storage};
|
||||
|
||||
#[inline]
|
||||
#[allow(dead_code)]
|
||||
|
|
@ -301,7 +301,7 @@ pub mod egl {
|
|||
|
||||
#[allow(non_snake_case)]
|
||||
pub mod UnbindWaylandDisplayWL {
|
||||
use super::{FnPtr, __gl_imports::raw, metaloadfn, wayland_storage};
|
||||
use super::{__gl_imports::raw, FnPtr, metaloadfn, wayland_storage};
|
||||
|
||||
#[inline]
|
||||
#[allow(dead_code)]
|
||||
|
|
@ -323,7 +323,7 @@ pub mod egl {
|
|||
|
||||
#[allow(non_snake_case)]
|
||||
pub mod QueryWaylandBufferWL {
|
||||
use super::{FnPtr, __gl_imports::raw, metaloadfn, wayland_storage};
|
||||
use super::{__gl_imports::raw, FnPtr, metaloadfn, wayland_storage};
|
||||
|
||||
#[inline]
|
||||
#[allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
#[cfg(feature = "backend_winit")]
|
||||
use super::wrap_egl_call_ptr;
|
||||
use super::{
|
||||
EGLDevice, SwapBuffersError,
|
||||
display::{DamageSupport, EGLDisplayHandle},
|
||||
ffi, wrap_egl_call_bool, EGLDevice, SwapBuffersError,
|
||||
ffi, wrap_egl_call_bool,
|
||||
};
|
||||
#[cfg(feature = "backend_gbm")]
|
||||
use crate::utils::DevPath;
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
use std::fmt;
|
||||
use std::sync::{
|
||||
atomic::{AtomicPtr, Ordering},
|
||||
Arc,
|
||||
atomic::{AtomicPtr, Ordering},
|
||||
};
|
||||
|
||||
use crate::backend::egl::{
|
||||
EGLError, SwapBuffersError,
|
||||
display::{DamageSupport, EGLDisplay, EGLDisplayHandle, PixelFormat},
|
||||
ffi,
|
||||
native::EGLNativeSurface,
|
||||
EGLError, SwapBuffersError,
|
||||
};
|
||||
use crate::utils::{Physical, Rectangle, Size};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use crate::backend::input::{
|
|||
|
||||
use input as libinput;
|
||||
use input::event;
|
||||
use input::event::{tablet_tool, EventTrait};
|
||||
use input::event::{EventTrait, tablet_tool};
|
||||
|
||||
use super::LibinputInputBackend;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,20 +100,20 @@ use std::{
|
|||
};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
use tracing::{info_span, instrument, trace, warn};
|
||||
|
||||
use crate::{
|
||||
backend::renderer::{element::RenderElementPresentationState, Frame},
|
||||
backend::renderer::{Frame, element::RenderElementPresentationState},
|
||||
output::{Output, OutputModeSource, OutputNoMode},
|
||||
utils::{user_data::UserDataMap, Buffer as BufferCoords, Physical, Rectangle, Scale, Size, Transform},
|
||||
utils::{Buffer as BufferCoords, Physical, Rectangle, Scale, Size, Transform, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
use super::{
|
||||
Color32F,
|
||||
element::{Element, Id, RenderElement, RenderElementState, RenderElementStates},
|
||||
sync::SyncPoint,
|
||||
utils::CommitCounter,
|
||||
Color32F,
|
||||
};
|
||||
|
||||
use super::{Renderer, Texture};
|
||||
|
|
@ -863,8 +863,7 @@ impl OutputDamageTracker {
|
|||
|
||||
trace!(
|
||||
"rendering with damage {:?} and opaque regions {:?}",
|
||||
self.damage,
|
||||
self.opaque_regions
|
||||
self.damage, self.opaque_regions
|
||||
);
|
||||
|
||||
let render_res = (|| {
|
||||
|
|
@ -907,8 +906,7 @@ impl OutputDamageTracker {
|
|||
if element_damage.is_empty() {
|
||||
trace!(
|
||||
"skipping rendering element {:?} with geometry {:?}, no damage",
|
||||
element_id,
|
||||
element_geometry
|
||||
element_id, element_geometry
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -926,9 +924,7 @@ impl OutputDamageTracker {
|
|||
|
||||
trace!(
|
||||
"rendering element {:?} with geometry {:?} and damage {:?}",
|
||||
element_id,
|
||||
element_geometry,
|
||||
element_damage,
|
||||
element_id, element_geometry, element_damage,
|
||||
);
|
||||
|
||||
let element_src = element.src();
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@
|
|||
|
||||
use std::{
|
||||
any::Any,
|
||||
collections::{hash_map::Entry, HashMap},
|
||||
collections::{HashMap, hash_map::Entry},
|
||||
sync::{Arc, Mutex, MutexGuard},
|
||||
};
|
||||
|
||||
|
|
@ -113,13 +113,13 @@ use tracing::{instrument, trace, warn};
|
|||
|
||||
use crate::{
|
||||
backend::{
|
||||
allocator::{format::get_bpp, Fourcc},
|
||||
allocator::{Fourcc, format::get_bpp},
|
||||
renderer::{
|
||||
utils::{CommitCounter, DamageBag, DamageSet, DamageSnapshot, OpaqueRegions},
|
||||
ErasedContextId, Frame, ImportMem, Renderer,
|
||||
utils::{CommitCounter, DamageBag, DamageSet, DamageSnapshot, OpaqueRegions},
|
||||
},
|
||||
},
|
||||
utils::{user_data::UserDataMap, Buffer, Logical, Physical, Point, Rectangle, Scale, Size, Transform},
|
||||
utils::{Buffer, Logical, Physical, Point, Rectangle, Scale, Size, Transform, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
use super::{Element, Id, Kind, RenderElement, UnderlyingStorage};
|
||||
|
|
|
|||
|
|
@ -25,18 +25,18 @@ use std::{
|
|||
};
|
||||
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
use wayland_server::{backend::ObjectId, Resource};
|
||||
use wayland_server::{Resource, backend::ObjectId};
|
||||
|
||||
use crate::{
|
||||
output::{Output, WeakOutput},
|
||||
utils::{user_data::UserDataMap, Buffer as BufferCoords, Physical, Point, Rectangle, Scale, Transform},
|
||||
utils::{Buffer as BufferCoords, Physical, Point, Rectangle, Scale, Transform, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
use super::utils::Buffer;
|
||||
use super::{
|
||||
utils::{CommitCounter, DamageSet, OpaqueRegions},
|
||||
Renderer,
|
||||
utils::{CommitCounter, DamageSet, OpaqueRegions},
|
||||
};
|
||||
|
||||
pub mod memory;
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@
|
|||
//! ```
|
||||
use crate::{
|
||||
backend::renderer::{
|
||||
utils::{CommitCounter, OpaqueRegions},
|
||||
Color32F, Frame, Renderer,
|
||||
utils::{CommitCounter, OpaqueRegions},
|
||||
},
|
||||
utils::{user_data::UserDataMap, Buffer, Logical, Physical, Point, Rectangle, Scale, Size, Transform},
|
||||
utils::{Buffer, Logical, Physical, Point, Rectangle, Scale, Size, Transform, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
use super::{AsRenderElements, Element, Id, Kind, RenderElement};
|
||||
|
|
|
|||
|
|
@ -69,15 +69,15 @@ use wayland_server::protocol::wl_surface;
|
|||
|
||||
use crate::{
|
||||
backend::renderer::{
|
||||
Color32F, Frame, ImportAll, Renderer, Texture,
|
||||
utils::{
|
||||
Buffer, DamageSet, DamageSnapshot, OpaqueRegions, RendererSurfaceState,
|
||||
RendererSurfaceStateUserData, SurfaceView,
|
||||
},
|
||||
Color32F, Frame, ImportAll, Renderer, Texture,
|
||||
},
|
||||
utils::{
|
||||
user_data::UserDataMap, Buffer as BufferCoords, Logical, Physical, Point, Rectangle, Scale, Size,
|
||||
Transform,
|
||||
Buffer as BufferCoords, Logical, Physical, Point, Rectangle, Scale, Size, Transform,
|
||||
user_data::UserDataMap,
|
||||
},
|
||||
wayland::{
|
||||
alpha_modifier::AlphaModifierSurfaceCachedState,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
use crate::{
|
||||
backend::renderer::{gles::GlesRenderer, ImportDma, ImportMem, Renderer, Texture},
|
||||
utils::{user_data::UserDataMap, Buffer, Physical, Point, Rectangle, Scale},
|
||||
backend::renderer::{ImportDma, ImportMem, Renderer, Texture, gles::GlesRenderer},
|
||||
utils::{Buffer, Physical, Point, Rectangle, Scale, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
use super::{CommitCounter, Element, Id, RenderElement, Wrap};
|
||||
|
|
|
|||
|
|
@ -202,13 +202,13 @@ use crate::{
|
|||
backend::{
|
||||
allocator::Fourcc,
|
||||
renderer::{
|
||||
utils::{DamageBag, DamageSet, DamageSnapshot, OpaqueRegions},
|
||||
ContextId, Frame, ImportMem, Renderer, Texture,
|
||||
utils::{DamageBag, DamageSet, DamageSnapshot, OpaqueRegions},
|
||||
},
|
||||
},
|
||||
utils::{
|
||||
user_data::UserDataMap, Buffer, Coordinate, Logical, Physical, Point, Rectangle, Scale, Size,
|
||||
Transform,
|
||||
Buffer, Coordinate, Logical, Physical, Point, Rectangle, Scale, Size, Transform,
|
||||
user_data::UserDataMap,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
use crate::{
|
||||
backend::renderer::{
|
||||
Renderer,
|
||||
element::{AsRenderElements, Element, Id, Kind, RenderElement, UnderlyingStorage},
|
||||
utils::{DamageSet, OpaqueRegions},
|
||||
Renderer,
|
||||
},
|
||||
utils::{user_data::UserDataMap, Buffer, Physical, Point, Rectangle, Scale},
|
||||
utils::{Buffer, Physical, Point, Rectangle, Scale, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
/// A element that allows to re-scale another element
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
use crate::{
|
||||
backend::renderer::{
|
||||
element::{texture::TextureRenderElement, Element, Id, Kind, RenderElement, UnderlyingStorage},
|
||||
element::{Element, Id, Kind, RenderElement, UnderlyingStorage, texture::TextureRenderElement},
|
||||
utils::{CommitCounter, DamageSet, OpaqueRegions},
|
||||
},
|
||||
utils::{user_data::UserDataMap, Buffer, Logical, Physical, Point, Rectangle, Scale, Transform},
|
||||
utils::{Buffer, Logical, Physical, Point, Rectangle, Scale, Transform, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
use super::{GlesError, GlesFrame, GlesPixelProgram, GlesRenderer, GlesTexProgram, GlesTexture, Uniform};
|
||||
|
|
|
|||
|
|
@ -20,15 +20,17 @@ pub enum GlesError {
|
|||
#[error("Failed to load GL functions from EGL")]
|
||||
GLFunctionLoaderError,
|
||||
/// Required GL extension are not supported by the underlying implementation
|
||||
#[error("None of the following GL extensions is supported by the underlying GL implementation, at least one is required: {0:?}")]
|
||||
#[error(
|
||||
"None of the following GL extensions is supported by the underlying GL implementation, at least one is required: {0:?}"
|
||||
)]
|
||||
GLExtensionNotSupported(&'static [&'static str]),
|
||||
/// Required EGL extension are not supported by the underlying implementation
|
||||
#[error("None of the following EGL extensions is supported by the underlying implementation, at least one is required: {0:?}")]
|
||||
#[error(
|
||||
"None of the following EGL extensions is supported by the underlying implementation, at least one is required: {0:?}"
|
||||
)]
|
||||
EGLExtensionNotSupported(&'static [&'static str]),
|
||||
/// Required GL version is not available by the underlying implementation
|
||||
#[error(
|
||||
"The OpenGL ES version of the underlying GL implementation is too low, at least required: {0:?}"
|
||||
)]
|
||||
#[error("The OpenGL ES version of the underlying GL implementation is too low, at least required: {0:?}")]
|
||||
GLVersionNotSupported(version::GlVersion),
|
||||
/// The underlying egl context could not be activated
|
||||
#[error("Failed to active egl context")]
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
use super::ffi::{self, types::GLenum};
|
||||
use crate::backend::allocator::{
|
||||
format::{get_transparent, has_alpha},
|
||||
Fourcc,
|
||||
format::{get_transparent, has_alpha},
|
||||
};
|
||||
|
||||
/// Returns (internal_format, read_format, type)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! Implementation of the rendering traits using OpenGL ES 2
|
||||
|
||||
use cgmath::{prelude::*, Matrix3, Vector2};
|
||||
use cgmath::{Matrix3, Vector2, prelude::*};
|
||||
use core::slice;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
|
|
@ -12,12 +12,12 @@ use std::{
|
|||
ptr,
|
||||
rc::Rc,
|
||||
sync::{
|
||||
Arc, Mutex, RwLock, RwLockWriteGuard, TryLockError,
|
||||
atomic::{AtomicBool, AtomicPtr, Ordering},
|
||||
mpsc::{self, Sender},
|
||||
Arc, Mutex, RwLock, RwLockWriteGuard, TryLockError,
|
||||
},
|
||||
};
|
||||
use tracing::{debug, error, info, info_span, instrument, span, span::EnteredSpan, trace, warn, Level};
|
||||
use tracing::{Level, debug, error, info, info_span, instrument, span, span::EnteredSpan, trace, warn};
|
||||
|
||||
pub mod element;
|
||||
mod error;
|
||||
|
|
@ -40,20 +40,20 @@ use profiler::SpanLocation;
|
|||
use self::version::GlVersion;
|
||||
|
||||
use super::{
|
||||
sync::SyncPoint, Bind, Blit, BlitFrame, Color32F, ContextId, DebugFlags, ExportMem, Frame, ImportDma,
|
||||
ImportMem, Offscreen, Renderer, RendererSuper, Texture, TextureFilter, TextureMapping,
|
||||
Bind, Blit, BlitFrame, Color32F, ContextId, DebugFlags, ExportMem, Frame, ImportDma, ImportMem,
|
||||
Offscreen, Renderer, RendererSuper, Texture, TextureFilter, TextureMapping, sync::SyncPoint,
|
||||
};
|
||||
use crate::{
|
||||
backend::{
|
||||
allocator::{
|
||||
dmabuf::{Dmabuf, WeakDmabuf},
|
||||
format::{get_bpp, get_opaque, has_alpha, FormatSet},
|
||||
Buffer, Format, Fourcc,
|
||||
dmabuf::{Dmabuf, WeakDmabuf},
|
||||
format::{FormatSet, get_bpp, get_opaque, has_alpha},
|
||||
},
|
||||
egl::{
|
||||
EGLContext, EGLDevice, EGLSurface, MakeCurrentError,
|
||||
fence::EGLFence,
|
||||
ffi::egl::{self as ffi_egl, types::EGLImage},
|
||||
EGLContext, EGLDevice, EGLSurface, MakeCurrentError,
|
||||
},
|
||||
},
|
||||
utils::{Buffer as BufferCoord, Physical, Rectangle, Size, Transform},
|
||||
|
|
@ -64,7 +64,7 @@ use super::ImportEgl;
|
|||
#[cfg(feature = "wayland_frontend")]
|
||||
use super::{ImportDmaWl, ImportMemWl};
|
||||
#[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))]
|
||||
use crate::backend::egl::{display::EGLBufferReader, Format as EGLFormat};
|
||||
use crate::backend::egl::{Format as EGLFormat, display::EGLBufferReader};
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
use crate::wayland::shm::shm_format_to_fourcc;
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
|
|
@ -245,9 +245,7 @@ impl GlesTargetInternal<'_> {
|
|||
} else {
|
||||
egl.make_current()?;
|
||||
match self {
|
||||
GlesTargetInternal::Image { buf, .. } => {
|
||||
gl.BindFramebuffer(ffi::FRAMEBUFFER, buf.0.fbo)
|
||||
}
|
||||
GlesTargetInternal::Image { buf, .. } => gl.BindFramebuffer(ffi::FRAMEBUFFER, buf.0.fbo),
|
||||
GlesTargetInternal::Texture { fbo, .. } => gl.BindFramebuffer(ffi::FRAMEBUFFER, *fbo),
|
||||
GlesTargetInternal::Renderbuffer { fbo, .. } => {
|
||||
gl.BindFramebuffer(ffi::FRAMEBUFFER, *fbo)
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ mod imp {
|
|||
|
||||
use tracing::warn;
|
||||
|
||||
use super::{ffi, GpuSpan, SpanLocation};
|
||||
use super::{GpuSpan, SpanLocation, ffi};
|
||||
|
||||
// Number of timestamp queries in the pool. Limited by Tracy's use of u16 for query IDs.
|
||||
const MAX_QUERIES: usize = u16::MAX as usize;
|
||||
|
|
@ -288,7 +288,7 @@ mod imp {
|
|||
|
||||
#[cfg(not(feature = "tracy_gpu_profiling"))]
|
||||
mod imp {
|
||||
use super::{ffi, GpuSpan, SpanLocation};
|
||||
use super::{GpuSpan, SpanLocation, ffi};
|
||||
|
||||
pub struct GpuProfiler(());
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,17 @@ use crate::backend::renderer::{ImportDmaWl, ImportMemWl};
|
|||
use crate::backend::{egl::display::EGLBufferReader, renderer::ImportEgl};
|
||||
use crate::{
|
||||
backend::{
|
||||
allocator::{dmabuf::Dmabuf, format::FormatSet, Format, Fourcc},
|
||||
allocator::{Format, Fourcc, dmabuf::Dmabuf, format::FormatSet},
|
||||
egl::EGLContext,
|
||||
renderer::{
|
||||
Bind, Blit, BlitFrame, Color32F, DebugFlags, ExportMem, ImportDma, ImportMem, Offscreen,
|
||||
Renderer, RendererSuper, TextureFilter,
|
||||
element::UnderlyingStorage,
|
||||
gles::{element::*, *},
|
||||
sync, Bind, Blit, BlitFrame, Color32F, DebugFlags, ExportMem, ImportDma, ImportMem, Offscreen,
|
||||
Renderer, RendererSuper, TextureFilter,
|
||||
sync,
|
||||
},
|
||||
},
|
||||
utils::{user_data::UserDataMap, Buffer as BufferCoord, Physical, Rectangle, Size, Transform},
|
||||
utils::{Buffer as BufferCoord, Physical, Rectangle, Size, Transform, user_data::UserDataMap},
|
||||
};
|
||||
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
|
|
@ -32,7 +33,7 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use super::{element::RenderElement, ContextId, Frame, FrameContext};
|
||||
use super::{ContextId, Frame, FrameContext, element::RenderElement};
|
||||
|
||||
#[derive(Debug)]
|
||||
/// A renderer utilizing OpenGL ES 2 and [`glow`] on top for easier custom rendering.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
//!
|
||||
//! - Raw OpenGL ES 2
|
||||
|
||||
use crate::utils::{ids::id_gen, Buffer as BufferCoord, Physical, Point, Rectangle, Scale, Size, Transform};
|
||||
use crate::utils::{Buffer as BufferCoord, Physical, Point, Rectangle, Scale, Size, Transform, ids::id_gen};
|
||||
use cgmath::Matrix3;
|
||||
use std::{
|
||||
any::TypeId,
|
||||
|
|
@ -36,15 +36,15 @@ pub mod pixman;
|
|||
mod color;
|
||||
pub use color::Color32F;
|
||||
|
||||
use crate::backend::allocator::{dmabuf::Dmabuf, Format, Fourcc};
|
||||
use crate::backend::allocator::{Format, Fourcc, dmabuf::Dmabuf};
|
||||
#[cfg(all(
|
||||
feature = "wayland_frontend",
|
||||
feature = "backend_egl",
|
||||
feature = "use_system_lib"
|
||||
))]
|
||||
use crate::backend::egl::{
|
||||
display::{EGLBufferReader, BUFFER_READER},
|
||||
Error as EglError,
|
||||
display::{BUFFER_READER, EGLBufferReader},
|
||||
};
|
||||
|
||||
use super::allocator::format::FormatSet;
|
||||
|
|
@ -786,7 +786,7 @@ pub trait ExportMem: Renderer {
|
|||
/// This function *may* fail, if (but not limited to):
|
||||
/// - There is not enough space in memory
|
||||
fn map_texture<'a>(&mut self, texture_mapping: &'a Self::TextureMapping)
|
||||
-> Result<&'a [u8], Self::Error>;
|
||||
-> Result<&'a [u8], Self::Error>;
|
||||
}
|
||||
|
||||
/// Trait for renderers supporting blitting contents from one framebuffer to another.
|
||||
|
|
|
|||
|
|
@ -6,19 +6,19 @@ use tracing::warn;
|
|||
use wayland_server::protocol::wl_buffer;
|
||||
|
||||
use crate::backend::{
|
||||
SwapBuffersError,
|
||||
allocator::{
|
||||
Allocator,
|
||||
dmabuf::{AnyError, Dmabuf, DmabufAllocator},
|
||||
gbm::{GbmAllocator, GbmBufferFlags, GbmDevice},
|
||||
Allocator,
|
||||
},
|
||||
drm::{CreateDrmNodeError, DrmNode},
|
||||
egl::{context::ContextPriority, EGLContext, EGLDisplay, Error as EGLError},
|
||||
egl::{EGLContext, EGLDisplay, Error as EGLError, context::ContextPriority},
|
||||
renderer::{
|
||||
Renderer, RendererSuper,
|
||||
gles::{GlesError, GlesRenderer},
|
||||
multigpu::{ApiDevice, Error as MultiError, GraphicsApi},
|
||||
Renderer, RendererSuper,
|
||||
},
|
||||
SwapBuffersError,
|
||||
};
|
||||
#[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))]
|
||||
use crate::{
|
||||
|
|
@ -26,8 +26,8 @@ use crate::{
|
|||
allocator::Buffer as BufferTrait,
|
||||
egl::display::EGLBufferReader,
|
||||
renderer::{
|
||||
multigpu::{import_dmabuf_internal, Error as MultigpuError, MultiRenderer, MultiTexture},
|
||||
Bind, ExportMem, ImportDma, ImportEgl, ImportMem,
|
||||
multigpu::{Error as MultigpuError, MultiRenderer, MultiTexture, import_dmabuf_internal},
|
||||
},
|
||||
},
|
||||
utils::{Buffer as BufferCoords, Rectangle},
|
||||
|
|
@ -153,10 +153,8 @@ impl<R, A: AsFd + Clone + Send + 'static> GbmGlesBackend<R, A> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<
|
||||
R: From<GlesRenderer> + Renderer<Error = GlesError> + Borrow<GlesRenderer>,
|
||||
A: AsFd + Clone + 'static,
|
||||
> GraphicsApi for GbmGlesBackend<R, A>
|
||||
impl<R: From<GlesRenderer> + Renderer<Error = GlesError> + Borrow<GlesRenderer>, A: AsFd + Clone + 'static>
|
||||
GraphicsApi for GbmGlesBackend<R, A>
|
||||
{
|
||||
type Device = GbmGlesDevice<R>;
|
||||
type Error = Error;
|
||||
|
|
@ -223,10 +221,10 @@ impl<
|
|||
|
||||
// TODO: Replace with specialization impl in multigpu/mod once possible
|
||||
impl<
|
||||
T: GraphicsApi,
|
||||
R: From<GlesRenderer> + Renderer<Error = GlesError> + Borrow<GlesRenderer>,
|
||||
A: AsFd + Clone + 'static,
|
||||
> std::convert::From<GlesError> for MultiError<GbmGlesBackend<R, A>, T>
|
||||
T: GraphicsApi,
|
||||
R: From<GlesRenderer> + Renderer<Error = GlesError> + Borrow<GlesRenderer>,
|
||||
A: AsFd + Clone + 'static,
|
||||
> std::convert::From<GlesError> for MultiError<GbmGlesBackend<R, A>, T>
|
||||
where
|
||||
T::Error: 'static,
|
||||
<<T::Device as ApiDevice>::Renderer as RendererSuper>::Error: 'static,
|
||||
|
|
|
|||
|
|
@ -48,28 +48,28 @@ use std::{
|
|||
};
|
||||
|
||||
use super::{
|
||||
sync::{self, SyncPoint},
|
||||
Bind, Blit, BlitFrame, Color32F, ContextId, DebugFlags, ErasedContextId, ExportMem, Frame, ImportDma,
|
||||
ImportMem, Offscreen, Renderer, RendererSuper, Texture, TextureFilter, TextureMapping,
|
||||
sync::{self, SyncPoint},
|
||||
};
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
use super::{ImportDmaWl, ImportMemWl};
|
||||
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
use crate::{
|
||||
backend::renderer::{buffer_type, BufferType},
|
||||
backend::renderer::{BufferType, buffer_type},
|
||||
wayland::{compositor::SurfaceData, dmabuf::get_dmabuf, shm},
|
||||
};
|
||||
use crate::{
|
||||
backend::{
|
||||
SwapBuffersError,
|
||||
allocator::{
|
||||
dmabuf::{AnyError, Dmabuf},
|
||||
format::{get_bpp, FormatSet},
|
||||
Allocator, Buffer as BufferTrait, Format, Fourcc, Modifier,
|
||||
dmabuf::{AnyError, Dmabuf},
|
||||
format::{FormatSet, get_bpp},
|
||||
},
|
||||
drm::DrmNode,
|
||||
renderer::FrameContext,
|
||||
SwapBuffersError,
|
||||
},
|
||||
utils::{Buffer as BufferCoords, Physical, Rectangle, Size, Transform},
|
||||
};
|
||||
|
|
@ -467,7 +467,7 @@ impl<A: GraphicsApi> GpuManager<A> {
|
|||
{
|
||||
use crate::{
|
||||
backend::renderer::utils::RendererSurfaceStateUserData,
|
||||
wayland::compositor::{with_surface_tree_upward, TraversalAction},
|
||||
wayland::compositor::{TraversalAction, with_surface_tree_upward},
|
||||
};
|
||||
|
||||
if self.devices.is_empty() {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ use drm_fourcc::{DrmFourcc, DrmModifier};
|
|||
use thiserror::Error;
|
||||
|
||||
use crate::backend::{
|
||||
allocator::dmabuf::{DmabufMappingFailed, DmabufSyncFailed},
|
||||
SwapBuffersError,
|
||||
allocator::dmabuf::{DmabufMappingFailed, DmabufSyncFailed},
|
||||
};
|
||||
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
//! Implementation of the rendering traits using pixman
|
||||
|
||||
use std::sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, LazyLock, Mutex,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
|
||||
use drm_fourcc::{DrmFormat, DrmFourcc, DrmModifier};
|
||||
|
|
@ -12,11 +12,11 @@ use tracing::warn;
|
|||
use crate::{
|
||||
backend::{
|
||||
allocator::{
|
||||
Buffer,
|
||||
dmabuf::{
|
||||
Dmabuf, DmabufMapping, DmabufMappingMode, DmabufSyncFailed, DmabufSyncFlags, WeakDmabuf,
|
||||
},
|
||||
format::{has_alpha, FormatSet},
|
||||
Buffer,
|
||||
format::{FormatSet, has_alpha},
|
||||
},
|
||||
renderer::FrameContext,
|
||||
},
|
||||
|
|
@ -38,8 +38,8 @@ use wayland_server::protocol::wl_buffer;
|
|||
))]
|
||||
use super::ImportEgl;
|
||||
use super::{
|
||||
sync::SyncPoint, Bind, Color32F, ContextId, DebugFlags, ExportMem, Frame, ImportDma, ImportMem,
|
||||
Offscreen, Renderer, RendererSuper, Texture, TextureFilter, TextureMapping,
|
||||
Bind, Color32F, ContextId, DebugFlags, ExportMem, Frame, ImportDma, ImportMem, Offscreen, Renderer,
|
||||
RendererSuper, Texture, TextureFilter, TextureMapping, sync::SyncPoint,
|
||||
};
|
||||
|
||||
mod error;
|
||||
|
|
@ -252,20 +252,20 @@ impl PixmanTexture {
|
|||
|
||||
impl Texture for PixmanTexture {
|
||||
fn width(&self) -> u32 {
|
||||
self.0 .0.image.lock().unwrap().width() as u32
|
||||
self.0.0.image.lock().unwrap().width() as u32
|
||||
}
|
||||
|
||||
fn height(&self) -> u32 {
|
||||
self.0 .0.image.lock().unwrap().height() as u32
|
||||
self.0.0.image.lock().unwrap().height() as u32
|
||||
}
|
||||
|
||||
fn size(&self) -> Size<i32, BufferCoords> {
|
||||
let lock = self.0 .0.image.lock().unwrap();
|
||||
let lock = self.0.0.image.lock().unwrap();
|
||||
Size::from((lock.width() as i32, lock.height() as i32))
|
||||
}
|
||||
|
||||
fn format(&self) -> Option<DrmFourcc> {
|
||||
DrmFourcc::try_from(self.0 .0.image.lock().unwrap().format()).ok()
|
||||
DrmFourcc::try_from(self.0.0.image.lock().unwrap().format()).ok()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -934,15 +934,15 @@ impl ImportMem for PixmanRenderer {
|
|||
region: Rectangle<i32, BufferCoords>,
|
||||
) -> Result<(), Self::Error> {
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
if texture.0 .0.buffer.is_some() {
|
||||
if texture.0.0.buffer.is_some() {
|
||||
return Err(PixmanError::ImportFailed);
|
||||
}
|
||||
|
||||
if texture.0 .0.dmabuf.is_some() {
|
||||
if texture.0.0.dmabuf.is_some() {
|
||||
return Err(PixmanError::ImportFailed);
|
||||
}
|
||||
|
||||
let mut image = texture.0 .0.image.lock().unwrap();
|
||||
let mut image = texture.0.0.image.lock().unwrap();
|
||||
let stride = image.stride();
|
||||
let expected_len = stride * image.height();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//! Helper for synchronizing rendering operations
|
||||
use std::{error::Error, fmt, os::unix::io::OwnedFd, sync::Arc};
|
||||
|
||||
use downcast_rs::{impl_downcast, Downcast};
|
||||
use downcast_rs::{Downcast, impl_downcast};
|
||||
|
||||
#[cfg(feature = "backend_egl")]
|
||||
mod egl;
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ use crate::{
|
|||
};
|
||||
use crate::{
|
||||
backend::{
|
||||
allocator::{dmabuf::Dmabuf, Fourcc},
|
||||
renderer::{
|
||||
sync::SyncPoint, DebugFlags, Frame, ImportDma, ImportMem, Renderer, RendererSuper, Texture,
|
||||
TextureFilter,
|
||||
},
|
||||
SwapBuffersError,
|
||||
allocator::{Fourcc, dmabuf::Dmabuf},
|
||||
renderer::{
|
||||
DebugFlags, Frame, ImportDma, ImportMem, Renderer, RendererSuper, Texture, TextureFilter,
|
||||
sync::SyncPoint,
|
||||
},
|
||||
},
|
||||
utils::{Buffer, Physical, Rectangle, Size, Transform},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
use crate::wayland::drm_syncobj::{DrmSyncPoint, DrmSyncobjCachedState};
|
||||
use crate::{
|
||||
backend::renderer::{
|
||||
buffer_dimensions, buffer_has_alpha, element::RenderElement, ContextId, ErasedContextId, ImportAll,
|
||||
Renderer, Texture,
|
||||
ContextId, ErasedContextId, ImportAll, Renderer, Texture, buffer_dimensions, buffer_has_alpha,
|
||||
element::RenderElement,
|
||||
},
|
||||
utils::{Buffer as BufferCoord, Coordinate, Logical, Physical, Point, Rectangle, Scale, Size, Transform},
|
||||
wayland::{
|
||||
compositor::{
|
||||
self, add_destruction_hook, is_sync_subsurface, with_surface_tree_downward,
|
||||
with_surface_tree_upward, BufferAssignment, Damage, RectangleKind, SubsurfaceCachedState,
|
||||
SurfaceAttributes, SurfaceData, TraversalAction,
|
||||
self, BufferAssignment, Damage, RectangleKind, SubsurfaceCachedState, SurfaceAttributes,
|
||||
SurfaceData, TraversalAction, add_destruction_hook, is_sync_subsurface,
|
||||
with_surface_tree_downward, with_surface_tree_upward,
|
||||
},
|
||||
viewporter,
|
||||
},
|
||||
|
|
@ -18,7 +18,7 @@ use crate::{
|
|||
|
||||
use std::{
|
||||
any::Any,
|
||||
collections::{hash_map::Entry, HashMap},
|
||||
collections::{HashMap, hash_map::Entry},
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@ use std::{
|
|||
path::Path,
|
||||
rc::{Rc, Weak},
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
},
|
||||
};
|
||||
|
||||
use rustix::{fs::OFlags, io::Errno};
|
||||
|
||||
use calloop::{
|
||||
channel::{self, Channel},
|
||||
EventSource, Poll, PostAction, Readiness, Token, TokenFactory,
|
||||
channel::{self, Channel},
|
||||
};
|
||||
|
||||
use crate::backend::session::{AsErrno, Event as SessionEvent, Session};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use std::{
|
|||
|
||||
use ash::{ext, vk};
|
||||
|
||||
use super::{version::Version, LoadError, LIBRARY};
|
||||
use super::{LIBRARY, LoadError, version::Version};
|
||||
|
||||
pub struct InstanceInner {
|
||||
pub instance: ash::Instance,
|
||||
|
|
|
|||
|
|
@ -72,10 +72,9 @@ use std::{
|
|||
};
|
||||
|
||||
use ash::{
|
||||
ext,
|
||||
Entry, ext,
|
||||
prelude::VkResult,
|
||||
vk::{self, PhysicalDeviceDriverProperties, PhysicalDeviceDrmPropertiesEXT},
|
||||
Entry,
|
||||
};
|
||||
use libc::c_void;
|
||||
use scopeguard::ScopeGuard;
|
||||
|
|
@ -675,8 +674,7 @@ fn get_env_or_max_version(max_version: Version) -> Version {
|
|||
if overridden_version > max_version {
|
||||
warn!(
|
||||
"Ignoring SMITHAY_VK_VERSION since the requested max version is higher than the maximum of {}.{}",
|
||||
max_version.major,
|
||||
max_version.minor
|
||||
max_version.major, max_version.minor
|
||||
);
|
||||
max_version
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use std::ffi::{CStr, CString};
|
|||
use ash::{ext, khr, prelude::VkResult, vk};
|
||||
use tracing::info_span;
|
||||
|
||||
use super::{version::Version, DriverInfo, PhdInfo, UnsupportedProperty};
|
||||
use super::{DriverInfo, PhdInfo, UnsupportedProperty, version::Version};
|
||||
|
||||
impl super::PhysicalDevice {
|
||||
/// # Safety:
|
||||
|
|
|
|||
|
|
@ -41,14 +41,15 @@ use winit::{
|
|||
use crate::{
|
||||
backend::{
|
||||
egl::{
|
||||
EGLContext, EGLSurface, Error as EGLError,
|
||||
context::{GlAttributes, PixelFormatRequirements},
|
||||
display::EGLDisplay,
|
||||
native, EGLContext, EGLSurface, Error as EGLError,
|
||||
native,
|
||||
},
|
||||
input::InputEvent,
|
||||
renderer::{
|
||||
gles::{GlesError, GlesRenderer},
|
||||
Bind,
|
||||
gles::{GlesError, GlesRenderer},
|
||||
},
|
||||
},
|
||||
utils::{Clock, Monotonic, Physical, Rectangle, Size},
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ use x11rb::{
|
|||
},
|
||||
};
|
||||
|
||||
use crate::backend::allocator::{dmabuf::Dmabuf, Buffer};
|
||||
use crate::backend::allocator::{Buffer, dmabuf::Dmabuf};
|
||||
|
||||
// Shm can be easily supported in the future using, xcb_shm_create_pixmap.
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,9 @@ pub enum MissingExtensionError {
|
|||
},
|
||||
|
||||
/// An extension was present, but the version is too low.
|
||||
#[error("Extension \"{name}\" version {required_major}.{required_minor} is required but only version {available_major}.{available_minor} is available.")]
|
||||
#[error(
|
||||
"Extension \"{name}\" version {required_major}.{required_minor} is required but only version {available_major}.{available_minor} is available."
|
||||
)]
|
||||
WrongVersion {
|
||||
/// The name of the extension.
|
||||
name: &'static str,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! Input backend implementation for the X11 backend.
|
||||
|
||||
use super::{window_inner::WindowInner, Window, WindowTemporary};
|
||||
use super::{Window, WindowTemporary, window_inner::WindowInner};
|
||||
use crate::{
|
||||
backend::input::{
|
||||
self, AbsolutePositionEvent, Axis, AxisRelativeDirection, AxisSource, ButtonState, Device,
|
||||
|
|
|
|||
|
|
@ -81,10 +81,10 @@ use crate::{
|
|||
backend::{
|
||||
allocator::{Allocator, Swapchain},
|
||||
drm::{CreateDrmNodeError, DrmNode, NodeType},
|
||||
egl::{native::X11DefaultDisplay, EGLDevice, EGLDisplay, Error as EGLError},
|
||||
egl::{EGLDevice, EGLDisplay, Error as EGLError, native::X11DefaultDisplay},
|
||||
input::{Axis, ButtonState, InputEvent, KeyState, Keycode},
|
||||
},
|
||||
utils::{x11rb::X11Source, Logical, Size},
|
||||
utils::{Logical, Size, x11rb::X11Source},
|
||||
};
|
||||
use calloop::{EventSource, Poll, PostAction, Readiness, Token, TokenFactory};
|
||||
use drm::node::path_to_type;
|
||||
|
|
@ -101,8 +101,9 @@ use std::{
|
|||
io,
|
||||
os::unix::io::OwnedFd,
|
||||
sync::{
|
||||
Arc, Mutex, Weak,
|
||||
atomic::{AtomicU32, Ordering},
|
||||
mpsc, Arc, Mutex, Weak,
|
||||
mpsc,
|
||||
},
|
||||
};
|
||||
use tracing::{debug_span, error, info, instrument, warn};
|
||||
|
|
@ -110,11 +111,10 @@ use x11rb::{
|
|||
atom_manager,
|
||||
connection::Connection,
|
||||
protocol::{
|
||||
self as x11,
|
||||
self as x11, ErrorKind,
|
||||
dri3::ConnectionExt as _,
|
||||
xinput,
|
||||
xproto::{ColormapAlloc, ConnectionExt, CreateWindowAux, VisualClass, WindowClass, WindowWrapper},
|
||||
ErrorKind,
|
||||
},
|
||||
rust_connection::{ReplyError, RustConnection},
|
||||
};
|
||||
|
|
@ -1043,15 +1043,26 @@ fn dri3_init(x11: &X11Inner) -> Result<(DrmNode, OwnedFd), X11Error> {
|
|||
{
|
||||
Some(Ok(fd)) => return Ok((node, fd)),
|
||||
Some(Err(err)) => {
|
||||
warn!("Could not create render node from existing DRM node ({:?}): {}, falling back to primary node", dri_node.dev_path().as_ref().map(|x| x.display()), err);
|
||||
warn!(
|
||||
"Could not create render node from existing DRM node ({:?}): {}, falling back to primary node",
|
||||
dri_node.dev_path().as_ref().map(|x| x.display()),
|
||||
err
|
||||
);
|
||||
}
|
||||
None => {
|
||||
warn!("Could not create render node from existing DRM node ({:?}), falling back to primary node", dri_node.dev_path().as_ref().map(|x| x.display()));
|
||||
warn!(
|
||||
"Could not create render node from existing DRM node ({:?}), falling back to primary node",
|
||||
dri_node.dev_path().as_ref().map(|x| x.display())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(Err(err)) => {
|
||||
warn!("Could not create render node from existing DRM node ({:?}): {}, falling back to primary node", dri_node.dev_path().as_ref().map(|x| x.display()), err);
|
||||
warn!(
|
||||
"Could not create render node from existing DRM node ({:?}): {}, falling back to primary node",
|
||||
dri_node.dev_path().as_ref().map(|x| x.display()),
|
||||
err
|
||||
);
|
||||
}
|
||||
None => {
|
||||
warn!(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
mem,
|
||||
sync::{mpsc::Receiver, Weak},
|
||||
sync::{Weak, mpsc::Receiver},
|
||||
};
|
||||
|
||||
use drm_fourcc::DrmFourcc;
|
||||
|
|
@ -10,10 +10,10 @@ use x11rb::{connection::Connection, protocol::xproto::PixmapWrapper, rust_connec
|
|||
use crate::{
|
||||
backend::{
|
||||
allocator::{
|
||||
dmabuf::{AnyError, Dmabuf},
|
||||
Allocator, Slot, Swapchain,
|
||||
dmabuf::{AnyError, Dmabuf},
|
||||
},
|
||||
x11::{buffer::PixmapWrapperExt, window_inner::WindowInner, AllocateBuffersError, Window},
|
||||
x11::{AllocateBuffersError, Window, buffer::PixmapWrapperExt, window_inner::WindowInner},
|
||||
},
|
||||
utils::{Logical, Size},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ A link to the ICCCM Section 4: https://tronche.com/gui/x/icccm/sec-4.html
|
|||
*/
|
||||
use crate::utils::{Logical, Size};
|
||||
|
||||
use super::{extension::Extensions, Atoms, Window, X11Error};
|
||||
use super::{Atoms, Window, X11Error, extension::Extensions};
|
||||
use drm_fourcc::DrmFourcc;
|
||||
use std::sync::{
|
||||
Arc, Mutex, Weak,
|
||||
atomic::{AtomicU32, AtomicU64},
|
||||
mpsc::Sender,
|
||||
Arc, Mutex, Weak,
|
||||
};
|
||||
use x11rb::{
|
||||
connection::Connection,
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ pub use self::space::Space;
|
|||
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
pub use self::wayland::{
|
||||
layer::{layer_map_for_output, LayerMap, LayerSurface},
|
||||
layer::{LayerMap, LayerSurface, layer_map_for_output},
|
||||
popup::*,
|
||||
utils,
|
||||
window::*,
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ use std::hash::Hash;
|
|||
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
use crate::{
|
||||
backend::renderer::{element::surface::WaylandSurfaceRenderElement, ImportAll},
|
||||
backend::renderer::{ImportAll, element::surface::WaylandSurfaceRenderElement},
|
||||
desktop::LayerSurface,
|
||||
wayland::shell::wlr_layer::Layer,
|
||||
};
|
||||
use crate::{
|
||||
backend::renderer::{
|
||||
element::{AsRenderElements, Wrap},
|
||||
Renderer, Texture,
|
||||
element::{AsRenderElements, Wrap},
|
||||
},
|
||||
output::Output,
|
||||
utils::{IsAlive, Logical, Physical, Point, Rectangle, Scale},
|
||||
|
|
@ -163,11 +163,11 @@ where
|
|||
}
|
||||
|
||||
impl<
|
||||
'a,
|
||||
#[cfg(feature = "wayland_frontend")] R: Renderer + ImportAll,
|
||||
#[cfg(not(feature = "wayland_frontend"))] R: Renderer,
|
||||
E: AsRenderElements<R>,
|
||||
> AsRenderElements<R> for SpaceElements<'a, E>
|
||||
'a,
|
||||
#[cfg(feature = "wayland_frontend")] R: Renderer + ImportAll,
|
||||
#[cfg(not(feature = "wayland_frontend"))] R: Renderer,
|
||||
E: AsRenderElements<R>,
|
||||
> AsRenderElements<R> for SpaceElements<'a, E>
|
||||
where
|
||||
R::TextureId: Clone + Texture + 'static,
|
||||
<E as AsRenderElements<R>>::RenderElement: 'a,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
backend::renderer::{
|
||||
element::{surface::WaylandSurfaceRenderElement, AsRenderElements, Kind},
|
||||
ImportAll, Renderer,
|
||||
element::{AsRenderElements, Kind, surface::WaylandSurfaceRenderElement},
|
||||
},
|
||||
utils::{IsAlive, Physical, Point, Scale},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@
|
|||
|
||||
use crate::{
|
||||
backend::renderer::{
|
||||
Color32F, Renderer, Texture,
|
||||
damage::{Error as OutputDamageTrackerError, OutputDamageTracker, RenderOutputResult},
|
||||
element::{AsRenderElements, RenderElement, Wrap},
|
||||
Color32F, Renderer, Texture,
|
||||
},
|
||||
output::{Output, OutputModeSource, OutputNoMode},
|
||||
utils::{IsAlive, Logical, Point, Rectangle, Scale, Transform},
|
||||
};
|
||||
#[cfg(feature = "wayland_frontend")]
|
||||
use crate::{
|
||||
backend::renderer::{element::surface::WaylandSurfaceRenderElement, ImportAll},
|
||||
desktop::{layer_map_for_output, LayerSurface, WindowSurfaceType},
|
||||
backend::renderer::{ImportAll, element::surface::WaylandSurfaceRenderElement},
|
||||
desktop::{LayerSurface, WindowSurfaceType, layer_map_for_output},
|
||||
wayland::shell::wlr_layer::Layer,
|
||||
};
|
||||
use std::{collections::HashMap, fmt};
|
||||
|
|
@ -633,10 +633,10 @@ crate::backend::renderer::element::render_elements! {
|
|||
}
|
||||
|
||||
impl<
|
||||
#[cfg(feature = "wayland_frontend")] R: Renderer + ImportAll,
|
||||
#[cfg(not(feature = "wayland_frontend"))] R: Renderer,
|
||||
E: RenderElement<R> + std::fmt::Debug,
|
||||
> std::fmt::Debug for SpaceRenderElements<R, E>
|
||||
#[cfg(feature = "wayland_frontend")] R: Renderer + ImportAll,
|
||||
#[cfg(not(feature = "wayland_frontend"))] R: Renderer,
|
||||
E: RenderElement<R> + std::fmt::Debug,
|
||||
> std::fmt::Debug for SpaceRenderElements<R, E>
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
use crate::{
|
||||
backend::renderer::{
|
||||
element::{
|
||||
utils::{
|
||||
constrain_as_render_elements, ConstrainAlign, ConstrainScaleBehavior, CropRenderElement,
|
||||
RelocateRenderElement, RescaleRenderElement,
|
||||
},
|
||||
AsRenderElements,
|
||||
},
|
||||
Renderer,
|
||||
element::{
|
||||
AsRenderElements,
|
||||
utils::{
|
||||
ConstrainAlign, ConstrainScaleBehavior, CropRenderElement, RelocateRenderElement,
|
||||
RescaleRenderElement, constrain_as_render_elements,
|
||||
},
|
||||
},
|
||||
},
|
||||
utils::{Logical, Point, Rectangle, Scale},
|
||||
};
|
||||
|
|
@ -56,7 +56,7 @@ where
|
|||
>,
|
||||
>,
|
||||
L: Into<Point<i32, Logical>>,
|
||||
S: Into<Scale<f64>>
|
||||
S: Into<Scale<f64>>,
|
||||
{
|
||||
let location = location.into();
|
||||
let scale = scale.into();
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue