mirror of
https://github.com/matrix-construct/construct
synced 2025-03-16 22:41:46 +01:00
ircd:🆑 Allow optional map closures; add write invalidate flag from cl1.2.
This commit is contained in:
parent
eb523a598b
commit
c9796fa9e0
2 changed files with 14 additions and 12 deletions
|
@ -210,12 +210,12 @@ struct ircd::cl::exec
|
|||
|
||||
static const opts opts_default;
|
||||
|
||||
// View buffer in the GTT which the device will read (synchronous closure).
|
||||
exec(data &, const pair<size_t, off_t> &, const write_closure & = nullptr, const opts & = opts_default);
|
||||
|
||||
// View data written by the device to the GTT (synchronous closure).
|
||||
exec(data &, const pair<size_t, off_t> &, const read_closure &, const opts & = opts_default);
|
||||
|
||||
// View buffer in the GTT which the device will read (synchronous closure).
|
||||
exec(data &, const pair<size_t, off_t> &, const write_closure &, const opts & = opts_default);
|
||||
|
||||
// Copy data from the buffer to the GTT for use by the device.
|
||||
exec(data &, const const_buffer &, const opts & = opts_default);
|
||||
|
||||
|
|
20
ircd/cl.cc
20
ircd/cl.cc
|
@ -1119,10 +1119,11 @@ try
|
|||
|
||||
// Wait for the mapping to complete before presenting the buffer.
|
||||
wait();
|
||||
closure(const_buffer
|
||||
{
|
||||
reinterpret_cast<const char *>(ptr), size
|
||||
});
|
||||
if(likely(closure))
|
||||
closure(const_buffer
|
||||
{
|
||||
reinterpret_cast<const char *>(ptr), size
|
||||
});
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
|
@ -1182,7 +1183,7 @@ try
|
|||
};
|
||||
|
||||
cl_map_flags flags {0};
|
||||
flags |= CL_MAP_WRITE;
|
||||
flags |= opts.duplex || opts.blocking? CL_MAP_WRITE: CL_MAP_WRITE_INVALIDATE_REGION;
|
||||
flags |= opts.duplex? CL_MAP_READ: 0;
|
||||
|
||||
int err {CL_SUCCESS};
|
||||
|
@ -1240,10 +1241,11 @@ try
|
|||
}};
|
||||
|
||||
wait();
|
||||
closure(mutable_buffer
|
||||
{
|
||||
reinterpret_cast<char *>(ptr), size
|
||||
});
|
||||
if(closure)
|
||||
closure(mutable_buffer
|
||||
{
|
||||
reinterpret_cast<char *>(ptr), size
|
||||
});
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue