Skip to contentSkip to conversation

drm/i915/sdvo: Fix handling if zero hbuf size

PATCH In review Ville Syrjala 4 participants 16 messages Jun 19, 2019 – Jul 10, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 drm/i915/sdvo: Fix handling if zero hbuf size

From: Ville Syrjälä <[email protected]>

The spec says:
"A value of 0 indicates that this buffer does not exist" So we should not convert a hbuf_size of 0 into 1.

Also pull the relevant code into a helper to avoid making the same mistake multiple times.

And while at it fix the debug prints to not say "hbuf_len" twice.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 32 ++++++++++++++---------
 1 file changed, 19 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +19 -13
index ceda03e5a3d4..681411aae754 100644
@@ -929,6 +929,20 @@ static bool intel_sdvo_set_audio_state(struct intel_sdvo *intel_sdvo,
 				    &audio_state, 1);
 }
 
+static bool intel_sdvo_get_hbuf_size(struct intel_sdvo *intel_sdvo,
+				     u8 *hbuf_size)
+{
+	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,
+				  hbuf_size, 1))
+		return false;
+
+	/* Buffer size is 0 based, hooray! However zero means zero. */
+	if (*hbuf_size)
+		(*hbuf_size)++;
+
+	return true;
+}
+
 #if 0
 static void intel_sdvo_dump_hdmi_buf(struct intel_sdvo *intel_sdvo)
 {
@@ -972,14 +986,10 @@ static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo,
 				  set_buf_index, 2))
 		return false;
 
-	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,
-				  &hbuf_size, 1))
+	if (!intel_sdvo_get_hbuf_size(intel_sdvo, &hbuf_size))
 		return false;
 
-	/* Buffer size is 0 based, hooray! */
-	hbuf_size++;
-
-	DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n",
+	DRM_DEBUG_KMS("writing sdvo hbuf: %i, length %i, hbuf_size: %i\n",
 		      if_index, length, hbuf_size);
 
 	if (hbuf_size < length)
@@ -1030,14 +1040,10 @@ static ssize_t intel_sdvo_read_infoframe(struct intel_sdvo *intel_sdvo,
 	if (tx_rate == SDVO_HBUF_TX_DISABLED)
 		return 0;
 
-	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,
-				  &hbuf_size, 1))
-		return -ENXIO;
-
-	/* Buffer size is 0 based, hooray! */
-	hbuf_size++;
+	if (!intel_sdvo_get_hbuf_size(intel_sdvo, &hbuf_size))
+		return false;
 
-	DRM_DEBUG_KMS("reading sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n",
+	DRM_DEBUG_KMS("reading sdvo hbuf: %i, length %i, hbuf_size: %i\n",
 		      if_index, length, hbuf_size);
 
 	hbuf_size = min_t(unsigned int, length, hbuf_size);
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/6 drm/i915/sdvo: Use named initializers for the SDVO command names

From: Ville Syrjälä <[email protected]>

Use named initializers to make it easier to associate the SDVO debug prints with the SDVO command defines. Also switch to using ARRAY_SIZE() instead of assuming that SDVO_CMD_STATUS_SCALING_NOT_SUPP is the last command type.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +8 -8
index 681411aae754..fb77176b9a8c 100644
@@ -429,13 +429,13 @@ static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
 }
 
 static const char * const cmd_status_names[] = {
-	"Power on",
-	"Success",
-	"Not supported",
-	"Invalid arg",
-	"Pending",
-	"Target not specified",
-	"Scaling not supported"
+	[SDVO_CMD_STATUS_POWER_ON] = "Power on",
+	[SDVO_CMD_STATUS_SUCCESS] = "Success",
+	[SDVO_CMD_STATUS_NOTSUPP] = "Not supported",
+	[SDVO_CMD_STATUS_INVALID_ARG] = "Invalid arg",
+	[SDVO_CMD_STATUS_PENDING] = "Pending",
+	[SDVO_CMD_STATUS_TARGET_NOT_SPECIFIED] = "Target not specified",
+	[SDVO_CMD_STATUS_SCALING_NOT_SUPP] = "Scaling not supported",
 };
 
 static bool __intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
@@ -562,7 +562,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
 #define BUF_PRINT(args...) \
 	pos += snprintf(buffer + pos, max_t(int, BUF_LEN - pos, 0), args)
 
-	if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP)
+	if (status < ARRAY_SIZE(cmd_status_names))
 		BUF_PRINT("(%s)", cmd_status_names[status]);
 	else
 		BUF_PRINT("(??? %d)", status);
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/6
#2 lore raw

Re: [PATCH 2/6] drm/i915/sdvo: Use named initializers for the SDVO command names

Quoting Ville Syrjala (2019-06-19 19:03:08)

Quoted 38 lines

From: Ville Syrjälä <[email protected]>

Use named initializers to make it easier to associate the SDVO debug prints with the SDVO command defines. Also switch to using ARRAY_SIZE() instead of assuming that SDVO_CMD_STATUS_SCALING_NOT_SUPP is the last command type.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +7 -7
index 681411aae754..fb77176b9a8c 100644
@@ -429,13 +429,13 @@ static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
 }
 
 static const char * const cmd_status_names[] = {
-       "Power on",
-       "Success",
-       "Not supported",
-       "Invalid arg",
-       "Pending",
-       "Target not specified",
-       "Scaling not supported"
+       [SDVO_CMD_STATUS_POWER_ON] = "Power on",
+       [SDVO_CMD_STATUS_SUCCESS] = "Success",
+       [SDVO_CMD_STATUS_NOTSUPP] = "Not supported",
+       [SDVO_CMD_STATUS_INVALID_ARG] = "Invalid arg",
+       [SDVO_CMD_STATUS_PENDING] = "Pending",
+       [SDVO_CMD_STATUS_TARGET_NOT_SPECIFIED] = "Target not specified",
+       [SDVO_CMD_STATUS_SCALING_NOT_SUPP] = "Scaling not supported",
 };
 
 static bool __intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,

drivers/gpu/drm/i915/display/intel_sdvo.c static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo, · line 565

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_sdvo.c +1 -1
@@ -562,7 +562,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
 #define BUF_PRINT(args...) \
        pos += snprintf(buffer + pos, max_t(int, BUF_LEN - pos, 0), args)
 
-       if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP)
+       if (status < ARRAY_SIZE(cmd_status_names))

And might as well be defensive (strings vs HW vs dev),

	if (status < ARRAY_SIZE(cmd_status_names) &&
	    cmd_status_names[status]))

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

PATCH 3/6 drm/i915/sdvo: Remove duplicate SET_INPUT_TIMINGS_PART1 cmd name string

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

sdvo_cmd_names[] contains two entries for SET_INPUT_TIMINGS_PART1. Remove one of them.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +0 -1
index fb77176b9a8c..2de7948b7278 100644
@@ -299,7 +299,6 @@ static const struct _sdvo_cmd_name {
 	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_INPUT_TIMINGS_PART2),
 	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_INPUT_TIMINGS_PART1),
 	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_INPUT_TIMINGS_PART2),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_INPUT_TIMINGS_PART1),
 	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_OUTPUT_TIMINGS_PART1),
 	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_OUTPUT_TIMINGS_PART2),
 	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_OUTPUT_TIMINGS_PART1),
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/6
#4 lore raw

Re: [PATCH 3/6] drm/i915/sdvo: Remove duplicate SET_INPUT_TIMINGS_PART1 cmd name string

Quoting Ville Syrjala (2019-06-19 19:03:09)

Quoted 15 lines

From: Ville Syrjälä <[email protected]>

sdvo_cmd_names[] contains two entries for SET_INPUT_TIMINGS_PART1. Remove one of them.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +0 -0
index fb77176b9a8c..2de7948b7278 100644

drivers/gpu/drm/i915/display/intel_sdvo.c static const struct _sdvo_cmd_name { · line 302

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_sdvo.c +0 -1
@@ -299,7 +299,6 @@ static const struct _sdvo_cmd_name {
        SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_INPUT_TIMINGS_PART2),
        SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_INPUT_TIMINGS_PART1),
        SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_INPUT_TIMINGS_PART2),
-       SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_INPUT_TIMINGS_PART1),

Meant to be get? Nope, it's a duplicate.

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

PATCH 4/6 drm/i915/sdvo: Shrink sdvo_cmd_names[] strings

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Drop the redundant "SDVO_CMD_" prefix from the command name strings in sdvo_cmd_names[].

While at it throw away the unused struct name, and undef SDVO_CMD_NAME_ENTRY() when we're done.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 219 +++++++++++-----------
 1 file changed, 111 insertions(+), 108 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +111 -108
index 2de7948b7278..d1fd2bc01d82 100644
@@ -274,124 +274,127 @@ static bool intel_sdvo_read_byte(struct intel_sdvo *intel_sdvo, u8 addr, u8 *ch)
 	return false;
 }
 
-#define SDVO_CMD_NAME_ENTRY(cmd) {cmd, #cmd}
+#define SDVO_CMD_NAME_ENTRY(cmd_) { .cmd = SDVO_CMD_ ## cmd_, .name = #cmd_ }
+
 /** Mapping of command numbers to names, for debug output */
-static const struct _sdvo_cmd_name {
+static const struct {
 	u8 cmd;
 	const char *name;
 } __attribute__ ((packed)) sdvo_cmd_names[] = {
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_RESET),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_DEVICE_CAPS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_FIRMWARE_REV),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_TRAINED_INPUTS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_ACTIVE_OUTPUTS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_ACTIVE_OUTPUTS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_IN_OUT_MAP),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_IN_OUT_MAP),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_ATTACHED_DISPLAYS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HOT_PLUG_SUPPORT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_ACTIVE_HOT_PLUG),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_ACTIVE_HOT_PLUG),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_INTERRUPT_EVENT_SOURCE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_TARGET_INPUT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_TARGET_OUTPUT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_INPUT_TIMINGS_PART1),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_INPUT_TIMINGS_PART2),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_INPUT_TIMINGS_PART1),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_INPUT_TIMINGS_PART2),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_OUTPUT_TIMINGS_PART1),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_OUTPUT_TIMINGS_PART2),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_OUTPUT_TIMINGS_PART1),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_OUTPUT_TIMINGS_PART2),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_PREFERRED_INPUT_TIMING_PART1),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_PREFERRED_INPUT_TIMING_PART2),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_INPUT_PIXEL_CLOCK_RANGE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_OUTPUT_PIXEL_CLOCK_RANGE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPPORTED_CLOCK_RATE_MULTS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_CLOCK_RATE_MULT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_CLOCK_RATE_MULT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPPORTED_TV_FORMATS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_TV_FORMAT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_TV_FORMAT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPPORTED_POWER_STATES),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_POWER_STATE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_ENCODER_POWER_STATE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_DISPLAY_POWER_STATE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_CONTROL_BUS_SWITCH),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SDTV_RESOLUTION_SUPPORT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SCALED_HDTV_RESOLUTION_SUPPORT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPPORTED_ENHANCEMENTS),
+	SDVO_CMD_NAME_ENTRY(RESET),
+	SDVO_CMD_NAME_ENTRY(GET_DEVICE_CAPS),
+	SDVO_CMD_NAME_ENTRY(GET_FIRMWARE_REV),
+	SDVO_CMD_NAME_ENTRY(GET_TRAINED_INPUTS),
+	SDVO_CMD_NAME_ENTRY(GET_ACTIVE_OUTPUTS),
+	SDVO_CMD_NAME_ENTRY(SET_ACTIVE_OUTPUTS),
+	SDVO_CMD_NAME_ENTRY(GET_IN_OUT_MAP),
+	SDVO_CMD_NAME_ENTRY(SET_IN_OUT_MAP),
+	SDVO_CMD_NAME_ENTRY(GET_ATTACHED_DISPLAYS),
+	SDVO_CMD_NAME_ENTRY(GET_HOT_PLUG_SUPPORT),
+	SDVO_CMD_NAME_ENTRY(SET_ACTIVE_HOT_PLUG),
+	SDVO_CMD_NAME_ENTRY(GET_ACTIVE_HOT_PLUG),
+	SDVO_CMD_NAME_ENTRY(GET_INTERRUPT_EVENT_SOURCE),
+	SDVO_CMD_NAME_ENTRY(SET_TARGET_INPUT),
+	SDVO_CMD_NAME_ENTRY(SET_TARGET_OUTPUT),
+	SDVO_CMD_NAME_ENTRY(GET_INPUT_TIMINGS_PART1),
+	SDVO_CMD_NAME_ENTRY(GET_INPUT_TIMINGS_PART2),
+	SDVO_CMD_NAME_ENTRY(SET_INPUT_TIMINGS_PART1),
+	SDVO_CMD_NAME_ENTRY(SET_INPUT_TIMINGS_PART2),
+	SDVO_CMD_NAME_ENTRY(SET_OUTPUT_TIMINGS_PART1),
+	SDVO_CMD_NAME_ENTRY(SET_OUTPUT_TIMINGS_PART2),
+	SDVO_CMD_NAME_ENTRY(GET_OUTPUT_TIMINGS_PART1),
+	SDVO_CMD_NAME_ENTRY(GET_OUTPUT_TIMINGS_PART2),
+	SDVO_CMD_NAME_ENTRY(CREATE_PREFERRED_INPUT_TIMING),
+	SDVO_CMD_NAME_ENTRY(GET_PREFERRED_INPUT_TIMING_PART1),
+	SDVO_CMD_NAME_ENTRY(GET_PREFERRED_INPUT_TIMING_PART2),
+	SDVO_CMD_NAME_ENTRY(GET_INPUT_PIXEL_CLOCK_RANGE),
+	SDVO_CMD_NAME_ENTRY(GET_OUTPUT_PIXEL_CLOCK_RANGE),
+	SDVO_CMD_NAME_ENTRY(GET_SUPPORTED_CLOCK_RATE_MULTS),
+	SDVO_CMD_NAME_ENTRY(GET_CLOCK_RATE_MULT),
+	SDVO_CMD_NAME_ENTRY(SET_CLOCK_RATE_MULT),
+	SDVO_CMD_NAME_ENTRY(GET_SUPPORTED_TV_FORMATS),
+	SDVO_CMD_NAME_ENTRY(GET_TV_FORMAT),
+	SDVO_CMD_NAME_ENTRY(SET_TV_FORMAT),
+	SDVO_CMD_NAME_ENTRY(GET_SUPPORTED_POWER_STATES),
+	SDVO_CMD_NAME_ENTRY(GET_POWER_STATE),
+	SDVO_CMD_NAME_ENTRY(SET_ENCODER_POWER_STATE),
+	SDVO_CMD_NAME_ENTRY(SET_DISPLAY_POWER_STATE),
+	SDVO_CMD_NAME_ENTRY(SET_CONTROL_BUS_SWITCH),
+	SDVO_CMD_NAME_ENTRY(GET_SDTV_RESOLUTION_SUPPORT),
+	SDVO_CMD_NAME_ENTRY(GET_SCALED_HDTV_RESOLUTION_SUPPORT),
+	SDVO_CMD_NAME_ENTRY(GET_SUPPORTED_ENHANCEMENTS),
 
 	/* Add the op code for SDVO enhancements */
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_HPOS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HPOS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HPOS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_VPOS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_VPOS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_VPOS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_SATURATION),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SATURATION),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_SATURATION),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_HUE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HUE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HUE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_CONTRAST),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_CONTRAST),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_CONTRAST),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_BRIGHTNESS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_BRIGHTNESS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_BRIGHTNESS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_OVERSCAN_H),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_OVERSCAN_H),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_OVERSCAN_H),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_OVERSCAN_V),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_OVERSCAN_V),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_OVERSCAN_V),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_FLICKER_FILTER),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_FLICKER_FILTER),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_FLICKER_FILTER),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_FLICKER_FILTER_ADAPTIVE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_FLICKER_FILTER_ADAPTIVE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_FLICKER_FILTER_ADAPTIVE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_FLICKER_FILTER_2D),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_FLICKER_FILTER_2D),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_FLICKER_FILTER_2D),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_SHARPNESS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SHARPNESS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_SHARPNESS),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_DOT_CRAWL),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_DOT_CRAWL),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_TV_CHROMA_FILTER),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_TV_CHROMA_FILTER),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_TV_CHROMA_FILTER),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_MAX_TV_LUMA_FILTER),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_TV_LUMA_FILTER),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_TV_LUMA_FILTER),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_HPOS),
+	SDVO_CMD_NAME_ENTRY(GET_HPOS),
+	SDVO_CMD_NAME_ENTRY(SET_HPOS),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_VPOS),
+	SDVO_CMD_NAME_ENTRY(GET_VPOS),
+	SDVO_CMD_NAME_ENTRY(SET_VPOS),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_SATURATION),
+	SDVO_CMD_NAME_ENTRY(GET_SATURATION),
+	SDVO_CMD_NAME_ENTRY(SET_SATURATION),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_HUE),
+	SDVO_CMD_NAME_ENTRY(GET_HUE),
+	SDVO_CMD_NAME_ENTRY(SET_HUE),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_CONTRAST),
+	SDVO_CMD_NAME_ENTRY(GET_CONTRAST),
+	SDVO_CMD_NAME_ENTRY(SET_CONTRAST),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_BRIGHTNESS),
+	SDVO_CMD_NAME_ENTRY(GET_BRIGHTNESS),
+	SDVO_CMD_NAME_ENTRY(SET_BRIGHTNESS),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_OVERSCAN_H),
+	SDVO_CMD_NAME_ENTRY(GET_OVERSCAN_H),
+	SDVO_CMD_NAME_ENTRY(SET_OVERSCAN_H),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_OVERSCAN_V),
+	SDVO_CMD_NAME_ENTRY(GET_OVERSCAN_V),
+	SDVO_CMD_NAME_ENTRY(SET_OVERSCAN_V),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_FLICKER_FILTER),
+	SDVO_CMD_NAME_ENTRY(GET_FLICKER_FILTER),
+	SDVO_CMD_NAME_ENTRY(SET_FLICKER_FILTER),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_FLICKER_FILTER_ADAPTIVE),
+	SDVO_CMD_NAME_ENTRY(GET_FLICKER_FILTER_ADAPTIVE),
+	SDVO_CMD_NAME_ENTRY(SET_FLICKER_FILTER_ADAPTIVE),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_FLICKER_FILTER_2D),
+	SDVO_CMD_NAME_ENTRY(GET_FLICKER_FILTER_2D),
+	SDVO_CMD_NAME_ENTRY(SET_FLICKER_FILTER_2D),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_SHARPNESS),
+	SDVO_CMD_NAME_ENTRY(GET_SHARPNESS),
+	SDVO_CMD_NAME_ENTRY(SET_SHARPNESS),
+	SDVO_CMD_NAME_ENTRY(GET_DOT_CRAWL),
+	SDVO_CMD_NAME_ENTRY(SET_DOT_CRAWL),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_TV_CHROMA_FILTER),
+	SDVO_CMD_NAME_ENTRY(GET_TV_CHROMA_FILTER),
+	SDVO_CMD_NAME_ENTRY(SET_TV_CHROMA_FILTER),
+	SDVO_CMD_NAME_ENTRY(GET_MAX_TV_LUMA_FILTER),
+	SDVO_CMD_NAME_ENTRY(GET_TV_LUMA_FILTER),
+	SDVO_CMD_NAME_ENTRY(SET_TV_LUMA_FILTER),
 
 	/* HDMI op code */
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPP_ENCODE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_ENCODE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_ENCODE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_PIXEL_REPLI),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_PIXEL_REPLI),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_COLORIMETRY_CAP),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_COLORIMETRY),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_COLORIMETRY),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_AUDIO_ENCRYPT_PREFER),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_AUDIO_STAT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_AUDIO_STAT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_INDEX),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_INDEX),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_INFO),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_AV_SPLIT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_AV_SPLIT),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_TXRATE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_TXRATE),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_DATA),
-	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_DATA),
+	SDVO_CMD_NAME_ENTRY(GET_SUPP_ENCODE),
+	SDVO_CMD_NAME_ENTRY(GET_ENCODE),
+	SDVO_CMD_NAME_ENTRY(SET_ENCODE),
+	SDVO_CMD_NAME_ENTRY(SET_PIXEL_REPLI),
+	SDVO_CMD_NAME_ENTRY(GET_PIXEL_REPLI),
+	SDVO_CMD_NAME_ENTRY(GET_COLORIMETRY_CAP),
+	SDVO_CMD_NAME_ENTRY(SET_COLORIMETRY),
+	SDVO_CMD_NAME_ENTRY(GET_COLORIMETRY),
+	SDVO_CMD_NAME_ENTRY(GET_AUDIO_ENCRYPT_PREFER),
+	SDVO_CMD_NAME_ENTRY(SET_AUDIO_STAT),
+	SDVO_CMD_NAME_ENTRY(GET_AUDIO_STAT),
+	SDVO_CMD_NAME_ENTRY(GET_HBUF_INDEX),
+	SDVO_CMD_NAME_ENTRY(SET_HBUF_INDEX),
+	SDVO_CMD_NAME_ENTRY(GET_HBUF_INFO),
+	SDVO_CMD_NAME_ENTRY(GET_HBUF_AV_SPLIT),
+	SDVO_CMD_NAME_ENTRY(SET_HBUF_AV_SPLIT),
+	SDVO_CMD_NAME_ENTRY(GET_HBUF_TXRATE),
+	SDVO_CMD_NAME_ENTRY(SET_HBUF_TXRATE),
+	SDVO_CMD_NAME_ENTRY(SET_HBUF_DATA),
+	SDVO_CMD_NAME_ENTRY(GET_HBUF_DATA),
 };
 
+#undef SDVO_CMD_NAME_ENTRY
+
 #define SDVO_NAME(svdo) ((svdo)->port == PORT_B ? "SDVOB" : "SDVOC")
 
 static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 4/6
#6 lore raw

Re: [PATCH 4/6] drm/i915/sdvo: Shrink sdvo_cmd_names[] strings

Quoting Ville Syrjala (2019-06-19 19:03:10)

Quoted 18 lines

From: Ville Syrjälä <[email protected]>

Drop the redundant "SDVO_CMD_" prefix from the command name strings in sdvo_cmd_names[].

While at it throw away the unused struct name, and undef SDVO_CMD_NAME_ENTRY() when we're done.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 219 +++++++++++-----------
 1 file changed, 111 insertions(+), 108 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +0 -0
index 2de7948b7278..d1fd2bc01d82 100644

drivers/gpu/drm/i915/display/intel_sdvo.c static bool intel_sdvo_read_byte(struct intel_sdvo *intel_sdvo, u8 addr, u8 *ch) · line 277

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_sdvo.c +1 -1
@@ -274,124 +274,127 @@ static bool intel_sdvo_read_byte(struct intel_sdvo *intel_sdvo, u8 addr, u8 *ch)
        return false;
 }
 
-#define SDVO_CMD_NAME_ENTRY(cmd) {cmd, #cmd}
+#define SDVO_CMD_NAME_ENTRY(cmd_) { .cmd = SDVO_CMD_ ## cmd_, .name = #cmd_ }

Shorter pretty name as well, but that will obvious from context.

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

PATCH 5/6 drm/i915/sdvo: Reduce the size of the on stack buffers

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

The strings we want to print to the on stack buffers should be no more than
8 * 3 + strlen("(GET_SCALED_HDTV_RESOLUTION_SUPPORT)") + 1 = 61 bytes. So let's shrink the buffers down to 64 bytes.

Also switch the BUG_ON()s to WARN_ON()s if I made a mistake in my arithmentic.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +8 -11
index d1fd2bc01d82..df3582bab076 100644
@@ -401,12 +401,10 @@ static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
 				   const void *args, int args_len)
 {
 	int i, pos = 0;
-#define BUF_LEN 256
-	char buffer[BUF_LEN];
+	char buffer[64];
 
 #define BUF_PRINT(args...) \
-	pos += snprintf(buffer + pos, max_t(int, BUF_LEN - pos, 0), args)
-
+	pos += snprintf(buffer + pos, max_t(int, sizeof(buffer) - pos, 0), args)
 
 	for (i = 0; i < args_len; i++) {
 		BUF_PRINT("%02X ", ((u8 *)args)[i]);
@@ -423,9 +421,9 @@ static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
 	if (i == ARRAY_SIZE(sdvo_cmd_names)) {
 		BUF_PRINT("(%02X)", cmd);
 	}
-	BUG_ON(pos >= BUF_LEN - 1);
+
+	WARN_ON(pos >= sizeof(buffer) - 1);
 #undef BUF_PRINT
-#undef BUF_LEN
 
 	DRM_DEBUG_KMS("%s: W: %02X %s\n", SDVO_NAME(intel_sdvo), cmd, buffer);
 }
@@ -521,8 +519,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
 	u8 retry = 15; /* 5 quick checks, followed by 10 long checks */
 	u8 status;
 	int i, pos = 0;
-#define BUF_LEN 256
-	char buffer[BUF_LEN];
+	char buffer[64];
 
 	buffer[0] = '\0';
 
@@ -562,7 +559,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
 	}
 
 #define BUF_PRINT(args...) \
-	pos += snprintf(buffer + pos, max_t(int, BUF_LEN - pos, 0), args)
+	pos += snprintf(buffer + pos, max_t(int, sizeof(buffer) - pos, 0), args)
 
 	if (status < ARRAY_SIZE(cmd_status_names))
 		BUF_PRINT("(%s)", cmd_status_names[status]);
@@ -580,9 +577,9 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
 			goto log_fail;
 		BUF_PRINT(" %02X", ((u8 *)response)[i]);
 	}
-	BUG_ON(pos >= BUF_LEN - 1);
+
+	WARN_ON(pos >= sizeof(buffer) - 1);
 #undef BUF_PRINT
-#undef BUF_LEN
 
 	DRM_DEBUG_KMS("%s: R: %s\n", SDVO_NAME(intel_sdvo), buffer);
 	return true;
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [PATCH 5/6] drm/i915/sdvo: Reduce the size of the on stack buffers

Quoting Ville Syrjala (2019-06-19 19:03:11)

Quoted 7 lines

From: Ville Syrjälä <[email protected]>

The strings we want to print to the on stack buffers should be no more than
8 * 3 + strlen("(GET_SCALED_HDTV_RESOLUTION_SUPPORT)") + 1 = 61 bytes. So let's shrink the buffers down to 64 bytes.

max args_len does seem to 8, and it gets padded out to 8.

Quoted 2 lines

Also switch the BUG_ON()s to WARN_ON()s if I made a mistake in my arithmentic.

With the command name macro, could it not do some thing like BUILD_BUG_ON(sizeof(#cmd) > DBG_LEN) ?
-Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [PATCH 5/6] drm/i915/sdvo: Reduce the size of the on stack buffers

Quoted 9 lines · Chris Wilson

Quoting Ville Syrjala (2019-06-19 19:03:11)

Quoted 7 lines

From: Ville Syrjälä <[email protected]>

The strings we want to print to the on stack buffers should be no more than
8 * 3 + strlen("(GET_SCALED_HDTV_RESOLUTION_SUPPORT)") + 1 = 61 bytes. So let's shrink the buffers down to 64 bytes.

Quoted 7 lines

max args_len does seem to 8, and it gets padded out to 8.

Quoted 2 lines

Also switch the BUG_ON()s to WARN_ON()s if I made a mistake in my arithmentic.

With the command name macro, could it not do some thing like BUILD_BUG_ON(sizeof(#cmd) > DBG_LEN) ?

I couldn't think of a way to do that with the current struct initialization, but we could borrow the I915_PARAMS_FOR_EACH() trick here. Not sure it's worth the hassle though.

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 6/6 drm/i915/sdvo: Add helpers to get the cmd/status string

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Add sdvo_cmd_name() and sdvo_cmd_status() helpers to avoid bothering the callers with the implementation details of the storage for these strings.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 40 +++++++++++++++++------
 1 file changed, 30 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +30 -10
index df3582bab076..184cd64a7f98 100644
@@ -395,11 +395,24 @@ static const struct {
 
 #undef SDVO_CMD_NAME_ENTRY
 
+static const char *sdvo_cmd_name(u8 cmd)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(sdvo_cmd_names); i++) {
+		if (cmd == sdvo_cmd_names[i].cmd)
+			return sdvo_cmd_names[i].name;
+	}
+
+	return NULL;
+}
+
 #define SDVO_NAME(svdo) ((svdo)->port == PORT_B ? "SDVOB" : "SDVOC")
 
 static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
 				   const void *args, int args_len)
 {
+	const char *cmd_name;
 	int i, pos = 0;
 	char buffer[64];
 
@@ -412,15 +425,12 @@ static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
 	for (; i < 8; i++) {
 		BUF_PRINT("   ");
 	}
-	for (i = 0; i < ARRAY_SIZE(sdvo_cmd_names); i++) {
-		if (cmd == sdvo_cmd_names[i].cmd) {
-			BUF_PRINT("(%s)", sdvo_cmd_names[i].name);
-			break;
-		}
-	}
-	if (i == ARRAY_SIZE(sdvo_cmd_names)) {
+
+	cmd_name = sdvo_cmd_name(cmd);
+	if (cmd_name)
+		BUF_PRINT("(%s)", cmd_name);
+	else
 		BUF_PRINT("(%02X)", cmd);
-	}
 
 	WARN_ON(pos >= sizeof(buffer) - 1);
 #undef BUF_PRINT
@@ -438,6 +448,14 @@ static const char * const cmd_status_names[] = {
 	[SDVO_CMD_STATUS_SCALING_NOT_SUPP] = "Scaling not supported",
 };
 
+static const char *sdvo_cmd_status(u8 status)
+{
+	if (status < ARRAY_SIZE(cmd_status_names))
+		return cmd_status_names[status];
+	else
+		return NULL;
+}
+
 static bool __intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
 				   const void *args, int args_len,
 				   bool unlocked)
@@ -516,6 +534,7 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
 static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
 				     void *response, int response_len)
 {
+	const char *cmd_status;
 	u8 retry = 15; /* 5 quick checks, followed by 10 long checks */
 	u8 status;
 	int i, pos = 0;
@@ -561,8 +580,9 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
 #define BUF_PRINT(args...) \
 	pos += snprintf(buffer + pos, max_t(int, sizeof(buffer) - pos, 0), args)
 
-	if (status < ARRAY_SIZE(cmd_status_names))
-		BUF_PRINT("(%s)", cmd_status_names[status]);
+	cmd_status = sdvo_cmd_status(status);
+	if (cmd_status)
+		BUF_PRINT("(%s)", cmd_status);
 	else
 		BUF_PRINT("(??? %d)", status);
 
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 6/6
#11 lore raw

Re: [PATCH 6/6] drm/i915/sdvo: Add helpers to get the cmd/status string

Quoting Ville Syrjala (2019-06-19 19:03:12)

Quoted 85 lines

From: Ville Syrjälä <[email protected]>

Add sdvo_cmd_name() and sdvo_cmd_status() helpers to avoid bothering the callers with the implementation details of the storage for these strings.

---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 40 +++++++++++++++++------
 1 file changed, 30 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +27 -8
index df3582bab076..184cd64a7f98 100644
@@ -395,11 +395,24 @@ static const struct {
 
 #undef SDVO_CMD_NAME_ENTRY
 
+static const char *sdvo_cmd_name(u8 cmd)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(sdvo_cmd_names); i++) {
+               if (cmd == sdvo_cmd_names[i].cmd)
+                       return sdvo_cmd_names[i].name;
+       }
+
+       return NULL;
+}
+
 #define SDVO_NAME(svdo) ((svdo)->port == PORT_B ? "SDVOB" : "SDVOC")
 
 static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
                                   const void *args, int args_len)
 {
+       const char *cmd_name;
        int i, pos = 0;
        char buffer[64];
 
@@ -412,15 +425,12 @@ static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
        for (; i < 8; i++) {
                BUF_PRINT("   ");
        }
-       for (i = 0; i < ARRAY_SIZE(sdvo_cmd_names); i++) {
-               if (cmd == sdvo_cmd_names[i].cmd) {
-                       BUF_PRINT("(%s)", sdvo_cmd_names[i].name);
-                       break;
-               }
-       }
-       if (i == ARRAY_SIZE(sdvo_cmd_names)) {
+
+       cmd_name = sdvo_cmd_name(cmd);
+       if (cmd_name)
+               BUF_PRINT("(%s)", cmd_name);
+       else
                BUF_PRINT("(%02X)", cmd);
-       }
 
        WARN_ON(pos >= sizeof(buffer) - 1);
 #undef BUF_PRINT
@@ -438,6 +448,14 @@ static const char * const cmd_status_names[] = {
        [SDVO_CMD_STATUS_SCALING_NOT_SUPP] = "Scaling not supported",
 };
 
+static const char *sdvo_cmd_status(u8 status)
+{
+       if (status < ARRAY_SIZE(cmd_status_names))
+               return cmd_status_names[status];
+       else
+               return NULL;
+}
+
 static bool __intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
                                   const void *args, int args_len,
                                   bool unlocked)
@@ -516,6 +534,7 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
 static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
                                     void *response, int response_len)
 {
+       const char *cmd_status;
        u8 retry = 15; /* 5 quick checks, followed by 10 long checks */
        u8 status;
        int i, pos = 0;

drivers/gpu/drm/i915/display/intel_sdvo.c static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo, · line 585

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_sdvo.c +3 -2
@@ -561,8 +580,9 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
 #define BUF_PRINT(args...) \
        pos += snprintf(buffer + pos, max_t(int, sizeof(buffer) - pos, 0), args)
 
-       if (status < ARRAY_SIZE(cmd_status_names))
-               BUF_PRINT("(%s)", cmd_status_names[status]);
+       cmd_status = sdvo_cmd_status(status);
+       if (cmd_status)
+               BUF_PRINT("(%s)", cmd_status);

There's my earlier suggestion!

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

✗ Fi.CI.SPARSE: warning for series starting with [1/6] drm/i915/sdvo: Fix handling if zero hbuf size

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: series starting with [1/6] drm/i915/sdvo: Fix handling if zero hbuf size
URL : https://patchwork.freedesktop.org/series/62400/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915/sdvo: Fix handling if zero hbuf size
-O:drivers/gpu/drm/i915/display/intel_sdvo.c:1043:21: warning: expression using sizeof(void)
-O:drivers/gpu/drm/i915/display/intel_sdvo.c:1043:21: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/display/intel_sdvo.c:1001:47: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/display/intel_sdvo.c:1049:21: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/display/intel_sdvo.c:1049:21: warning: expression using sizeof(void)
-drivers/gpu/drm/i915/display/intel_sdvo.c:1001:47: warning: expression using sizeof(void)

Commit: drm/i915/sdvo: Use named initializers for the SDVO command names -O:drivers/gpu/drm/i915/display/intel_sdvo.c:566:17: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/display/intel_sdvo.c:568:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:566:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:568:17: warning: expression using sizeof(void)

Commit: drm/i915/sdvo: Remove duplicate SET_INPUT_TIMINGS_PART1 cmd name string Okay!

Commit: drm/i915/sdvo: Shrink sdvo_cmd_names[] strings Okay!

Commit: drm/i915/sdvo: Reduce the size of the on stack buffers -O:drivers/gpu/drm/i915/display/intel_sdvo.c:412:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:410:17: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/display/intel_sdvo.c:424:17: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/display/intel_sdvo.c:568:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:422:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:565:17: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/display/intel_sdvo.c:581:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:578:17: warning: expression using sizeof(void)

Commit: drm/i915/sdvo: Add helpers to get the cmd/status string -O:drivers/gpu/drm/i915/display/intel_sdvo.c:413:17: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/display/intel_sdvo.c:417:25: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/display/intel_sdvo.c:422:17: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/display/intel_sdvo.c:565:17: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/display/intel_sdvo.c:567:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:426:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:431:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:433:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:585:17: warning: expression using sizeof(void) +drivers/gpu/drm/i915/display/intel_sdvo.c:587:17: warning: expression using sizeof(void)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

✓ Fi.CI.BAT: success for series starting with [1/6] drm/i915/sdvo: Fix handling if zero hbuf size

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: series starting with [1/6] drm/i915/sdvo: Fix handling if zero hbuf size
URL : https://patchwork.freedesktop.org/series/62400/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6310 -> Patchwork_13350
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/

Known issues
------------

Here are the changes found in Patchwork_13350 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s3:
- fi-icl-u2: [PASS][1] -> [INCOMPLETE][2] ([fdo#107713])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-icl-u2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-icl-u2/igt@[email protected]

* igt@gem_sync@basic-store-each:
- fi-skl-6700k2: [PASS][3] -> [FAIL][4] ([fdo#110946])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-skl-6700k2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-skl-6700k2/igt@[email protected]

* igt@i915_module_load@reload-with-fault-injection:
- fi-icl-dsi: [PASS][5] -> [INCOMPLETE][6] ([fdo#107713])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-icl-dsi/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-icl-dsi/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-skl-6770hq: [PASS][7] -> [FAIL][8] ([fdo#108511])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-skl-6770hq/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-skl-6770hq/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [PASS][9] -> [FAIL][10] ([fdo#109485])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-kbl-7500u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-kbl-7500u/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u3: [PASS][11] -> [FAIL][12] ([fdo#103167])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-icl-u3/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-icl-u3/igt@[email protected]

#### Possible fixes ####

* igt@debugfs_test@read_all_entries:
- fi-ilk-650: [DMESG-WARN][13] ([fdo#106387]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-ilk-650/igt@debugfs_test@read_all_entries.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-ilk-650/igt@debugfs_test@read_all_entries.html

* igt@gem_ctx_switch@basic-default:
- fi-icl-guc: [INCOMPLETE][15] ([fdo#107713] / [fdo#108569]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-icl-guc/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-icl-guc/igt@[email protected]

* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: [INCOMPLETE][17] ([fdo#107718]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-blb-e6850/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-blb-e6850/igt@[email protected]

* igt@gem_sync@basic-store-each:
- fi-apl-guc: [FAIL][19] ([fdo#110512]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-apl-guc/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-apl-guc/igt@[email protected]

* igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm: [DMESG-FAIL][21] ([fdo#110235]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#106387]: https://bugs.freedesktop.org/show_bug.cgi?id=106387
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108511]: https://bugs.freedesktop.org/show_bug.cgi?id=108511
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485
[fdo#110235]: https://bugs.freedesktop.org/show_bug.cgi?id=110235
[fdo#110512]: https://bugs.freedesktop.org/show_bug.cgi?id=110512
[fdo#110946]: https://bugs.freedesktop.org/show_bug.cgi?id=110946

Participating hosts (52 -> 41)
------------------------------

Additional (1): fi-cml-u
Missing (12): fi-kbl-soraka fi-ilk-m540 fi-bxt-dsi fi-hsw-4200u fi-byt-j1900 fi-byt-squawks fi-bsw-cyan fi-bxt-j4205 fi-pnv-d510 fi-icl-y fi-byt-clapper fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_6310 -> Patchwork_13350

CI_DRM_6310: dc88bdb699786ec5c75f0fd0fb6f8b0c3e58eb8e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5061: c88ced79a7b71aec58f1d9c5c599ac2f431bcf7a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13350: 90de88680a230ae783cbdb8abd56189c04b7423e @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

90de88680a23 drm/i915/sdvo: Add helpers to get the cmd/status string 1a605ecec614 drm/i915/sdvo: Reduce the size of the on stack buffers aec8f02228f1 drm/i915/sdvo: Shrink sdvo_cmd_names[] strings 79587efd9b04 drm/i915/sdvo: Remove duplicate SET_INPUT_TIMINGS_PART1 cmd name string 0dfebeafb90f drm/i915/sdvo: Use named initializers for the SDVO command names c45b56f27425 drm/i915/sdvo: Fix handling if zero hbuf size

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

✗ Fi.CI.IGT: failure for series starting with [1/6] drm/i915/sdvo: Fix handling if zero hbuf size

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: series starting with [1/6] drm/i915/sdvo: Fix handling if zero hbuf size
URL : https://patchwork.freedesktop.org/series/62400/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6310_full -> Patchwork_13350_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_13350_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_13350_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_13350_full:

### IGT changes ###

#### Possible regressions ####

* igt@kms_addfb_basic@addfb25-x-tiled-mismatch:
- shard-skl: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-skl1/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-skl3/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_13350_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_softpin@noreloc-s3:
- shard-skl: [PASS][3] -> [INCOMPLETE][4] ([fdo#104108])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-skl2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-skl9/igt@[email protected]

* igt@gem_tiled_swapping@non-threaded:
- shard-hsw: [PASS][5] -> [FAIL][6] ([fdo#108686])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-hsw1/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-hsw1/igt@[email protected]

* igt@gem_userptr_blits@map-fixed-invalidate-busy:
- shard-apl: [PASS][7] -> [DMESG-WARN][8] ([fdo#110913 ])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-apl6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-apl5/igt@[email protected]
- shard-kbl: [PASS][9] -> [DMESG-WARN][10] ([fdo#110913 ]) +1 similar issue
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-kbl2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-kbl2/igt@[email protected]

* igt@gem_userptr_blits@map-fixed-invalidate-busy-gup:
- shard-snb: [PASS][11] -> [DMESG-WARN][12] ([fdo#110913 ])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-snb1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-snb6/igt@[email protected]

* igt@i915_suspend@sysfs-reader:
- shard-kbl: [PASS][13] -> [INCOMPLETE][14] ([fdo#103665] / [fdo#108767])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-kbl3/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-kbl4/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-flip-vs-cursor-atomic:
- shard-glk: [PASS][15] -> [FAIL][16] ([fdo#104873])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-glk3/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-glk9/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
- shard-hsw: [PASS][17] -> [SKIP][18] ([fdo#109271]) +24 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-hsw6/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-hsw1/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-kbl: [PASS][19] -> [INCOMPLETE][20] ([fdo#103665])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-kbl3/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-kbl4/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
- shard-apl: [PASS][21] -> [DMESG-WARN][22] ([fdo#108566]) +2 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-apl3/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-apl4/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
- shard-skl: [PASS][23] -> [FAIL][24] ([fdo#108145])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-skl8/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-skl8/igt@[email protected]

* igt@kms_sysfs_edid_timing:
- shard-hsw: [PASS][25] -> [FAIL][26] ([fdo#100047])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-hsw7/igt@kms_sysfs_edid_timing.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-hsw1/igt@kms_sysfs_edid_timing.html

* igt@kms_vblank@pipe-a-wait-busy-hang:
- shard-apl: [PASS][27] -> [INCOMPLETE][28] ([fdo#103927])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-apl6/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-apl5/igt@[email protected]

#### Possible fixes ####

* igt@gem_userptr_blits@map-fixed-invalidate-busy-gup:
- shard-kbl: [DMESG-WARN][29] ([fdo#110913 ]) -> [PASS][30] +2 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-kbl3/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-kbl4/igt@[email protected]

* igt@i915_selftest@mock_sanitycheck:
- shard-apl: [DMESG-WARN][31] ([fdo#110913 ]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-apl1/igt@i915_selftest@mock_sanitycheck.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-apl6/igt@i915_selftest@mock_sanitycheck.html

* igt@i915_suspend@debugfs-reader:
- shard-apl: [DMESG-WARN][33] ([fdo#108566]) -> [PASS][34] +2 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-apl1/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-apl2/igt@[email protected]

* igt@kms_draw_crc@draw-method-rgb565-blt-ytiled:
- shard-skl: [FAIL][35] ([fdo#103184] / [fdo#103232]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-skl5/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-skl5/igt@[email protected]

* igt@kms_flip@modeset-vs-vblank-race:
- shard-glk: [FAIL][37] ([fdo#103060]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-glk6/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-glk7/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-wc:
- shard-hsw: [SKIP][39] ([fdo#109271]) -> [PASS][40] +23 similar issues
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-hsw1/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-wc.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-hsw5/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-wc.html

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite:
- shard-skl: [FAIL][41] ([fdo#108040]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-skl5/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-skl6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite.html

* igt@kms_pipe_crc_basic@hang-read-crc-pipe-c:
- shard-skl: [FAIL][43] ([fdo#103191]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-skl3/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-skl9/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: [FAIL][45] ([fdo#108145]) -> [PASS][46] +1 similar issue
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-skl3/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-skl9/igt@[email protected]

* igt@kms_vblank@pipe-b-wait-idle:
- shard-snb: [SKIP][47] ([fdo#109271]) -> [PASS][48] +2 similar issues
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-snb7/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-snb5/igt@[email protected]

* igt@prime_busy@wait-hang-bsd:
- shard-hsw: [INCOMPLETE][49] ([fdo#103540]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-hsw4/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-hsw4/igt@[email protected]

#### Warnings ####

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-skl: [FAIL][51] ([fdo#103167]) -> [FAIL][52] ([fdo#108040])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/shard-skl7/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-mmap-gtt.html
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/shard-skl7/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-mmap-gtt.html

[fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#104873]: https://bugs.freedesktop.org/show_bug.cgi?id=104873
[fdo#108040]: https://bugs.freedesktop.org/show_bug.cgi?id=108040
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#108767]: https://bugs.freedesktop.org/show_bug.cgi?id=108767
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#110913 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110913

Participating hosts (10 -> 9)
------------------------------

Missing (1): shard-iclb

Build changes
-------------

* Linux: CI_DRM_6310 -> Patchwork_13350

CI_DRM_6310: dc88bdb699786ec5c75f0fd0fb6f8b0c3e58eb8e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5061: c88ced79a7b71aec58f1d9c5c599ac2f431bcf7a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13350: 90de88680a230ae783cbdb8abd56189c04b7423e @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13350/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/6
#15 lore raw
In reply to Ville Syrjala
Quoted 6 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

The spec says:
"A value of 0 indicates that this buffer does not exist" So we should not convert a hbuf_size of 0 into 1.

Quoted 6 lines

Also pull the relevant code into a helper to avoid making the same mistake multiple times.

And while at it fix the debug prints to not say "hbuf_len" twice.

Matches the spec:

Noticed the %i vs. %u usage in the debug message, but it doesn't seem to cause any problem.

Quoted 71 lines
---
 drivers/gpu/drm/i915/display/intel_sdvo.c | 32 ++++++++++++++---------
 1 file changed, 19 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +19 -13
index ceda03e5a3d4..681411aae754 100644
@@ -929,6 +929,20 @@ static bool intel_sdvo_set_audio_state(struct intel_sdvo *intel_sdvo,
 				    &audio_state, 1);
 }
 
+static bool intel_sdvo_get_hbuf_size(struct intel_sdvo *intel_sdvo,
+				     u8 *hbuf_size)
+{
+	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,
+				  hbuf_size, 1))
+		return false;
+
+	/* Buffer size is 0 based, hooray! However zero means zero. */
+	if (*hbuf_size)
+		(*hbuf_size)++;
+
+	return true;
+}
+
 #if 0
 static void intel_sdvo_dump_hdmi_buf(struct intel_sdvo *intel_sdvo)
 {
@@ -972,14 +986,10 @@ static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo,
 				  set_buf_index, 2))
 		return false;
 
-	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,
-				  &hbuf_size, 1))
+	if (!intel_sdvo_get_hbuf_size(intel_sdvo, &hbuf_size))
 		return false;
 
-	/* Buffer size is 0 based, hooray! */
-	hbuf_size++;
-
-	DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n",
+	DRM_DEBUG_KMS("writing sdvo hbuf: %i, length %i, hbuf_size: %i\n",
 		      if_index, length, hbuf_size);
 
 	if (hbuf_size < length)
@@ -1030,14 +1040,10 @@ static ssize_t intel_sdvo_read_infoframe(struct intel_sdvo *intel_sdvo,
 	if (tx_rate == SDVO_HBUF_TX_DISABLED)
 		return 0;
 
-	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,
-				  &hbuf_size, 1))
-		return -ENXIO;
-
-	/* Buffer size is 0 based, hooray! */
-	hbuf_size++;
+	if (!intel_sdvo_get_hbuf_size(intel_sdvo, &hbuf_size))
+		return false;
 
-	DRM_DEBUG_KMS("reading sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n",
+	DRM_DEBUG_KMS("reading sdvo hbuf: %i, length %i, hbuf_size: %i\n",
 		      if_index, length, hbuf_size);
 
 	hbuf_size = min_t(unsigned int, length, hbuf_size);
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx