[igt-dev] [PATCH i-g-t v3 2/3] lib/gen6_render: Reorder registers and fields definitions

Lukasz Kalamarz lukasz.kalamarz at intel.com
Wed Apr 11 14:45:12 UTC 2018


Definitions of shifts applicable to chosen register were in some cases
written in a different place in code. This patch is reordering that
and also is sorting registers definition in an ascending order by
it memory address.

Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz at intel.com>
Cc: Katarzyna Dec <katarzyna.dec at intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
---
 lib/gen6_render.h | 82 +++++++++++++++++++++++++------------------------------
 1 file changed, 37 insertions(+), 45 deletions(-)

diff --git a/lib/gen6_render.h b/lib/gen6_render.h
index 9e3e169..5d8884d 100644
--- a/lib/gen6_render.h
+++ b/lib/gen6_render.h
@@ -9,8 +9,12 @@
 					   ((Subopcode) << 16))
 
 #define GEN6_STATE_BASE_ADDRESS			GEN6_3D(0, 1, 1)
+# define BASE_ADDRESS_MODIFY		(1 << 0)
+# define BUFFER_SIZE_MODIFY		(1 << 0)
+
 #define GEN6_STATE_SIP				GEN6_3D(0, 1, 2)
 
+#define GEN6_3DSTATE_VF_STATISTICS		GEN6_3D(1, 0, 0xb)
 #define GEN6_PIPELINE_SELECT			GEN6_3D(1, 1, 4)
 
 #define GEN6_MEDIA_STATE_POINTERS		GEN6_3D(2, 0, 0)
@@ -21,33 +25,6 @@
 # define GEN6_3DSTATE_BINDING_TABLE_MODIFY_GS  (1 << 9) /* for GEN6 */
 # define GEN6_3DSTATE_BINDING_TABLE_MODIFY_VS  (1 << 8) /* for GEN6 */
 
-#define GEN6_3DSTATE_VERTEX_BUFFERS		GEN6_3D(3, 0, 8)
-#define GEN6_3DSTATE_VERTEX_ELEMENTS		GEN6_3D(3, 0, 9)
-#define GEN6_3DSTATE_INDEX_BUFFER		GEN6_3D(3, 0, 0xa)
-#define GEN6_3DSTATE_VF_STATISTICS		GEN6_3D(1, 0, 0xb)
-
-#define GEN6_3DSTATE_DRAWING_RECTANGLE		GEN6_3D(3, 1, 0)
-#define GEN6_3DSTATE_CONSTANT_COLOR		GEN6_3D(3, 1, 1)
-#define GEN6_3DSTATE_SAMPLER_PALETTE_LOAD	GEN6_3D(3, 1, 2)
-#define GEN6_3DSTATE_CHROMA_KEY			GEN6_3D(3, 1, 4)
-#define GEN6_3DSTATE_DEPTH_BUFFER		GEN6_3D(3, 1, 5)
-# define GEN6_3DSTATE_DEPTH_BUFFER_TYPE_SHIFT	29
-# define GEN6_3DSTATE_DEPTH_BUFFER_FORMAT_SHIFT	18
-
-#define GEN6_3DSTATE_POLY_STIPPLE_OFFSET		GEN6_3D(3, 1, 6)
-#define GEN6_3DSTATE_POLY_STIPPLE_PATTERN	GEN6_3D(3, 1, 7)
-#define GEN6_3DSTATE_LINE_STIPPLE		GEN6_3D(3, 1, 8)
-#define GEN6_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP	GEN6_3D(3, 1, 9)
-/* These two are BLC and CTG only, not BW or CL */
-#define GEN6_3DSTATE_AA_LINE_PARAMS		GEN6_3D(3, 1, 0xa)
-#define GEN6_3DSTATE_GS_SVB_INDEX		GEN6_3D(3, 1, 0xb)
-#define GEN6_3DSTATE_MONOFILTER_SIZE		GEN6_3D(3, 1, 0x11)
-#define GEN6_3DPRIMITIVE				GEN6_3D(3, 3, 0)
-
-#define GEN6_3DSTATE_CLEAR_PARAMS		GEN6_3D(3, 1, 0x10)
-/* DW1 */
-# define GEN6_3DSTATE_DEPTH_CLEAR_VALID		(1 << 15)
-
 #define GEN6_3DSTATE_SAMPLER_STATE_POINTERS	GEN6_3D(3, 0, 0x02)
 # define GEN6_3DSTATE_SAMPLER_STATE_MODIFY_PS	(1 << 12)
 # define GEN6_3DSTATE_SAMPLER_STATE_MODIFY_GS	(1 << 9)
@@ -61,6 +38,9 @@
 # define GEN6_3DSTATE_URB_GS_ENTRIES_SHIFT	8
 # define GEN6_3DSTATE_URB_GS_SIZE_SHIFT		0
 
+#define GEN6_3DSTATE_VERTEX_BUFFERS		GEN6_3D(3, 0, 8)
+#define GEN6_3DSTATE_VERTEX_ELEMENTS		GEN6_3D(3, 0, 9)
+#define GEN6_3DSTATE_INDEX_BUFFER		GEN6_3D(3, 0, 0xa)
 #define GEN6_3DSTATE_VIEWPORT_STATE_POINTERS	GEN6_3D(3, 0, 0x0d)
 # define GEN6_3DSTATE_VIEWPORT_STATE_MODIFY_CC		(1 << 12)
 # define GEN6_3DSTATE_VIEWPORT_STATE_MODIFY_SF		(1 << 11)
@@ -113,13 +93,27 @@
 # define GEN6_3DSTATE_WM_PERSPECTIVE_CENTROID_BARYCENTRIC	(1 << 11)
 # define GEN6_3DSTATE_WM_PERSPECTIVE_PIXEL_BARYCENTRIC		(1 << 10)
 
-
 #define GEN6_3DSTATE_CONSTANT_VS		GEN6_3D(3, 0, 0x15)
 #define GEN6_3DSTATE_CONSTANT_GS		GEN6_3D(3, 0, 0x16)
 #define GEN6_3DSTATE_CONSTANT_PS		GEN6_3D(3, 0, 0x17)
 
 #define GEN6_3DSTATE_SAMPLE_MASK		GEN6_3D(3, 0, 0x18)
 
+#define GEN6_3DSTATE_DRAWING_RECTANGLE		GEN6_3D(3, 1, 0)
+#define GEN6_3DSTATE_CONSTANT_COLOR		GEN6_3D(3, 1, 1)
+#define GEN6_3DSTATE_SAMPLER_PALETTE_LOAD	GEN6_3D(3, 1, 2)
+#define GEN6_3DSTATE_CHROMA_KEY			GEN6_3D(3, 1, 4)
+#define GEN6_3DSTATE_DEPTH_BUFFER		GEN6_3D(3, 1, 5)
+# define GEN6_3DSTATE_DEPTH_BUFFER_TYPE_SHIFT	29
+# define GEN6_3DSTATE_DEPTH_BUFFER_FORMAT_SHIFT	18
+
+#define GEN6_3DSTATE_POLY_STIPPLE_OFFSET		GEN6_3D(3, 1, 6)
+#define GEN6_3DSTATE_POLY_STIPPLE_PATTERN	GEN6_3D(3, 1, 7)
+#define GEN6_3DSTATE_LINE_STIPPLE		GEN6_3D(3, 1, 8)
+#define GEN6_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP	GEN6_3D(3, 1, 9)
+/* These two are BLC and CTG only, not BW or CL */
+#define GEN6_3DSTATE_AA_LINE_PARAMS		GEN6_3D(3, 1, 0xa)
+#define GEN6_3DSTATE_GS_SVB_INDEX		GEN6_3D(3, 1, 0xb)
 #define GEN6_3DSTATE_MULTISAMPLE		GEN6_3D(3, 1, 0x0d)
 /* DW1 */
 # define GEN6_3DSTATE_MULTISAMPLE_PIXEL_LOCATION_CENTER		(0 << 4)
@@ -128,13 +122,9 @@
 # define GEN6_3DSTATE_MULTISAMPLE_NUMSAMPLES_4			(2 << 1)
 # define GEN6_3DSTATE_MULTISAMPLE_NUMSAMPLES_8			(3 << 1)
 
-#define PIPELINE_SELECT_3D		0
-#define PIPELINE_SELECT_MEDIA		1
-
-/* for GEN6_STATE_BASE_ADDRESS */
-#define BASE_ADDRESS_MODIFY		(1 << 0)
-
-/* for GEN6_PIPE_CONTROL */
+#define GEN6_3DSTATE_CLEAR_PARAMS		GEN6_3D(3, 1, 0x10)
+/* DW1 */
+# define GEN6_3DSTATE_DEPTH_CLEAR_VALID		(1 << 15)
 #define GEN6_PIPE_CONTROL_NOWRITE       (0 << 14)
 #define GEN6_PIPE_CONTROL_WRITE_QWORD   (1 << 14)
 #define GEN6_PIPE_CONTROL_WRITE_DEPTH   (2 << 14)
@@ -147,6 +137,18 @@
 #define GEN6_PIPE_CONTROL_GLOBAL_GTT    (1 << 2)
 #define GEN6_PIPE_CONTROL_LOCAL_PGTT    (0 << 2)
 #define GEN6_PIPE_CONTROL_DEPTH_CACHE_FLUSH	(1 << 0)
+#define GEN6_3DSTATE_MONOFILTER_SIZE		GEN6_3D(3, 1, 0x11)
+#define GEN6_PIPE_CONTROL			GEN6_3D(3, 2, 0)
+
+#define GEN6_3DPRIMITIVE				GEN6_3D(3, 3, 0)
+#define GEN6_3DPRIMITIVE_VERTEX_SEQUENTIAL (0 << 15)
+#define GEN6_3DPRIMITIVE_VERTEX_RANDOM	  (1 << 15)
+/* Primitive types are in gen6_defines.h */
+#define GEN6_3DPRIMITIVE_TOPOLOGY_SHIFT	  10
+
+#define PIPELINE_SELECT_3D		0
+#define PIPELINE_SELECT_MEDIA		1
+
 
 /* VERTEX_BUFFER_STATE Structure */
 #define VB0_BUFFER_INDEX_SHIFT	26
@@ -166,11 +168,6 @@
 #define VE1_VFCOMPONENT_3_SHIFT		16
 #define VE1_DESTINATION_ELEMENT_OFFSET_SHIFT	0
 
-/* 3DPRIMITIVE bits */
-#define GEN6_3DPRIMITIVE_VERTEX_SEQUENTIAL (0 << 15)
-#define GEN6_3DPRIMITIVE_VERTEX_RANDOM	  (1 << 15)
-/* Primitive types are in gen6_defines.h */
-#define GEN6_3DPRIMITIVE_TOPOLOGY_SHIFT	  10
 
 #define GEN6_SVG_CTL		       0x7400
 
@@ -304,8 +301,6 @@
 #define GEN6_EU_ATT_CLR_1	       0x8834
 #define GEN6_EU_RDATA		       0x8840
 
-#define GEN6_PIPE_CONTROL			GEN6_3D(3, 2, 0)
-
 /* for GEN6+ */
 #define UF0_CS_REALLOC			(1 << 13)
 #define UF0_VFE_REALLOC			(1 << 12)
@@ -320,9 +315,6 @@
 #define UF2_VFE_FENCE_SHIFT		10
 #define UF2_SF_FENCE_SHIFT		0
 
-/* for GEN6_STATE_BASE_ADDRESS */
-#define BUFFER_SIZE_MODIFY		(1 << 0)
-
 /* for GEN6_3DSTATE_PIPELINED_POINTERS */
 #define GEN6_GS_DISABLE		       0
 #define GEN6_GS_ENABLE		       1
-- 
2.9.5



More information about the igt-dev mailing list