-static dri_bo *
-gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key)
-{
- struct intel_context *intel = &brw->intel;
- struct brw_gs_unit_state gs;
- dri_bo *bo;
-
- memset(&gs, 0, sizeof(gs));
-
- gs.thread0.grf_reg_count = ALIGN(key->total_grf, 16) / 16 - 1;
- if (key->prog_active) /* reloc */
- gs.thread0.kernel_start_pointer = brw->gs.prog_bo->offset >> 6;
-
- gs.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754;
- gs.thread1.single_program_flow = 1;
-
- gs.thread3.dispatch_grf_start_reg = 1;
- gs.thread3.const_urb_entry_read_offset = 0;
- gs.thread3.const_urb_entry_read_length = 0;
- gs.thread3.urb_entry_read_offset = 0;
- gs.thread3.urb_entry_read_length = key->urb_entry_read_length;
-
- gs.thread4.nr_urb_entries = key->nr_urb_entries;
- gs.thread4.urb_entry_allocation_size = key->urb_size - 1;
-
- if (key->nr_urb_entries >= 8)
- gs.thread4.max_threads = 1;
- else
- gs.thread4.max_threads = 0;
-
- if (intel->is_ironlake)
- gs.thread4.rendering_enable = 1;
-
- if (INTEL_DEBUG & DEBUG_STATS)
- gs.thread4.stats_enable = 1;
-
- bo = brw_upload_cache(&brw->cache, BRW_GS_UNIT,
- key, sizeof(*key),
- &brw->gs.prog_bo, 1,
- &gs, sizeof(gs));
-
- if (key->prog_active) {
- /* Emit GS program relocation */
- dri_bo_emit_reloc(bo,
- I915_GEM_DOMAIN_INSTRUCTION, 0,
- gs.thread0.grf_reg_count << 1,
- offsetof(struct brw_gs_unit_state, thread0),
- brw->gs.prog_bo);
- }
-
- return bo;
-}