[Mesa-dev] [PATCH 06/10] i965: Factor out code for setting Message Descriptors.

Eric Anholt eric at anholt.net
Wed Oct 12 09:44:54 PDT 2011


On Mon, 10 Oct 2011 16:31:49 -0700, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Every brw_set_???_message function had duplicated code, per-generation,
> to set the Message Descriptor and Extended Message Descriptor bits
> (SFID, message length, response length, header present, end of thread).
> 
> However, these fields are actually specified as part of the SEND
> instruction itself; individual types of messages don't even specify
> them (except for header present, but that's in the same bit location).
> 
> Since these are exactly the same regardless of the message type, just
> create a function to set them, using the generic message structs.  This
> not only shortens the code, but hides a lot of the per-generation
> complexity (like the SFID being in destreg__conditionalmod) in one spot.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_eu_emit.c |  195 ++++++++++++-------------------
>  1 files changed, 73 insertions(+), 122 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
> index 28bd52f..29aa39b 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c

> @@ -543,59 +544,47 @@ brw_set_dp_write_message(struct brw_compile *p,
>  {
>     struct brw_context *brw = p->brw;
>     struct intel_context *intel = &brw->intel;
> -   brw_set_src1(p, insn, brw_imm_ud(0));
> +   unsigned sfid;
>  
>     if (intel->gen >= 7) {
>        /* Use the Render Cache for RT writes; otherwise use the Data Cache */
> -      unsigned sfid = GEN7_SFID_DATAPORT_DATA_CACHE;
>        if (msg_type == GEN6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE)
>  	 sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
> +      else
> +	 sfid = GEN7_SFID_DATAPORT_DATA_CACHE;
> +   } else if (intel->gen == 6) {
> +      /* Use the render cache for all write messages. */
> +      sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
> +   } else {
> +      sfid = BRW_SFID_DATAPORT_WRITE;
> +   }

Ah, I hadn't understood that this was happening when I was looking at
patch 1/10 and complaining about reads from DATA_CACHE.  I'm cool with
that now.

Both this and that are:

Reviewed-by: Eric Anholt <eric at anholt.net>

which I think makes everything but 2/10.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111012/3a077265/attachment-0001.pgp>


More information about the mesa-dev mailing list