dd_context_set_global_binding(struct pipe_context *_pipe,
unsigned first, unsigned count,
struct pipe_resource **resources,
- uint64_t **handles)
+ uint32_t **handles)
{
struct pipe_context *pipe = dd_context(_pipe)->pipe;
pipe->set_global_binding(pipe, first, count, resources, handles);
static void
tc_set_global_binding(struct pipe_context *_pipe, unsigned first,
unsigned count, struct pipe_resource **resources,
- uint64_t **handles)
+ uint32_t **handles)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
static void
fd_set_global_binding(struct pipe_context *pctx,
unsigned first, unsigned count, struct pipe_resource **prscs,
- uint64_t **handles)
+ uint32_t **handles)
{
struct fd_context *ctx = fd_context(pctx);
struct fd_global_bindings_stateobj *so = &ctx->global_bindings;
if (so->buf[n]) {
struct fd_resource *rsc = fd_resource(so->buf[n]);
uint64_t iova = fd_bo_get_iova(rsc->bo);
+ // TODO need to scream if iova > 32b or fix gallium API..
*handles[i] += iova;
}
llvmpipe_set_global_binding(struct pipe_context *pipe,
unsigned first, unsigned count,
struct pipe_resource **resources,
- uint64_t **handles)
+ uint32_t **handles)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
struct lp_compute_shader *cs = llvmpipe->cs;
for (i = 0; i < count; i++) {
uint64_t va;
- uint64_t offset;
+ uint32_t offset;
pipe_resource_reference(&cs->global_buffers[first + i], resources[i]);
struct llvmpipe_resource *lp_res = llvmpipe_resource(resources[i]);
offset = *handles[i];
}
static inline void
-nv50_set_global_handle(uint64_t *phandle, struct pipe_resource *res)
+nv50_set_global_handle(uint32_t *phandle, struct pipe_resource *res)
{
struct nv04_resource *buf = nv04_resource(res);
if (buf) {
- *phandle = buf->address;
+ uint64_t limit = (buf->address + buf->base.width0) - 1;
+ if (limit < (1ULL << 32)) {
+ *phandle = (uint32_t)buf->address;
+ } else {
+ NOUVEAU_ERR("Cannot map into TGSI_RESOURCE_GLOBAL: "
+ "resource not contained within 32-bit address space !\n");
+ *phandle = 0;
+ }
} else {
*phandle = 0;
}
nv50_set_global_bindings(struct pipe_context *pipe,
unsigned start, unsigned nr,
struct pipe_resource **resources,
- uint64_t **handles)
+ uint32_t **handles)
{
struct nv50_context *nv50 = nv50_context(pipe);
struct pipe_resource **ptr;
}
static inline void
-nvc0_set_global_handle(uint64_t *phandle, struct pipe_resource *res)
+nvc0_set_global_handle(uint32_t *phandle, struct pipe_resource *res)
{
struct nv04_resource *buf = nv04_resource(res);
if (buf) {
- *phandle = buf->address;
+ uint64_t limit = (buf->address + buf->base.width0) - 1;
+ if (limit < (1ULL << 32)) {
+ *phandle = (uint32_t)buf->address;
+ } else {
+ NOUVEAU_ERR("Cannot map into TGSI_RESOURCE_GLOBAL: "
+ "resource not contained within 32-bit address space !\n");
+ *phandle = 0;
+ }
} else {
*phandle = 0;
}
nvc0_set_global_bindings(struct pipe_context *pipe,
unsigned start, unsigned nr,
struct pipe_resource **resources,
- uint64_t **handles)
+ uint32_t **handles)
{
struct nvc0_context *nvc0 = nvc0_context(pipe);
struct pipe_resource **ptr;
panfrost_set_global_binding(struct pipe_context *pctx,
unsigned first, unsigned count,
struct pipe_resource **resources,
- uint64_t **handles)
+ uint32_t **handles)
{
/* TODO */
}
static void evergreen_set_global_binding(struct pipe_context *ctx,
unsigned first, unsigned n,
struct pipe_resource **resources,
- uint64_t **handles)
+ uint32_t **handles)
{
struct r600_context *rctx = (struct r600_context *)ctx;
struct compute_memory_pool *pool = rctx->screen->global_pool;
for (i = first; i < first + n; i++)
{
- uint64_t buffer_offset;
- uint64_t handle;
+ uint32_t buffer_offset;
+ uint32_t handle;
assert(resources[i]->target == PIPE_BUFFER);
assert(resources[i]->bind & PIPE_BIND_GLOBAL);
- buffer_offset = util_le64_to_cpu(*(handles[i]));
+ buffer_offset = util_le32_to_cpu(*(handles[i]));
handle = buffer_offset + buffers[i]->chunk->start_in_dw * 4;
- *(handles[i]) = util_cpu_to_le64(handle);
+ *(handles[i]) = util_cpu_to_le32(handle);
}
/* globals for writing */
static void si_set_global_binding(
struct pipe_context *ctx, unsigned first, unsigned n,
struct pipe_resource **resources,
- uint64_t **handles)
+ uint32_t **handles)
{
unsigned i;
struct si_context *sctx = (struct si_context*)ctx;
for (i = 0; i < n; i++) {
uint64_t va;
- uint64_t offset;
+ uint32_t offset;
pipe_resource_reference(&program->global_buffers[first + i], resources[i]);
va = si_resource(resources[i])->gpu_address;
- offset = util_le64_to_cpu(*handles[i]);
+ offset = util_le32_to_cpu(*handles[i]);
va += offset;
va = util_cpu_to_le64(va);
memcpy(handles[i], &va, sizeof(va));
static void
tegra_set_global_binding(struct pipe_context *pcontext, unsigned int first,
unsigned int count, struct pipe_resource **resources,
- uint64_t **handles)
+ uint32_t **handles)
{
struct tegra_context *context = to_tegra_context(pcontext);
void (*set_global_binding)(struct pipe_context *context,
unsigned first, unsigned count,
struct pipe_resource **resources,
- uint64_t **handles);
+ uint32_t **handles);
/**
* Launch the compute kernel starting from instruction \a pc of the
// The handles are created during exec_context::bind(), so we need make
// sure to call exec_context::bind() before retrieving them.
- std::vector<uint64_t *> g_handles = map([&](size_t h) {
- return (uint64_t *)&exec.input[h];
+ std::vector<uint32_t *> g_handles = map([&](size_t h) {
+ return (uint32_t *)&exec.input[h];
}, exec.g_handles);
q.pipe->bind_compute_state(q.pipe, st);
}
static void init_globals(struct context *ctx, const int *slots,
- uint64_t **handles)
+ uint32_t **handles)
{
struct pipe_context *pipe = ctx->pipe;
struct pipe_resource *res[MAX_RESOURCES];
" STORE RGLOBAL.x, TEMP[1].yyyy, TEMP[1]\n"
" RET\n"
" ENDSUB\n";
- uint64_t input[8] = { 0x10001, 0x10002, 0x10003, 0x10004,
+ uint32_t input[8] = { 0x10001, 0x10002, 0x10003, 0x10004,
0x10005, 0x10006, 0x10007, 0x10008 };
printf("- %s\n", __func__);
init_tex(ctx, 3, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT, 32, 0,
test_default_init);
init_globals(ctx, (int []){ 0, 1, 2, 3, -1 },
- (uint64_t *[]){ &input[1], &input[3],
+ (uint32_t *[]){ &input[1], &input[3],
&input[5], &input[7] });
launch_grid(ctx, (uint []){4, 1, 1}, (uint []){1, 1, 1}, 0, input);
check_tex(ctx, 0, test_input_global_expect, NULL);