1
0
Fork 0
forked from wry/wry

gfx: implement async shm downloads

This commit is contained in:
Julian Orth 2024-10-06 15:11:00 +02:00
parent aca14d48dd
commit 028d0ed44c
11 changed files with 194 additions and 198 deletions

View file

@ -265,11 +265,23 @@ pub trait GfxFramebuffer: Debug {
clear: Option<&Color>,
) -> Result<Option<SyncFile>, GfxError>;
fn copy_to_shm(self: Rc<Self>, shm: &[Cell<u8>]) -> Result<(), GfxError>;
fn format(&self) -> &'static Format;
}
pub trait GfxInternalFramebuffer: GfxFramebuffer {
fn into_fb(self: Rc<Self>) -> Rc<dyn GfxFramebuffer>;
fn staging_size(&self) -> usize;
fn download(
self: Rc<Self>,
staging: &Rc<dyn GfxStagingBuffer>,
callback: Rc<dyn AsyncShmGfxTextureCallback>,
mem: Rc<dyn ShmMemory>,
damage: Region,
) -> Result<Option<PendingShmTransfer>, GfxError>;
}
impl dyn GfxFramebuffer {
pub fn clear(
&self,
@ -593,13 +605,14 @@ pub trait GfxContext: Debug {
fn gfx_api(&self) -> GfxApi;
fn create_fb(
fn create_internal_fb(
self: Rc<Self>,
cpu_worker: &Rc<CpuWorker>,
width: i32,
height: i32,
stride: i32,
format: &'static Format,
) -> Result<Rc<dyn GfxFramebuffer>, GfxError>;
) -> Result<Rc<dyn GfxInternalFramebuffer>, GfxError>;
fn sync_obj_ctx(&self) -> Option<&Rc<SyncObjCtx>>;