[Mesa-dev] [PATCH 5/5] genxml: Make 3DSTATE_CONSTANT_BODY on Gen7+ use arrays.

Jason Ekstrand jason at jlekstrand.net
Sat May 20 14:08:07 UTC 2017


On May 20, 2017 12:24:53 AM Kenneth Graunke <kenneth at whitecape.org> wrote:

> This will let us initialize the constant buffers with loops.
> ---
>  src/intel/genxml/gen7.xml                     | 14 ++++++--------
>  src/intel/genxml/gen75.xml                    | 14 ++++++--------
>  src/intel/genxml/gen8.xml                     | 14 ++++++--------
>  src/intel/genxml/gen9.xml                     | 14 ++++++--------
>  src/intel/vulkan/genX_cmd_buffer.c            |  8 ++++----
>  src/mesa/drivers/dri/i965/genX_state_upload.c | 10 ++++------
>  6 files changed, 32 insertions(+), 42 deletions(-)
>
> diff --git a/src/intel/genxml/gen7.xml b/src/intel/genxml/gen7.xml
> index c98327a1915..169db321656 100644
> --- a/src/intel/genxml/gen7.xml
> +++ b/src/intel/genxml/gen7.xml
> @@ -378,15 +378,13 @@
>    </struct>
>
>    <struct name="3DSTATE_CONSTANT_BODY" length="6">
> -    <field name="Constant Buffer 1 Read Length" start="16" end="31" 
> type="uint"/>
> -    <field name="Constant Buffer 0 Read Length" start="0" end="15" 
> type="uint"/>
> -    <field name="Constant Buffer 3 Read Length" start="48" end="63" 
> type="uint"/>
> -    <field name="Constant Buffer 2 Read Length" start="32" end="47" 
> type="uint"/>
> -    <field name="Pointer To Constant Buffer 0" start="69" end="95" 
> type="address"/>
> +    <group count="4" start="0" size="16">
> +      <field name="ReadLength" start="0" end="15" type="uint"/>

You can leave the space in "Read Length"

> +    </group>
>      <field name="Constant Buffer Object Control State" start="64" end="68" 
>      type="MEMORY_OBJECT_CONTROL_STATE"/>
> -    <field name="Pointer To Constant Buffer 1" start="101" end="127" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 2" start="133" end="159" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 3" start="165" end="191" 
> type="address"/>
> +    <group count="4" start="64" size="32">
> +      <field name="Buffer" start="5" end="31" type="address"/>
> +    </group>
>    </struct>
>
>    <struct name="VERTEX_BUFFER_STATE" length="4">
> diff --git a/src/intel/genxml/gen75.xml b/src/intel/genxml/gen75.xml
> index 11f1462cd1f..c923189bc62 100644
> --- a/src/intel/genxml/gen75.xml
> +++ b/src/intel/genxml/gen75.xml
> @@ -377,15 +377,13 @@
>    </struct>
>
>    <struct name="3DSTATE_CONSTANT_BODY" length="6">
> -    <field name="Constant Buffer 1 Read Length" start="16" end="31" 
> type="uint"/>
> -    <field name="Constant Buffer 0 Read Length" start="0" end="15" 
> type="uint"/>
> -    <field name="Constant Buffer 3 Read Length" start="48" end="63" 
> type="uint"/>
> -    <field name="Constant Buffer 2 Read Length" start="32" end="47" 
> type="uint"/>
> -    <field name="Pointer To Constant Buffer 0" start="69" end="95" 
> type="address"/>
> +    <group count="4" start="0" size="16">
> +      <field name="ReadLength" start="0" end="15" type="uint"/>
> +    </group>
>      <field name="Constant Buffer Object Control State" start="64" end="68" 
>      type="MEMORY_OBJECT_CONTROL_STATE"/>
> -    <field name="Pointer To Constant Buffer 1" start="101" end="127" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 2" start="133" end="159" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 3" start="165" end="191" 
> type="address"/>
> +    <group count="4" start="64" size="32">
> +      <field name="Buffer" start="5" end="31" type="address"/>
> +    </group>
>    </struct>
>
>    <struct name="BINDING_TABLE_EDIT_ENTRY" length="1">
> diff --git a/src/intel/genxml/gen8.xml b/src/intel/genxml/gen8.xml
> index 541a788c82c..0b1e81e389d 100644
> --- a/src/intel/genxml/gen8.xml
> +++ b/src/intel/genxml/gen8.xml
> @@ -403,14 +403,12 @@
>    </enum>
>
>    <struct name="3DSTATE_CONSTANT_BODY" length="10">
> -    <field name="Constant Buffer 1 Read Length" start="16" end="31" 
> type="uint"/>
> -    <field name="Constant Buffer 0 Read Length" start="0" end="15" 
> type="uint"/>
> -    <field name="Constant Buffer 3 Read Length" start="48" end="63" 
> type="uint"/>
> -    <field name="Constant Buffer 2 Read Length" start="32" end="47" 
> type="uint"/>
> -    <field name="Pointer To Constant Buffer 0" start="69" end="127" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 1" start="133" end="191" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 2" start="197" end="255" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 3" start="261" end="319" 
> type="address"/>
> +    <group count="4" start="0" size="16">
> +      <field name="ReadLength" start="0" end="15" type="uint"/>
> +    </group>
> +    <group count="4" start="64" size="64">
> +      <field name="Buffer" start="5" end="63" type="address"/>
> +    </group>
>    </struct>
>
>    <struct name="BINDING_TABLE_EDIT_ENTRY" length="1">
> diff --git a/src/intel/genxml/gen9.xml b/src/intel/genxml/gen9.xml
> index a2c2020d140..d0e85af9c8a 100644
> --- a/src/intel/genxml/gen9.xml
> +++ b/src/intel/genxml/gen9.xml
> @@ -424,14 +424,12 @@
>    </enum>
>
>    <struct name="3DSTATE_CONSTANT_BODY" length="10">
> -    <field name="Constant Buffer 1 Read Length" start="16" end="31" 
> type="uint"/>
> -    <field name="Constant Buffer 0 Read Length" start="0" end="15" 
> type="uint"/>
> -    <field name="Constant Buffer 3 Read Length" start="48" end="63" 
> type="uint"/>
> -    <field name="Constant Buffer 2 Read Length" start="32" end="47" 
> type="uint"/>
> -    <field name="Pointer To Constant Buffer 0" start="69" end="127" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 1" start="133" end="191" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 2" start="197" end="255" 
> type="address"/>
> -    <field name="Pointer To Constant Buffer 3" start="261" end="319" 
> type="address"/>
> +    <group count="4" start="0" size="16">
> +      <field name="ReadLength" start="0" end="15" type="uint"/>
> +    </group>
> +    <group count="4" start="64" size="64">
> +      <field name="Buffer" start="5" end="63" type="address"/>
> +    </group>
>    </struct>
>
>    <struct name="BINDING_TABLE_EDIT_ENTRY" length="1">
> diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
> b/src/intel/vulkan/genX_cmd_buffer.c
> index ef9b7d0554c..5325e292694 100644
> --- a/src/intel/vulkan/genX_cmd_buffer.c
> +++ b/src/intel/vulkan/genX_cmd_buffer.c
> @@ -1457,11 +1457,11 @@ cmd_buffer_flush_push_constants(struct 
> anv_cmd_buffer *cmd_buffer)
>              c._3DCommandSubOpcode = push_constant_opcodes[stage],
>              c.ConstantBody = (struct GENX(3DSTATE_CONSTANT_BODY)) {
>  #if GEN_GEN >= 9
> -               .PointerToConstantBuffer2 = { 
> &cmd_buffer->device->dynamic_state_pool.block_pool.bo, state.offset },
> -               .ConstantBuffer2ReadLength = DIV_ROUND_UP(state.alloc_size, 
> 32),
> +               .Buffer[2] = { 
> &cmd_buffer->device->dynamic_state_pool.block_pool.bo, state.offset },
> +               .ReadLength[2] = DIV_ROUND_UP(state.alloc_size, 32),
>  #else
> -               .PointerToConstantBuffer0 = { .offset = state.offset },
> -               .ConstantBuffer0ReadLength = DIV_ROUND_UP(state.alloc_size, 
> 32),
> +               .Buffer[0] = { .offset = state.offset },
> +               .ReadLength[0] = DIV_ROUND_UP(state.alloc_size, 32),
>  #endif
>              };
>           }
> diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c 
> b/src/mesa/drivers/dri/i965/genX_state_upload.c
> index 5fad3b72e27..6a5e4f64056 100644
> --- a/src/mesa/drivers/dri/i965/genX_state_upload.c
> +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
> @@ -2598,14 +2598,12 @@ upload_constant_state(struct brw_context *brw,
>        pkt._3DCommandSubOpcode = push_constant_opcodes[stage];
>        if (active) {
>  #if GEN_GEN >= 8 || GEN_IS_HASWELL
> -         pkt.ConstantBody.ConstantBuffer2ReadLength =
> -            stage_state->push_const_size;
> -         pkt.ConstantBody.PointerToConstantBuffer2 =
> +         pkt.ConstantBody.ReadLength[2] = stage_state->push_const_size;
> +         pkt.ConstantBody.Buffer[2] =
>              render_ro_bo(brw->curbe.curbe_bo, stage_state->push_const_offset);
>  #else
> -         pkt.ConstantBody.ConstantBuffer0ReadLength =
> -            stage_state->push_const_size;
> -         pkt.ConstantBody.PointerToConstantBuffer0.offset =
> +         pkt.ConstantBody.ReadLength[0] = stage_state->push_const_size;
> +         pkt.ConstantBody.Buffer[0].offset =
>              stage_state->push_const_offset | mocs;
>  #endif
>        }
> --
> 2.12.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev




More information about the mesa-dev mailing list