Skip to content

Commit

Permalink
Implement BufferInterface::pixels for KMS backend
Browse files Browse the repository at this point in the history
  • Loading branch information
wackbyte committed Mar 8, 2024
1 parent 2bcb5c9 commit 8024a84
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/backends/kms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ struct Buffers {

/// Whether to use the first buffer or the second buffer as the front buffer.
first_is_front: bool,

/// A buffer full of zeroes.
zeroes: Box<[u32]>,
}

/// The buffer implementation.
Expand All @@ -106,9 +103,6 @@ pub(crate) struct BufferImpl<'a, D: ?Sized, W: ?Sized> {
/// This is used to change the front buffer.
first_is_front: &'a mut bool,

/// Buffer full of zeroes.
zeroes: &'a [u32],

/// The current size.
size: (NonZeroU32, NonZeroU32),

Expand Down Expand Up @@ -232,7 +226,6 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
self.buffer = Some(Buffers {
first_is_front: true,
buffers: [front_buffer, back_buffer],
zeroes: vec![0; width.get() as usize * height.get() as usize].into_boxed_slice(),
});

Ok(())
Expand Down Expand Up @@ -276,7 +269,6 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
front_fb,
crtc_handle: self.crtc.handle(),
display: &self.display,
zeroes: &set.zeroes,
front_age,
back_age,
_window: PhantomData,
Expand All @@ -302,9 +294,7 @@ impl<D: ?Sized, W: ?Sized> Drop for KmsImpl<D, W> {
impl<D: ?Sized, W: ?Sized> BufferInterface for BufferImpl<'_, D, W> {
#[inline]
fn pixels(&self) -> &[u32] {
// drm-rs doesn't let us have the immutable reference... so just use a bunch of zeroes.
// TODO: There has to be a better way of doing this!
self.zeroes
bytemuck::cast_slice(self.mapping.as_ref())
}

#[inline]
Expand Down

0 comments on commit 8024a84

Please sign in to comment.