meson,i965: Link with android deps when building for android.
[mesa.git] / src / gallium / drivers / iris / iris_binder.c
index ca60287df3f336cdcf5ea564470b2f182e169d2b..ab15ec987d6c6b4f9e05b2412a93b4bc40e3a556 100644 (file)
@@ -71,10 +71,23 @@ binder_realloc(struct iris_context *ice)
    struct iris_bufmgr *bufmgr = screen->bufmgr;
    struct iris_binder *binder = &ice->state.binder;
 
-   iris_bo_unreference(binder->bo);
+   uint64_t next_address = IRIS_MEMZONE_BINDER_START;
+
+   if (binder->bo) {
+      /* Place the new binder just after the old binder, unless we've hit the
+       * end of the memory zone...then wrap around to the start again.
+       */
+      next_address = binder->bo->gtt_offset + IRIS_BINDER_SIZE;
+      if (next_address >= IRIS_MEMZONE_SURFACE_START)
+         next_address = IRIS_MEMZONE_BINDER_START;
+
+      iris_bo_unreference(binder->bo);
+   }
+
 
    binder->bo =
       iris_bo_alloc(bufmgr, "binder", IRIS_BINDER_SIZE, IRIS_MEMZONE_BINDER);
+   binder->bo->gtt_offset = next_address;
    binder->map = iris_bo_map(NULL, binder->bo, MAP_WRITE);
    binder->insert_point = INIT_INSERT_POINT;
 
@@ -137,11 +150,8 @@ iris_binder_reserve_3d(struct iris_context *ice)
       if (!shaders[stage])
          continue;
 
-      const struct brw_stage_prog_data *prog_data =
-         (const void *) shaders[stage]->prog_data;
-
       /* Round up the size so our next table has an aligned starting offset */
-      sizes[stage] = align(prog_data->binding_table.size_bytes, BTP_ALIGNMENT);
+      sizes[stage] = align(shaders[stage]->bt.size_bytes, BTP_ALIGNMENT);
    }
 
    /* Make space for the new binding tables...this may take two tries. */
@@ -173,6 +183,8 @@ iris_binder_reserve_3d(struct iris_context *ice)
    for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
       if (ice->state.dirty & (IRIS_DIRTY_BINDINGS_VS << stage)) {
          binder->bt_offset[stage] = sizes[stage] > 0 ? offset : 0;
+         iris_record_state_size(ice->state.sizes,
+                                binder->bo->gtt_offset + offset, sizes[stage]);
          offset += sizes[stage];
       }
    }
@@ -185,10 +197,10 @@ iris_binder_reserve_compute(struct iris_context *ice)
       return;
 
    struct iris_binder *binder = &ice->state.binder;
-   struct brw_stage_prog_data *prog_data =
-      ice->shaders.prog[MESA_SHADER_COMPUTE]->prog_data;
+   struct iris_compiled_shader *shader =
+      ice->shaders.prog[MESA_SHADER_COMPUTE];
 
-   unsigned size = prog_data->binding_table.size_bytes;
+   unsigned size = shader->bt.size_bytes;
 
    if (size == 0)
       return;