key->max_threads = 1;
else {
/* WM maximum threads is number of EUs times number of threads per EU. */
- if (BRW_IS_IGDNG(brw))
+ if (brw->gen == 5)
key->max_threads = 12 * 6;
- else if (BRW_IS_G4X(brw))
+ else if (brw->is_g4x)
key->max_threads = 10 * 5;
else
key->max_threads = 8 * 4;
key->line_stipple = brw->curr.rast->templ.line_stipple_enable;
- key->offset_enable = (brw->curr.rast->templ.offset_cw ||
- brw->curr.rast->templ.offset_ccw);
+ key->offset_enable = (brw->curr.rast->templ.offset_point ||
+ brw->curr.rast->templ.offset_line ||
+ brw->curr.rast->templ.offset_tri);
key->offset_units = brw->curr.rast->templ.offset_units;
key->offset_factor = brw->curr.rast->templ.offset_scale;
*/
static enum pipe_error
wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
- struct brw_winsys_buffer **reloc_bufs,
+ struct brw_winsys_reloc *reloc,
+ unsigned nr_reloc,
struct brw_winsys_buffer **bo_out)
{
struct brw_wm_unit_state wm;
memset(&wm, 0, sizeof(wm));
wm.thread0.grf_reg_count = align(key->total_grf, 16) / 16 - 1;
- wm.thread0.kernel_start_pointer = brw->wm.prog_bo->offset[0] >> 6; /* reloc */
+ wm.thread0.kernel_start_pointer = 0; /* reloc */
wm.thread1.depth_coef_urb_read_offset = 1;
wm.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754;
- if (BRW_IS_IGDNG(brw))
+ if (brw->gen == 5)
wm.thread1.binding_table_entry_count = 0; /* hardware requirement */
else
wm.thread1.binding_table_entry_count = key->nr_surfaces;
if (key->total_scratch != 0) {
- wm.thread2.scratch_space_base_pointer =
- brw->wm.scratch_bo->offset[0] >> 10; /* reloc */
+ wm.thread2.scratch_space_base_pointer = 0; /* reloc */
wm.thread2.per_thread_scratch_space = key->total_scratch / 1024 - 1;
} else {
wm.thread2.scratch_space_base_pointer = 0;
wm.thread3.const_urb_entry_read_length = key->curb_entry_read_length;
wm.thread3.const_urb_entry_read_offset = key->curbe_offset * 2;
- if (BRW_IS_IGDNG(brw))
+ if (brw->gen == 5)
wm.wm4.sampler_count = 0; /* hardware requirement */
else
wm.wm4.sampler_count = (key->sampler_count + 1) / 4;
- if (brw->wm.sampler_bo != NULL) {
- /* reloc */
- wm.wm4.sampler_state_pointer = brw->wm.sampler_bo->offset[0] >> 5;
- } else {
- wm.wm4.sampler_state_pointer = 0;
- }
+ /* reloc */
+ wm.wm4.sampler_state_pointer = 0;
wm.wm5.program_uses_depth = key->uses_depth;
wm.wm5.program_computes_depth = key->computes_depth;
wm.wm5.line_stipple = key->line_stipple;
- if (BRW_DEBUG & DEBUG_STATS || key->stats_wm)
+ if ((BRW_DEBUG & DEBUG_STATS) || key->stats_wm)
wm.wm4.stats_enable = 1;
ret = brw_upload_cache(&brw->cache, BRW_WM_UNIT,
key, sizeof(*key),
- reloc_bufs, 3,
+ reloc, nr_reloc,
&wm, sizeof(wm),
NULL, NULL,
bo_out);
if (ret)
return ret;
- /* Emit WM program relocation */
- ret = brw->sws->bo_emit_reloc(*bo_out,
- BRW_USAGE_STATE,
- wm.thread0.grf_reg_count << 1,
- offsetof(struct brw_wm_unit_state, thread0),
- brw->wm.prog_bo);
- if (ret)
- return ret;
-
- /* Emit scratch space relocation */
- if (key->total_scratch != 0) {
- ret = brw->sws->bo_emit_reloc(*bo_out,
- BRW_USAGE_SCRATCH,
- wm.thread2.per_thread_scratch_space,
- offsetof(struct brw_wm_unit_state, thread2),
- brw->wm.scratch_bo);
- if (ret)
- return ret;
- }
-
- /* Emit sampler state relocation */
- if (key->sampler_count != 0) {
- ret = brw->sws->bo_emit_reloc(*bo_out,
- BRW_USAGE_STATE,
- wm.wm4.stats_enable | (wm.wm4.sampler_count << 2),
- offsetof(struct brw_wm_unit_state, wm4),
- brw->wm.sampler_bo);
- if (ret)
- return ret;
- }
-
return PIPE_OK;
}
static enum pipe_error upload_wm_unit( struct brw_context *brw )
{
struct brw_wm_unit_key key;
- struct brw_winsys_buffer *reloc_bufs[3];
+ struct brw_winsys_reloc reloc[3];
+ unsigned nr_reloc = 0;
enum pipe_error ret;
+ unsigned grf_reg_count;
+ unsigned per_thread_scratch_space;
+ unsigned stats_enable;
+ unsigned sampler_count;
wm_unit_populate_key(brw, &key);
+
/* Allocate the necessary scratch space if we haven't already. Don't
* bother reducing the allocation later, since we use scratch so
* rarely.
}
}
- reloc_bufs[0] = brw->wm.prog_bo;
- reloc_bufs[1] = brw->wm.scratch_bo;
- reloc_bufs[2] = brw->wm.sampler_bo;
+
+ /* XXX: temporary:
+ */
+ grf_reg_count = (align(key.total_grf, 16) / 16 - 1);
+ per_thread_scratch_space = key.total_scratch / 1024 - 1;
+ stats_enable = (BRW_DEBUG & DEBUG_STATS) || key.stats_wm;
+ sampler_count = brw->gen == 5 ? 0 :(key.sampler_count + 1) / 4;
+
+ /* Emit WM program relocation */
+ make_reloc(&reloc[nr_reloc++],
+ BRW_USAGE_STATE,
+ grf_reg_count << 1,
+ offsetof(struct brw_wm_unit_state, thread0),
+ brw->wm.prog_bo);
+
+ /* Emit scratch space relocation */
+ if (key.total_scratch != 0) {
+ make_reloc(&reloc[nr_reloc++],
+ BRW_USAGE_SCRATCH,
+ per_thread_scratch_space,
+ offsetof(struct brw_wm_unit_state, thread2),
+ brw->wm.scratch_bo);
+ }
+
+ /* Emit sampler state relocation */
+ if (key.sampler_count != 0) {
+ make_reloc(&reloc[nr_reloc++],
+ BRW_USAGE_STATE,
+ stats_enable | (sampler_count << 2),
+ offsetof(struct brw_wm_unit_state, wm4),
+ brw->wm.sampler_bo);
+ }
+
if (brw_search_cache(&brw->cache, BRW_WM_UNIT,
&key, sizeof(key),
- reloc_bufs, 3,
+ reloc, nr_reloc,
NULL,
&brw->wm.state_bo))
return PIPE_OK;
- ret = wm_unit_create_from_key(brw, &key, reloc_bufs,
+ ret = wm_unit_create_from_key(brw, &key,
+ reloc, nr_reloc,
&brw->wm.state_bo);
if (ret)
return ret;