iris: actually set KSP offsets
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 26 Jan 2018 04:12:37 +0000 (20:12 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:05 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_program_cache.c
src/gallium/drivers/iris/iris_state.c

index 27c0b13f72d918e2975d8c878df4a1acf52f2733..3d16cfedc31bb80de76adc6c2f53d7c2c8325614 100644 (file)
@@ -92,7 +92,7 @@ struct iris_compiled_shader {
    struct pipe_resource *buffer;
 
    /** Offset where the assembly lives in the BO. */
-   unsigned prog_offset;
+   unsigned offset;
 
    /** Pointer to the assembly in the BO's map. */
    void *map;
index 5ee0dae0467649a4a5cc91e42d7c530ba8157a6f..7fc318c862c08efcd378df37d399201be91b246c 100644 (file)
@@ -204,11 +204,11 @@ iris_upload_and_bind_shader(struct iris_context *ice,
     * backend.
     */
    if (existing) {
-      shader->prog_offset = existing->prog_offset;
+      shader->offset = existing->offset;
    } else {
       shader->buffer = NULL;
       u_upload_alloc(ice->shaders.uploader, 0, prog_data->program_size,
-                     64, &shader->prog_offset, &shader->buffer, &shader->map);
+                     64, &shader->offset, &shader->buffer, &shader->map);
       memcpy(shader->map, assembly, prog_data->program_size);
    }
 
index 01be4b86c3a51c81917bc028b634ec4b5d70fa96..10b81859bd305dc86b0b724f97438eb58f572f48 100644 (file)
@@ -1437,8 +1437,15 @@ iris_populate_fs_key(const struct iris_context *ice,
    //pkt.PerThreadScratchSpace = prog_data->total_scratch == 0 ? 0 :        \
       //ffs(stage_state->per_thread_scratch) - 11;                          \
 
+static uint64_t
+KSP(const struct iris_compiled_shader *shader)
+{
+   struct iris_resource *res = (void *) shader->buffer;
+   return res->bo->gtt_offset + shader->offset;
+}
+
 #define INIT_THREAD_DISPATCH_FIELDS(pkt, prefix)                          \
-   pkt.KernelStartPointer = shader->prog_offset;                          \
+   pkt.KernelStartPointer = KSP(shader);                                  \
    pkt.BindingTableEntryCount = prog_data->binding_table.size_bytes / 4;  \
    pkt.FloatingPointMode = prog_data->use_alt_mode;                       \
                                                                           \
@@ -1610,11 +1617,11 @@ iris_set_fs_state(const struct gen_device_info *devinfo,
          brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data, ps, 2);
 
       ps.KernelStartPointer0 =
-         shader->prog_offset + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 0);
+         KSP(shader) + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 0);
       ps.KernelStartPointer1 =
-         shader->prog_offset + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 1);
+         KSP(shader) + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 1);
       ps.KernelStartPointer2 =
-         shader->prog_offset + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 2);
+         KSP(shader) + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 2);
    }
 
    iris_pack_command(GENX(3DSTATE_PS_EXTRA), psx_state, psx) {