aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/tty.rs7
-rw-r--r--src/render_helpers/offscreen.rs18
-rw-r--r--src/render_helpers/surface.rs2
-rw-r--r--src/render_helpers/texture.rs16
4 files changed, 22 insertions, 21 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index cbb8c8c0..363526d4 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -19,6 +19,7 @@ use smithay::backend::allocator::format::FormatSet;
use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice};
use smithay::backend::allocator::Fourcc;
use smithay::backend::drm::compositor::{DrmCompositor, FrameFlags, PrimaryPlaneElement};
+use smithay::backend::drm::exporter::gbm::GbmFramebufferExporter;
use smithay::backend::drm::{
DrmDevice, DrmDeviceFd, DrmEvent, DrmEventMetadata, DrmEventTime, DrmNode, NodeType, VrrSupport,
};
@@ -114,7 +115,7 @@ pub type TtyRendererError<'render> = <TtyRenderer<'render> as RendererSuper>::Er
type GbmDrmCompositor = DrmCompositor<
GbmAllocator<DrmDeviceFd>,
- GbmDevice<DrmDeviceFd>,
+ GbmFramebufferExporter<DrmDeviceFd>,
(OutputPresentationFeedback, Duration),
DrmDeviceFd,
>;
@@ -971,7 +972,7 @@ impl Tty {
surface,
None,
allocator.clone(),
- device.gbm.clone(),
+ GbmFramebufferExporter::new(device.gbm.clone()),
SUPPORTED_COLOR_FORMATS,
// This is only used to pick a good internal format, so it can use the surface's render
// formats, even though we only ever render on the primary GPU.
@@ -1001,7 +1002,7 @@ impl Tty {
surface,
None,
allocator,
- device.gbm.clone(),
+ GbmFramebufferExporter::new(device.gbm.clone()),
SUPPORTED_COLOR_FORMATS,
render_formats,
device.drm.cursor_size(),
diff --git a/src/render_helpers/offscreen.rs b/src/render_helpers/offscreen.rs
index 71959404..7798a481 100644
--- a/src/render_helpers/offscreen.rs
+++ b/src/render_helpers/offscreen.rs
@@ -13,7 +13,7 @@ use smithay::backend::renderer::utils::{
CommitCounter, DamageBag, DamageSet, DamageSnapshot, OpaqueRegions,
};
use smithay::backend::renderer::{
- Bind as _, Color32F, Frame as _, Offscreen as _, Renderer, Texture as _,
+ Bind as _, Color32F, ContextId, Frame as _, Offscreen as _, Renderer, Texture as _,
};
use smithay::utils::{Buffer, Logical, Physical, Point, Rectangle, Scale, Size, Transform};
@@ -36,8 +36,8 @@ pub struct OffscreenBuffer {
struct Inner {
/// The texture with offscreened contents.
texture: GlesTexture,
- /// Id of the renderer that the texture comes from.
- renderer_id: usize,
+ /// Id of the renderer context that the texture comes from.
+ renderer_context_id: ContextId<GlesTexture>,
/// Scale of the texture.
scale: Scale<f64>,
/// Damage tracker for drawing to the texture.
@@ -50,7 +50,7 @@ struct Inner {
pub struct OffscreenRenderElement {
id: Id,
texture: GlesTexture,
- renderer_id: usize,
+ renderer_context_id: ContextId<GlesTexture>,
scale: Scale<f64>,
damage: DamageSnapshot<i32, Buffer>,
offset: Point<f64, Logical>,
@@ -92,7 +92,7 @@ impl OffscreenBuffer {
let mut reason = "";
if let Some(Inner {
texture,
- renderer_id,
+ renderer_context_id,
..
}) = inner.as_mut()
{
@@ -109,7 +109,7 @@ impl OffscreenBuffer {
reason = "not unique";
*inner = None;
- } else if *renderer_id != renderer.id() {
+ } else if *renderer_context_id != renderer.context_id() {
reason = "renderer id changed";
*inner = None;
@@ -134,7 +134,7 @@ impl OffscreenBuffer {
inner.insert(Inner {
texture,
- renderer_id: renderer.id(),
+ renderer_context_id: renderer.context_id(),
scale,
damage,
outer_damage: DamageBag::default(),
@@ -180,7 +180,7 @@ impl OffscreenBuffer {
let elem = OffscreenRenderElement {
id: self.id.clone(),
texture: inner.texture.clone(),
- renderer_id: inner.renderer_id,
+ renderer_context_id: inner.renderer_context_id.clone(),
scale,
damage: inner.outer_damage.snapshot(),
offset,
@@ -305,7 +305,7 @@ impl RenderElement<GlesRenderer> for OffscreenRenderElement {
damage: &[Rectangle<i32, Physical>],
opaque_regions: &[Rectangle<i32, Physical>],
) -> Result<(), GlesError> {
- if frame.id() != self.renderer_id {
+ if frame.context_id() != self.renderer_context_id {
warn!("trying to render texture from different renderer");
return Ok(());
}
diff --git a/src/render_helpers/surface.rs b/src/render_helpers/surface.rs
index 96065923..d4722c17 100644
--- a/src/render_helpers/surface.rs
+++ b/src/render_helpers/surface.rs
@@ -53,7 +53,7 @@ pub fn render_snapshot_from_surface_tree(
}
let data = data.lock().unwrap();
- let Some(texture) = data.texture::<GlesRenderer>(renderer.id()) else {
+ let Some(texture) = data.texture(renderer.context_id()) else {
return;
};
diff --git a/src/render_helpers/texture.rs b/src/render_helpers/texture.rs
index 2967c361..7fcd4356 100644
--- a/src/render_helpers/texture.rs
+++ b/src/render_helpers/texture.rs
@@ -2,17 +2,17 @@ use smithay::backend::allocator::Fourcc;
use smithay::backend::renderer::element::{Element, Id, Kind, RenderElement, UnderlyingStorage};
use smithay::backend::renderer::gles::GlesTexture;
use smithay::backend::renderer::utils::{CommitCounter, OpaqueRegions};
-use smithay::backend::renderer::{Frame as _, ImportMem, Renderer, Texture};
+use smithay::backend::renderer::{ContextId, Frame as _, ImportMem, Renderer, Texture};
use smithay::utils::{Buffer, Logical, Physical, Point, Rectangle, Scale, Size, Transform};
use super::memory::MemoryBuffer;
/// Smithay's texture buffer, but with fractional scale.
#[derive(Debug, Clone)]
-pub struct TextureBuffer<T> {
+pub struct TextureBuffer<T: Texture> {
id: Id,
commit_counter: CommitCounter,
- renderer_id: usize,
+ renderer_context_id: ContextId<T>,
texture: T,
scale: Scale<f64>,
transform: Transform,
@@ -21,7 +21,7 @@ pub struct TextureBuffer<T> {
/// Render element for a [`TextureBuffer`].
#[derive(Debug, Clone)]
-pub struct TextureRenderElement<T> {
+pub struct TextureRenderElement<T: Texture> {
buffer: TextureBuffer<T>,
location: Point<f64, Logical>,
alpha: f32,
@@ -30,7 +30,7 @@ pub struct TextureRenderElement<T> {
kind: Kind,
}
-impl<T> TextureBuffer<T> {
+impl<T: Texture> TextureBuffer<T> {
pub fn from_texture<R: Renderer<TextureId = T>>(
renderer: &R,
texture: T,
@@ -41,7 +41,7 @@ impl<T> TextureBuffer<T> {
TextureBuffer {
id: Id::new(),
commit_counter: CommitCounter::default(),
- renderer_id: renderer.id(),
+ renderer_context_id: renderer.context_id(),
texture,
scale: scale.into(),
transform,
@@ -122,7 +122,7 @@ impl TextureBuffer<GlesTexture> {
}
}
-impl<T> TextureRenderElement<T> {
+impl<T: Texture> TextureRenderElement<T> {
pub fn from_texture_buffer(
buffer: TextureBuffer<T>,
location: impl Into<Point<f64, Logical>>,
@@ -226,7 +226,7 @@ where
damage: &[Rectangle<i32, Physical>],
opaque_regions: &[Rectangle<i32, Physical>],
) -> Result<(), R::Error> {
- if frame.id() != self.buffer.renderer_id {
+ if frame.context_id() != self.buffer.renderer_context_id {
warn!("trying to render texture from different renderer");
return Ok(());
}