Struct gbm::MappedBufferObject[][src]

pub struct MappedBufferObject<'a, T: 'static> { /* fields omitted */ }

A mapped buffer object

Implementations

impl<'a, T: 'static> MappedBufferObject<'a, T>[src]

pub fn stride(&self) -> u32[src]

Get the stride of the buffer object

This is calculated by the backend when it does the allocation of the buffer.

pub fn height(&self) -> u32[src]

The height of the mapped region for the buffer

pub fn width(&self) -> u32[src]

The width of the mapped region for the buffer

pub fn x(&self) -> u32[src]

The X (top left origin) starting position of the mapped region for the buffer

pub fn y(&self) -> u32[src]

The Y (top left origin) starting position of the mapped region for the buffer

pub fn buffer(&self) -> &[u8][src]

Access to the underlying image buffer

pub fn buffer_mut(&mut self) -> &mut [u8][src]

Mutable access to the underlying image buffer

Methods from Deref<Target = BufferObject<T>>

pub fn width(&self) -> Result<u32, DeviceDestroyedError>[src]

Get the width of the buffer object

pub fn height(&self) -> Result<u32, DeviceDestroyedError>[src]

Get the height of the buffer object

pub fn stride(&self) -> Result<u32, DeviceDestroyedError>[src]

Get the stride of the buffer object

pub fn stride_for_plane(&self, plane: i32) -> Result<u32, DeviceDestroyedError>[src]

Get the stride of the buffer object

pub fn format(&self) -> Result<Format, DeviceDestroyedError>[src]

Get the format of the buffer object

pub fn bpp(&self) -> Result<u32, DeviceDestroyedError>[src]

Get the bits per pixel of the buffer object

pub fn offset(&self, plane: i32) -> Result<u32, DeviceDestroyedError>[src]

Get the offset for a plane of the buffer object

pub fn plane_count(&self) -> Result<u32, DeviceDestroyedError>[src]

Get the plane count of the buffer object

pub fn modifier(&self) -> Result<Modifier, DeviceDestroyedError>[src]

Get the modifier of the buffer object

pub fn fd(&self) -> Result<RawFd, DeviceDestroyedError>[src]

Get a DMA-BUF file descriptor for the buffer object

This function creates a DMA-BUF (also known as PRIME) file descriptor handle for the buffer object. Each call to Self::fd() returns a new file descriptor and the caller is responsible for closing the file descriptor.

pub fn handle(&self) -> Result<BufferObjectHandle, DeviceDestroyedError>[src]

Get the handle of the buffer object

This is stored in the platform generic union BufferObjectHandle type. However the format of this handle is platform specific.

pub fn handle_for_plane(
    &self,
    plane: i32
) -> Result<BufferObjectHandle, DeviceDestroyedError>
[src]

Get the handle of a plane of the buffer object

This is stored in the platform generic union BufferObjectHandle type. However the format of this handle is platform specific.

pub fn map<'a, D, F, S>(
    &'a self,
    device: &Device<D>,
    x: u32,
    y: u32,
    width: u32,
    height: u32,
    f: F
) -> Result<IoResult<S>, WrongDeviceError> where
    D: AsRawFd + 'static,
    F: FnOnce(&MappedBufferObject<'a, T>) -> S, 
[src]

Map a region of a GBM buffer object for cpu access

This function maps a region of a GBM bo for cpu read access.

pub fn map_mut<'a, D, F, S>(
    &'a mut self,
    device: &Device<D>,
    x: u32,
    y: u32,
    width: u32,
    height: u32,
    f: F
) -> Result<IoResult<S>, WrongDeviceError> where
    D: AsRawFd + 'static,
    F: FnOnce(&mut MappedBufferObject<'a, T>) -> S, 
[src]

Map a region of a GBM buffer object for cpu access

This function maps a region of a GBM bo for cpu read/write access.

pub fn write(
    &mut self,
    buffer: &[u8]
) -> Result<IoResult<()>, DeviceDestroyedError>
[src]

Write data into the buffer object

If the buffer object was created with the BufferObjectFlags::WRITE flag, this function can be used to write data into the buffer object. The data is copied directly into the object and it’s the responsibility of the caller to make sure the data represents valid pixel data, according to the width, height, stride and format of the buffer object.

pub fn set_userdata(
    &mut self,
    userdata: T
) -> Result<Option<T>, DeviceDestroyedError>
[src]

Sets the userdata of the buffer object.

If previously userdata was set, it is returned.

pub fn clear_userdata(&mut self) -> Result<(), DeviceDestroyedError>[src]

Clears the set userdata of the buffer object.

pub fn userdata(&self) -> Result<Option<&T>, DeviceDestroyedError>[src]

Returns a reference to set userdata, if any.

pub fn userdata_mut(&mut self) -> Result<Option<&mut T>, DeviceDestroyedError>[src]

Returns a mutable reference to set userdata, if any.

pub fn take_userdata(&mut self) -> Result<Option<T>, DeviceDestroyedError>[src]

Takes ownership of previously set userdata, if any.

This removes the userdata from the buffer object.

Trait Implementations

impl<'a, T: 'static> Deref for MappedBufferObject<'a, T>[src]

type Target = BufferObject<T>

The resulting type after dereferencing.

fn deref(&self) -> &BufferObject<T>[src]

Dereferences the value.

impl<'a, T: 'static> DerefMut for MappedBufferObject<'a, T>[src]

fn deref_mut(&mut self) -> &mut BufferObject<T>[src]

Mutably dereferences the value.

impl<'a, T: 'static> Drop for MappedBufferObject<'a, T>[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for MappedBufferObject<'a, T>

impl<'a, T> !Send for MappedBufferObject<'a, T>

impl<'a, T> !Sync for MappedBufferObject<'a, T>

impl<'a, T> Unpin for MappedBufferObject<'a, T>

impl<'a, T> !UnwindSafe for MappedBufferObject<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast for T where
    T: Any

pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

pub fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.