From: Kenneth Graunke Date: Fri, 26 Jan 2018 04:04:37 +0000 (-0800) Subject: iris: actually softpin at an address X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f1c07d7dd465e1c18a3641ac9e0b759e19c4060;p=mesa.git iris: actually softpin at an address --- diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 2566806ee27..b07664bc88d 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -262,6 +262,11 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, if (!res->bo) goto fail; + if (templ->flags & IRIS_RESOURCE_FLAG_INSTRUCTION_CACHE) { + // XXX: p_atomic_add is backwards :( + res->bo->gtt_offset = __atomic_fetch_add(&screen->next_instruction_address, res->bo->size, __ATOMIC_ACQ_REL); + } + return &res->base; fail: diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index 677860ee3e1..5f1caff180c 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -526,5 +526,8 @@ iris_screen_create(int fd) pscreen->fence_finish = iris_fence_finish; pscreen->query_memory_info = iris_query_memory_info; + /* Put them somewhere non-zero */ + screen->next_instruction_address = 128 * 1024; + return pscreen; } diff --git a/src/gallium/drivers/iris/iris_screen.h b/src/gallium/drivers/iris/iris_screen.h index 5484e535ac9..f24f567532f 100644 --- a/src/gallium/drivers/iris/iris_screen.h +++ b/src/gallium/drivers/iris/iris_screen.h @@ -47,6 +47,8 @@ struct iris_screen { struct isl_device isl_dev; struct iris_bufmgr *bufmgr; struct brw_compiler *compiler; + + uint32_t next_instruction_address; }; struct pipe_screen *iris_screen_create(int fd);