[igt-dev] [PATCH i-g-t 2/2] lib/kms: Use named initializers for prop name arrays

Ville Syrjala ville.syrjala at linux.intel.com
Fri Mar 16 18:16:49 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Decouple the prop name arrays from the actual enum values
by using named initializers. Should make it less likely that we
end up with the wrong property on account of getting the order
wrong.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_kms.c | 54 +++++++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 59f97cb4c5a0..9c0470b0288f 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -159,39 +159,39 @@ const unsigned char* igt_kms_get_base_edid(void)
 #include "igt_edid_template.h"
 
 const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
-	"SRC_X",
-	"SRC_Y",
-	"SRC_W",
-	"SRC_H",
-	"CRTC_X",
-	"CRTC_Y",
-	"CRTC_W",
-	"CRTC_H",
-	"FB_ID",
-	"CRTC_ID",
-	"IN_FENCE_FD",
-	"type",
-	"rotation",
-	"IN_FORMATS",
+	[IGT_PLANE_SRC_X] = "SRC_X",
+	[IGT_PLANE_SRC_Y] = "SRC_Y",
+	[IGT_PLANE_SRC_W] = "SRC_W",
+	[IGT_PLANE_SRC_H] = "SRC_H",
+	[IGT_PLANE_CRTC_X] = "CRTC_X",
+	[IGT_PLANE_CRTC_Y] = "CRTC_Y",
+	[IGT_PLANE_CRTC_W] = "CRTC_W",
+	[IGT_PLANE_CRTC_H] = "CRTC_H",
+	[IGT_PLANE_FB_ID] = "FB_ID",
+	[IGT_PLANE_CRTC_ID] = "CRTC_ID",
+	[IGT_PLANE_IN_FENCE_FD] = "IN_FENCE_FD",
+	[IGT_PLANE_TYPE] = "type",
+	[IGT_PLANE_ROTATION] = "rotation",
+	[IGT_PLANE_IN_FORMATS] = "IN_FORMATS",
 };
 
 const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
-	"background_color",
-	"CTM",
-	"GAMMA_LUT",
-	"GAMMA_LUT_SIZE",
-	"DEGAMMA_LUT",
-	"DEGAMMA_LUT_SIZE",
-	"MODE_ID",
-	"ACTIVE",
-	"OUT_FENCE_PTR"
+	[IGT_CRTC_BACKGROUND] = "background_color",
+	[IGT_CRTC_CTM] = "CTM",
+	[IGT_CRTC_GAMMA_LUT] = "GAMMA_LUT",
+	[IGT_CRTC_GAMMA_LUT_SIZE] = "GAMMA_LUT_SIZE",
+	[IGT_CRTC_DEGAMMA_LUT] = "DEGAMMA_LUT",
+	[IGT_CRTC_DEGAMMA_LUT_SIZE] = "DEGAMMA_LUT_SIZE",
+	[IGT_CRTC_MODE_ID] = "MODE_ID",
+	[IGT_CRTC_ACTIVE] = "ACTIVE",
+	[IGT_CRTC_OUT_FENCE_PTR] = "OUT_FENCE_PTR",
 };
 
 const char * const igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
-	"scaling mode",
-	"CRTC_ID",
-	"DPMS",
-	"Broadcast RGB"
+	[IGT_CONNECTOR_SCALING_MODE] = "scaling mode",
+	[IGT_CONNECTOR_CRTC_ID] = "CRTC_ID",
+	[IGT_CONNECTOR_DPMS] = "DPMS",
+	[IGT_CONNECTOR_BROADCAST_RGB] = "Broadcast RGB",
 };
 
 /*
-- 
2.16.1



More information about the igt-dev mailing list