OSDN Git Service

intel/decoder: Clean up field iteration and fix sub-dword fields
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 24 Aug 2018 20:23:04 +0000 (15:23 -0500)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 25 Aug 2018 12:50:36 +0000 (07:50 -0500)
commit2abd7ae189135eb5a1f530a3a1c9412d3a7e238d
treeb74d4248ae3a43173130733699fb5e276198086b
parent1281608849a058fcdbe2f64481a159d58af3d888
intel/decoder: Clean up field iteration and fix sub-dword fields

First of all, setting iter->name in advance_field is unnecessary because
it gets set by gen_decode_field which gets called immediately after
gen_decode_field in the one call-site.  Second, we weren't properly
initializing start_bit and end_bit in the initial condition of
gen_field_iterator_next so the first field of a struct would get printed
wrong if it doesn't start on the first bit.  This is fixed by adding a
iter_start_field helper which sets the field and also sets up the other
bits we need.  This fixes decoding of 3DSTATE_SBE_SWIZ.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/common/gen_decoder.c