diff options
author | Kenneth Graunke <[email protected]> | 2018-06-15 11:55:28 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:06 -0800 |
commit | 80dee3184662bc23f875d4fad06d490847827a80 (patch) | |
tree | abcc17a37c759e9abed9e79029f903ede212961b /src/gallium/drivers | |
parent | daceb04bc03fef2d341426f6c9fb093c34372f83 (diff) |
iris: save pointers to streamed state resources
will be used for cross-batch validation list fixing
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/iris/iris_context.h | 12 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 28 |
2 files changed, 29 insertions, 11 deletions
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 3696b069e52..6ebb595b798 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -269,6 +269,18 @@ struct iris_context { // "I'm streaming this out at draw time and never want it again!" struct u_upload_mgr *dynamic_uploader; + /** + * Resources containing streamed state which our render context + * currently points to. Used to re-add these to the validation + * list when we start a new batch and haven't resubmitted commands. + */ + struct { + struct pipe_resource *cc_vp; + struct pipe_resource *sf_cl_vp; + struct pipe_resource *color_calc; + struct pipe_resource *scissor; + struct pipe_resource *blend; + } last_res; } state; }; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 76481b4ccde..51edb98fc49 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -279,34 +279,34 @@ ro_bo(struct iris_bo *bo, uint64_t offset) static uint32_t * stream_state(struct iris_batch *batch, struct u_upload_mgr *uploader, + struct pipe_resource **out_res, unsigned size, unsigned alignment, uint32_t *out_offset) { - struct pipe_resource *res = NULL; void *ptr = NULL; - u_upload_alloc(uploader, 0, size, alignment, out_offset, &res, &ptr); + u_upload_alloc(uploader, 0, size, alignment, out_offset, out_res, &ptr); - struct iris_bo *bo = iris_resource_bo(res); + struct iris_bo *bo = iris_resource_bo(*out_res); iris_use_pinned_bo(batch, bo, false); *out_offset += iris_bo_offset_from_base_address(bo); - pipe_resource_reference(&res, NULL); - return ptr; } static uint32_t emit_state(struct iris_batch *batch, struct u_upload_mgr *uploader, + struct pipe_resource **out_res, const void *data, unsigned size, unsigned alignment) { unsigned offset = 0; - uint32_t *map = stream_state(batch, uploader, size, alignment, &offset); + uint32_t *map = + stream_state(batch, uploader, out_res, size, alignment, &offset); if (map) memcpy(map, data, size); @@ -2216,6 +2216,7 @@ iris_upload_render_state(struct iris_context *ice, iris_emit_cmd(batch, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_CC), ptr) { ptr.CCViewportPointer = emit_state(batch, ice->state.dynamic_uploader, + &ice->state.last_res.cc_vp, cso->cc_vp, sizeof(cso->cc_vp), 32); } } @@ -2224,8 +2225,9 @@ iris_upload_render_state(struct iris_context *ice, struct iris_viewport_state *cso = ice->state.cso_vp; iris_emit_cmd(batch, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP), ptr) { ptr.SFClipViewportPointer = - emit_state(batch, ice->state.dynamic_uploader, cso->sf_cl_vp, - 4 * GENX(SF_CLIP_VIEWPORT_length) * + emit_state(batch, ice->state.dynamic_uploader, + &ice->state.last_res.sf_cl_vp, + cso->sf_cl_vp, 4 * GENX(SF_CLIP_VIEWPORT_length) * ice->state.num_viewports, 64); } } @@ -2244,8 +2246,9 @@ iris_upload_render_state(struct iris_context *ice, cso_fb->nr_cbufs * GENX(BLEND_STATE_ENTRY_length)); uint32_t blend_offset; uint32_t *blend_map = - stream_state(batch, ice->state.dynamic_uploader, 4 * num_dwords, 64, - &blend_offset); + stream_state(batch, ice->state.dynamic_uploader, + &ice->state.last_res.blend, + 4 * num_dwords, 64, &blend_offset); uint32_t blend_state_header; iris_pack_state(GENX(BLEND_STATE), &blend_state_header, bs) { @@ -2268,6 +2271,7 @@ iris_upload_render_state(struct iris_context *ice, uint32_t cc_offset; void *cc_map = stream_state(batch, ice->state.dynamic_uploader, + &ice->state.last_res.color_calc, sizeof(uint32_t) * GENX(COLOR_CALC_STATE_length), 64, &cc_offset); iris_pack_state(GENX(COLOR_CALC_STATE), cc_map, cc) { @@ -2483,7 +2487,9 @@ iris_upload_render_state(struct iris_context *ice, if (dirty & IRIS_DIRTY_SCISSOR) { // XXX: allocate at set_scissor time? uint32_t scissor_offset = ice->state.num_scissors == 0 ? 0 : - emit_state(batch, ice->state.dynamic_uploader, ice->state.scissors, + emit_state(batch, ice->state.dynamic_uploader, + &ice->state.last_res.scissor, + ice->state.scissors, sizeof(struct pipe_scissor_state) * ice->state.num_scissors, 32); |