iris: actually softpin at an address
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 26 Jan 2018 04:04:37 +0000 (20:04 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:05 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_screen.c
src/gallium/drivers/iris/iris_screen.h

index 2566806ee27b1298832e6aa3b3b85e5c43e38ec4..b07664bc88d4ed8639753810d29d03d4e194f090 100644 (file)
@@ -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:
index 677860ee3e10855700a7449bb2cad5be50dce6f2..5f1caff180c9c7b1e42d2f7069a72518d6983d65 100644 (file)
@@ -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;
 }
index 5484e535ac92427bdcab7481a5cdad4f29f5f56c..f24f567532fb1396aefbd5fc7581af26d898d834 100644 (file)
@@ -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);