rusticl/mem: move tx_image into Image

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27376>
This commit is contained in:
Karol Herbst 2024-01-30 17:14:13 +01:00 committed by Marge Bot
parent e39b6288f6
commit 790d00d3e1

View file

@ -699,20 +699,6 @@ impl MemBase {
Ok(self.tx_raw(q, ctx, offset, size, rw)?.with_ctx(ctx))
}
fn tx_image_raw(
&self,
q: &Queue,
ctx: &PipeContext,
bx: &pipe_box,
rw: RWFlags,
) -> CLResult<PipeTransfer> {
assert!(!self.is_buffer());
let r = self.get_res()?.get(&q.device).unwrap();
ctx.texture_map(r, bx, rw, ResourceMapType::Normal)
.ok_or(CL_OUT_OF_RESOURCES)
}
fn tx_image_raw_async(
&self,
dev: &Device,
@ -753,16 +739,6 @@ impl MemBase {
}
}
fn tx_image<'a>(
&self,
q: &Queue,
ctx: &'a PipeContext,
bx: &pipe_box,
rw: RWFlags,
) -> CLResult<GuardedPipeTransfer<'a>> {
Ok(self.tx_image_raw(q, ctx, bx, rw)?.with_ctx(ctx))
}
pub fn has_same_parent(&self, other: &Self) -> bool {
ptr::eq(self.get_parent(), other.get_parent())
}
@ -1530,6 +1506,20 @@ impl Image {
}
}
fn tx_image<'a>(
&self,
q: &Queue,
ctx: &'a PipeContext,
bx: &pipe_box,
rw: RWFlags,
) -> CLResult<GuardedPipeTransfer<'a>> {
let r = self.get_res_of_dev(q.device)?;
Ok(ctx
.texture_map(r, bx, 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();