[Mesa-dev] [RFC] i965: Resolve color for all active shader images in intel_update_state().

Kristian Høgsberg krh at bitplanet.net
Mon Dec 7 15:45:45 PST 2015


On Sat, Sep 5, 2015 at 11:30 AM, Jordan Justen
<jordan.l.justen at intel.com> wrote:
> From: Francisco Jerez <currojerez at riseup.net>
>
> Fixes arb_shader_image_load_store/execution/load-from-cleared-image.shader_test
>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Jason Ekstrand <jason.ekstrand at intel.com>
> Tested-by: Jordan Justen <jordan.l.justen at intel.com>

This patch is required for correct behavior and looks straightforward
and correct to me. Let's fix the bug and optimize the CPU performance
regression (if there is one) later.

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

> ---
>  RE: i965: Perform an explicit flush after doing _mesa_meta_pbo_TexSubImage
>
>  curro has some concerns about potential perf impact by this and
>  wanted it to be checked on small-core w/CPU bound apps.
>  Unfortunately, he is on vacation now.
>
>  src/mesa/drivers/dri/i965/brw_context.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> index f0ed891..a274a43 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -189,6 +189,24 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)
>        brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
>     }
>
> +   /* Resolve color for each active shader image. */
> +   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
> +      const struct gl_shader *shader = ctx->_Shader->CurrentProgram[i] ?
> +         ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i] : NULL;
> +
> +      if (unlikely(shader && shader->NumImages)) {
> +         for (unsigned j = 0; j < shader->NumImages; j++) {
> +            struct gl_image_unit *u = &ctx->ImageUnits[shader->ImageUnits[j]];
> +            tex_obj = intel_texture_object(u->TexObj);
> +
> +            if (tex_obj && tex_obj->mt) {
> +               intel_miptree_resolve_color(brw, tex_obj->mt);
> +               brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
> +            }
> +         }
> +      }
> +   }
> +
>     _mesa_lock_context_textures(ctx);
>  }
>
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list