diff options
author | Rafael Antognolli <[email protected]> | 2019-02-28 11:08:32 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-03-13 14:45:13 -0700 |
commit | 9159a5bbf882f94c48c21371049fef2d03d3dafd (patch) | |
tree | d8cecd28eeae658f2fc46af16aa7ccdb4e1720c7 /src | |
parent | 759ceda07e122e3b2cc7a5e44698f41accb5e92c (diff) |
iris: Add resolve on iris_flush_resource.
The flush_resource hook is supposedly called when the resource content
needs to be made visible to external (okay, that's pretty vague). For
instance, it gets called before a surface gets handled to the window
system. So we need to resolve it if it's not resolved yet.
v2 (Ken):
- Check mod_info in iris_flush_resource instead of ISL_AUX_USAGE_NONE
- Drop my old broken resolve code from iris_resource_get_handle() now
that Rafael's got it hooked up in the right place.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index acb19364a3b..8bc162f797c 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -755,7 +755,6 @@ iris_resource_get_handle(struct pipe_screen *pscreen, struct winsys_handle *whandle, unsigned usage) { - struct iris_context *ice = (struct iris_context *)ctx; struct iris_resource *res = (struct iris_resource *)resource; /* If this is a buffer, stride should be 0 - no need to special case */ @@ -764,25 +763,16 @@ iris_resource_get_handle(struct pipe_screen *pscreen, res->mod_info ? res->mod_info->modifier : tiling_to_modifier(res->bo->tiling_mode); - if (ctx && - (!res->mod_info || res->mod_info->aux_usage != res->aux.usage)) { - struct iris_batch *render_batch = &ice->batches[IRIS_BATCH_RENDER]; - iris_resource_prepare_access(ice, render_batch, res, - 0, INTEL_REMAINING_LEVELS, - 0, INTEL_REMAINING_LAYERS, - ISL_AUX_USAGE_NONE, false); - if (res->aux.usage != ISL_AUX_USAGE_NONE) { - iris_resource_disable_aux(res); - ice->state.dirty |= IRIS_ALL_DIRTY_BINDINGS; - } - } else { - if (res->aux.usage != ISL_AUX_USAGE_NONE) { - enum isl_aux_state aux_state = - iris_resource_get_aux_state(res, 0, 0); - assert(aux_state == ISL_AUX_STATE_RESOLVED || - aux_state == ISL_AUX_STATE_PASS_THROUGH); - } +#ifndef NDEBUG + enum isl_aux_usage allowed_usage = + res->mod_info ? res->mod_info->aux_usage : ISL_AUX_USAGE_NONE; + + if (res->aux.usage != allowed_usage) { + enum isl_aux_state aux_state = iris_resource_get_aux_state(res, 0, 0); + assert(aux_state == ISL_AUX_STATE_RESOLVED || + aux_state == ISL_AUX_STATE_PASS_THROUGH); } +#endif switch (whandle->type) { case WINSYS_HANDLE_TYPE_SHARED: @@ -1338,6 +1328,16 @@ iris_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer *xfer) static void iris_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource) { + struct iris_context *ice = (struct iris_context *)ctx; + struct iris_batch *render_batch = &ice->batches[IRIS_BATCH_RENDER]; + struct iris_resource *res = (void *) resource; + const struct isl_drm_modifier_info *mod = res->mod_info; + + iris_resource_prepare_access(ice, render_batch, res, + 0, INTEL_REMAINING_LEVELS, + 0, INTEL_REMAINING_LAYERS, + mod ? mod->aux_usage : ISL_AUX_USAGE_NONE, + mod ? mod->supports_clear_color : false); } void |