Skip to content

Redesign DumbBuf #4

@trissylegs

Description

@trissylegs

Currently DumbBuf is one big opaque blob (with a GemHandle implemntation).
Which was mostly done to Just Get It Working™.

The steps for using a dumb buf and mapping it are:

  1. Create Dumb buffer.
  2. create something that can be mapped.
    a. Use map dump which gives you an offset.
    b. Create a PRIME fd
  3. mmap
  4. Create a Drm Fb.

Currently it:

  1. Creates the buffer
  2. Dups device
  3. Creates the offset,
  4. Mmaps it.
  5. Then returns all that in one big mess (with a generic parameter)

I would like something that looks like:

let dumb = device.create_dumb::<Argb8888>(width, height);
let prime = dumb.create_prime();
let map = prime.map();

Where prime is some struct Prime. create_prime is actaully from a Gem trait. (Or GemExt for AsRef<&GemHandle>), and Argb8888 is some pixel type. (We have those already) with a trait like so:

pub trait PixelFormat {
    type Pixel: Copy, Sized, From<u32>;
    fn buffer_as(buf: &[u8]) -> &[Self::Pixel];
}

map is probably going to be some wrapper around Memmap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions