fix warnings

This commit is contained in:
Victor Brekenfeld 2021-04-29 00:03:16 +02:00
parent ccd86cd8c1
commit e329adcbd8
10 changed files with 21 additions and 26 deletions

View File

@ -52,7 +52,7 @@ impl<A: AsRawFd + 'static> AtomicDrmDevice<A> {
let plane_handles = dev.fd.plane_handles().map_err(|source| Error::Access {
errmsg: "Error loading planes",
dev: dev.fd.dev_path(),
source,
source
})?;
let planes = plane_handles.planes();
@ -239,7 +239,7 @@ impl<A: AsRawFd + 'static> Drop for AtomicDrmDevice<A> {
req.add_raw_property((*handle).into(), prop_handle, val);
}
}
};
}
add_multiple_props(&mut req, &self.old_state.0);
add_multiple_props(&mut req, &self.old_state.1);

View File

@ -22,7 +22,7 @@ pub struct DrmRenderSurface<
R: Bind<Dmabuf>,
B: Buffer + TryInto<Dmabuf>,
> {
format: Fourcc,
_format: Format,
buffers: Buffers<D>,
current_buffer: Option<Slot<Dmabuf, BufferObject<FbHandle<D>>>>,
swapchain: Swapchain<A, B, BufferObject<FbHandle<D>>, Dmabuf>,
@ -56,7 +56,7 @@ where
// select a format
let plane_formats = drm.supported_formats().iter().filter(|fmt| fmt.code == code).cloned().collect::<HashSet<_>>();
let mut renderer_formats = Bind::<Dmabuf>::supported_formats(&renderer).expect("Dmabuf renderer without formats")
let renderer_formats = Bind::<Dmabuf>::supported_formats(&renderer).expect("Dmabuf renderer without formats")
.iter().filter(|fmt| fmt.code == code).cloned().collect::<HashSet<_>>();
trace!(logger, "Remaining plane formats: {:?}", plane_formats);
@ -140,7 +140,7 @@ where
let buffers = Buffers::new(drm.clone(), gbm, buffer);
Ok(DrmRenderSurface {
drm,
format: format.code,
_format: format,
renderer,
swapchain,
buffers,

View File

@ -7,10 +7,10 @@ use drm::control::{Device as ControlDevice, Mode, crtc, connector, framebuffer,
pub(super) mod atomic;
pub(super) mod legacy;
use super::{error::Error, device::DevPath};
use super::error::Error;
use atomic::AtomicDrmSurface;
use legacy::LegacyDrmSurface;
use crate::backend::allocator::{Format, Fourcc, Modifier};
use crate::backend::allocator::Format;
pub struct DrmSurface<A: AsRawFd + 'static>
{

View File

@ -1,11 +1,9 @@
//! EGL context related structs
use std::os::raw::c_int;
use std::ptr;
use std::sync::atomic::Ordering;
use super::{ffi, wrap_egl_call, Error, MakeCurrentError};
use crate::backend::egl::display::{EGLDisplay, PixelFormat};
use crate::backend::egl::native::EGLNativeSurface;
use crate::backend::egl::EGLSurface;

View File

@ -318,7 +318,7 @@ impl EGLDisplay {
.map_err(Error::ConfigFailed)?;
value.assume_init()
}};
};
}
// return the format that was selected for our config
let desc = unsafe {

View File

@ -22,7 +22,7 @@ pub fn make_sure_egl_is_loaded() {
F: for<'a> Fn(&'a str) -> *const ::std::os::raw::c_void,
{
f
};
}
egl::load_with(|sym| {
let name = CString::new(sym).unwrap();

View File

@ -70,11 +70,9 @@ impl ::std::error::Error for EglExtensionNotSupportedError {}
///
/// Result is independent of displays and does not guarantee an extension is actually supported at runtime.
pub unsafe fn get_proc_address(symbol: &str) -> *const c_void {
unsafe {
let addr = CString::new(symbol.as_bytes()).unwrap();
let addr = addr.as_ptr();
ffi::egl::GetProcAddress(addr) as *const _
}
}
/// Error that can occur when accessing an EGL buffer

View File

@ -98,15 +98,14 @@ impl EGLSurface {
);
if self.native.needs_recreation() || surface.is_null() || is_bad_surface {
let previous = self.surface.compare_and_swap(
let previous = self.surface.compare_exchange(
surface,
unsafe {
self.native
.create(&self.display, self.config_id, &self.surface_attributes)
.map_err(SwapBuffersError::EGLCreateSurface)? as *mut _
},
.map_err(SwapBuffersError::EGLCreateSurface)? as *mut _,
Ordering::SeqCst,
);
Ordering::SeqCst,
).expect("The surface pointer changed in between?");
if previous == surface && !surface.is_null() {
let _ = unsafe { ffi::egl::DestroySurface(**self.display, surface as *const _) };
}

View File

@ -3,7 +3,7 @@ use std::ffi::CStr;
use std::ptr;
use std::rc::Rc;
use cgmath::{prelude::*, Matrix3, Vector2};
use cgmath::{prelude::*, Matrix3};
mod shaders;
use crate::backend::SwapBuffersError;

View File

@ -168,7 +168,7 @@ where
unreachable!("No backends for winit other then Wayland and X11 are supported")
};
context.unbind();
let _ = context.unbind();
(
display,
@ -184,7 +184,7 @@ where
let window = Rc::new(winit_window);
let egl = Rc::new(surface);
let mut renderer = unsafe { Gles2Renderer::new(context, log.clone())? };
let renderer = unsafe { Gles2Renderer::new(context, log.clone())? };
Ok((
WinitGraphicsBackend {