iris: Finish initializing the BO before stuffing it in the hash table
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 11 Sep 2019 06:56:10 +0000 (23:56 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 11 Sep 2019 15:10:47 +0000 (08:10 -0700)
Other threads may pick it up once it's in the hash table.  Not known
to fix anything currently.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
src/gallium/drivers/iris/iris_bufmgr.c

index 2dc7e3eec4ce45bcd2f49335fdaee6cff05aecfd..dfaba84b4998b6f50aaabd833db0e1b948f0fd2e 100644 (file)
@@ -1305,15 +1305,13 @@ iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd)
       bo->size = ret;
 
    bo->bufmgr = bufmgr;
-
-   bo->gem_handle = handle;
-   _mesa_hash_table_insert(bufmgr->handle_table, &bo->gem_handle, bo);
-
    bo->name = "prime";
    bo->reusable = false;
    bo->external = true;
    bo->kflags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_PINNED;
    bo->gtt_offset = vma_alloc(bufmgr, IRIS_MEMZONE_OTHER, bo->size, 1);
+   bo->gem_handle = handle;
+   _mesa_hash_table_insert(bufmgr->handle_table, &bo->gem_handle, bo);
 
    struct drm_i915_gem_get_tiling get_tiling = { .handle = bo->gem_handle };
    if (gen_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling))