2022-03-10 02:37:20 +01:00
|
|
|
// The Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) The Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2022 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_CL_DATA_H
|
|
|
|
|
|
|
|
/// cl_mem wrapping
|
|
|
|
struct ircd::cl::data
|
|
|
|
{
|
|
|
|
static conf::item<bool> use_host_ptr;
|
|
|
|
static conf::item<size_t> gart_page_size;
|
|
|
|
|
|
|
|
void *handle {nullptr};
|
|
|
|
|
|
|
|
public:
|
|
|
|
uint flags() const;
|
|
|
|
size_t size() const;
|
|
|
|
off_t offset() const;
|
|
|
|
char *ptr() const; // host only
|
2022-03-12 03:57:32 +01:00
|
|
|
size_t maps() const;
|
|
|
|
size_t refs() const;
|
2022-03-10 02:37:20 +01:00
|
|
|
|
|
|
|
data(const size_t, const bool host_rd = false, const bool host_wr = false);
|
|
|
|
data(const mutable_buffer &, const bool dev_wonly = false); // host rw
|
|
|
|
data(const const_buffer &); // host ro
|
|
|
|
data(data &, const pair<size_t, off_t> &); // subbuffer
|
|
|
|
data(const data &) = delete;
|
|
|
|
data() = default;
|
|
|
|
data(data &&) noexcept;
|
|
|
|
data &operator=(const data &) = delete;
|
|
|
|
data &operator=(data &&) noexcept;
|
|
|
|
~data() noexcept;
|
|
|
|
};
|