mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 05:38:16 +02:00
rusticl/mem: move tx into Buffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27376>
This commit is contained in:
parent
d18333889e
commit
687dea4fde
1 changed files with 23 additions and 23 deletions
|
|
@ -667,29 +667,6 @@ impl MemBase {
|
|||
}
|
||||
}
|
||||
|
||||
fn tx<'a>(
|
||||
&self,
|
||||
q: &Queue,
|
||||
ctx: &'a PipeContext,
|
||||
mut offset: usize,
|
||||
size: usize,
|
||||
rw: RWFlags,
|
||||
) -> CLResult<GuardedPipeTransfer<'a>> {
|
||||
let b = self.to_parent(&mut offset);
|
||||
let r = b.get_res_of_dev(q.device)?;
|
||||
|
||||
Ok(ctx
|
||||
.buffer_map(
|
||||
r,
|
||||
offset.try_into().map_err(|_| CL_OUT_OF_HOST_MEMORY)?,
|
||||
size.try_into().map_err(|_| CL_OUT_OF_HOST_MEMORY)?,
|
||||
rw,
|
||||
ResourceMapType::Normal,
|
||||
)
|
||||
.ok_or(CL_OUT_OF_RESOURCES)?
|
||||
.with_ctx(ctx))
|
||||
}
|
||||
|
||||
fn tx_image_raw_async(
|
||||
&self,
|
||||
dev: &Device,
|
||||
|
|
@ -1084,6 +1061,29 @@ impl Buffer {
|
|||
}
|
||||
}
|
||||
|
||||
fn tx<'a>(
|
||||
&self,
|
||||
q: &Queue,
|
||||
ctx: &'a PipeContext,
|
||||
offset: usize,
|
||||
size: usize,
|
||||
rw: RWFlags,
|
||||
) -> CLResult<GuardedPipeTransfer<'a>> {
|
||||
let offset = self.apply_offset(offset)?;
|
||||
let r = self.get_res_of_dev(q.device)?;
|
||||
|
||||
Ok(ctx
|
||||
.buffer_map(
|
||||
r,
|
||||
offset.try_into().map_err(|_| CL_OUT_OF_HOST_MEMORY)?,
|
||||
size.try_into().map_err(|_| CL_OUT_OF_HOST_MEMORY)?,
|
||||
rw,
|
||||
ResourceMapType::Normal,
|
||||
)
|
||||
.ok_or(CL_OUT_OF_RESOURCES)?
|
||||
.with_ctx(ctx))
|
||||
}
|
||||
|
||||
// TODO: only sync on unmap when the memory is not mapped for writing
|
||||
pub fn unmap(&self, q: &Queue, ctx: &PipeContext, ptr: *mut c_void) -> CLResult<()> {
|
||||
let mut lock = self.maps.lock().unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue