From 8e3b0c0b9b55cef71b2c1baa53f1d8d74724e907 Mon Sep 17 00:00:00 2001 From: Victor Brekenfeld Date: Mon, 26 Apr 2021 21:41:59 +0200 Subject: [PATCH] egl: Do not expose multi-planar buffers for now --- src/backend/egl/display.rs | 7 +++---- src/backend/egl/mod.rs | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/backend/egl/display.rs b/src/backend/egl/display.rs index ff31316..18aac99 100644 --- a/src/backend/egl/display.rs +++ b/src/backend/egl/display.rs @@ -576,7 +576,6 @@ impl fmt::Debug for EGLBufferReader { #[cfg(feature = "use_system_lib")] impl EGLBufferReader { fn new(display: Arc, wayland: *mut wl_display) -> Self { - Self { display, wayland, @@ -610,9 +609,9 @@ impl EGLBufferReader { x if x == ffi::egl::TEXTURE_RGB as i32 => Format::RGB, x if x == ffi::egl::TEXTURE_RGBA as i32 => Format::RGBA, ffi::egl::TEXTURE_EXTERNAL_WL => Format::External, - ffi::egl::TEXTURE_Y_UV_WL => Format::Y_UV, - ffi::egl::TEXTURE_Y_U_V_WL => Format::Y_U_V, - ffi::egl::TEXTURE_Y_XUXV_WL => Format::Y_XUXV, + ffi::egl::TEXTURE_Y_UV_WL => return Err(BufferAccessError::UnsupportedMultiPlanarFormat(Format::Y_UV)), + ffi::egl::TEXTURE_Y_U_V_WL => return Err(BufferAccessError::UnsupportedMultiPlanarFormat(Format::Y_U_V)), + ffi::egl::TEXTURE_Y_XUXV_WL => return Err(BufferAccessError::UnsupportedMultiPlanarFormat(Format::Y_XUXV)), x => panic!("EGL returned invalid texture type: {}", x), }; diff --git a/src/backend/egl/mod.rs b/src/backend/egl/mod.rs index 3422e8d..6372434 100644 --- a/src/backend/egl/mod.rs +++ b/src/backend/egl/mod.rs @@ -93,6 +93,9 @@ pub enum BufferAccessError { /// The required EGL extension is not supported by the underlying EGL implementation #[error("{0}")] EglExtensionNotSupported(#[from] EglExtensionNotSupportedError), + /// We currently do not support multi-planar buffers + #[error("Multi-planar formats (like {0:?}) are unsupported")] + UnsupportedMultiPlanarFormat(Format), } #[cfg(feature = "wayland_frontend")] @@ -105,6 +108,8 @@ impl fmt::Debug for BufferAccessError { write!(formatter, "BufferAccessError::EGLImageCreationFailed") } BufferAccessError::EglExtensionNotSupported(ref err) => write!(formatter, "{:?}", err), + BufferAccessError::UnsupportedMultiPlanarFormat(ref fmt) => + write!(formatter, "BufferAccessError::UnsupportedMultiPlanerFormat({:?})", fmt), } } }