[Mesa-dev] [PATCH] intel/decoder: Use gen_group::dw_length when available
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Mon Apr 23 12:05:10 UTC 2018
On 23/04/18 12:20, Topi Pohjolainen wrote:
> Otherwise gen_group_get_length() will try to use first fields
> of, for example, CC_VIEWPORT and SF_CLIP to determine the
> group size. These packets are not present in the state with
> full header but simply with their contents while equivalent
> state pointers (3DSTATE_VIEWPORT_STATE_POINTERS_CC and
> 3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP respectively) telling
> their starting points.
>
> Before:
> -------
>
> 0xfffef540: 0x78230000: 3DSTATE_VIEWPORT_STATE_POINTERS_CC
>
> 0xfffef540: 0x78230000 : Dword 0
> DWord Length: 0
> 0xfffef544: 0x00000180 : Dword 1
> CC Viewport Pointer: 0x00000180
> CC_VIEWPORT 0
> 0xfffea180: 0x00000000 : Dword 0
> Minimum Depth: 0.000000
> 0xfffef548: 0x78210000: 3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP
> 0xfffef548: 0x78210000 : Dword 0
> DWord Length: 0
> 0xfffef54c: 0x000001c0 : Dword 1
> SF Clip Viewport Pointer: 0x000001c0
> SF_CLIP_VIEWPORT 0
> 0xfffea1c0: 0x41000000 : Dword 0
> Viewport Matrix Element m00: 0.000000
> 0xfffea1c4: 0x3f000000 : Dword 1
> Viewport Matrix Element m11: 0.500000
> 0xfffef550: 0x78240000: 3DSTATE_BLEND_STATE_POINTERS
>
> After:
> ------
>
> 0xfffef540: 0x78230000: 3DSTATE_VIEWPORT_STATE_POINTERS_CC
>
> 0xfffef540: 0x78230000 : Dword 0
> DWord Length: 0
> 0xfffef544: 0x00000180 : Dword 1
> CC Viewport Pointer: 0x00000180
> CC_VIEWPORT 0
> 0xfffea180: 0x00000000 : Dword 0
> Minimum Depth: 0.000000
> 0xfffea184: 0x3f800000 : Dword 1
> Maximum Depth: 1.000000
> 0xfffef548: 0x78210000: 3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP
> 0xfffef548: 0x78210000 : Dword 0
> DWord Length: 0
> 0xfffef54c: 0x000001c0 : Dword 1
> SF Clip Viewport Pointer: 0x000001c0
> SF_CLIP_VIEWPORT 0
> 0xfffea1c0: 0x41000000 : Dword 0
> Viewport Matrix Element m00: 0.000000
> 0xfffea1c4: 0x3f000000 : Dword 1
> Viewport Matrix Element m11: 0.500000
> 0xfffea1c8: 0x3f000000 : Dword 2
> Viewport Matrix Element m22: 0.500000
> 0xfffea1cc: 0x41000000 : Dword 3
> Viewport Matrix Element m30: 8.000000
> 0xfffea1d0: 0x3f000000 : Dword 4
> Viewport Matrix Element m31: 0.500000
> 0xfffea1d4: 0x3f000000 : Dword 5
> Viewport Matrix Element m32: 0.500000
> 0xfffea1d8: 0x00000000 : Dword 6
> 0xfffea1dc: 0x00000000 : Dword 7
> 0xfffea1e0: 0xc5000000 : Dword 8
> X Min Clip Guardband: -2048.000000
> 0xfffea1e4: 0x45000000 : Dword 9
> X Max Clip Guardband: 2048.000000
> 0xfffea1e8: 0xc7000000 : Dword 10
> Y Min Clip Guardband: -32768.000000
> 0xfffea1ec: 0x47000000 : Dword 11
> Y Max Clip Guardband: 32768.000000
> 0xfffea1f0: 0x00000000 : Dword 12
> X Min ViewPort: 0.000000
> 0xfffea1f4: 0x41700000 : Dword 13
> X Max ViewPort: 15.000000
> 0xfffea1f8: 0x00000000 : Dword 14
> Y Min ViewPort: 0.000000
> 0xfffea1fc: 0x00000000 : Dword 15
> Y Max ViewPort: 0.000000
>
> CC: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> CC: Kenneth Graunke <kenneth at whitecape.org>
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
> src/intel/common/gen_decoder.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
> index 1b8123b..cc212cc 100644
> --- a/src/intel/common/gen_decoder.c
> +++ b/src/intel/common/gen_decoder.c
> @@ -713,6 +713,9 @@ gen_group_find_field(struct gen_group *group, const char *name)
> int
> gen_group_get_length(struct gen_group *group, const uint32_t *p)
> {
> + if (group->dw_length)
> + return group->dw_length;
I don't think that'll work. Some instructions have length (as default
value) too but might have a variable DWord Length field as well.
I think the best approach is to flag <struct> & <register> elements in
the decoder and in get_length() have a if (group->is_struct ||
group->is_register) return group->dw_length;.
> +
> uint32_t h = p[0];
> uint32_t type = field_value(h, 29, 31);
>
More information about the mesa-dev
mailing list