diff mbox

[igt,3/6] kms_frontbuffer_tracking: move more code to get_sink_crc()

Message ID 1482439328-32197-3-git-send-email-paulo.r.zanoni@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zanoni, Paulo R Dec. 22, 2016, 8:42 p.m. UTC
Make it check for the supported flag and decide what to do. This
change will make the next patches much easier, and it's probably
better to move more sink CRC logic to the sink CRC function.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 tests/kms_frontbuffer_tracking.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 81532dc..4a46942 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -933,6 +933,11 @@  static void get_sink_crc(sink_crc_t *crc, bool mandatory)
 {
 	int rc, errno_;
 
+	if (!sink_crc.supported) {
+		memcpy(crc, "unsupported!", SINK_CRC_SIZE);
+		return;
+	}
+
 	lseek(sink_crc.fd, 0, SEEK_SET);
 
 	rc = read(sink_crc.fd, crc->data, SINK_CRC_SIZE);
@@ -1220,11 +1225,7 @@  static void print_crc(const char *str, struct both_crcs *crc)
 static void collect_crcs(struct both_crcs *crcs, bool mandatory_sink_crc)
 {
 	igt_pipe_crc_collect_crc(pipe_crc, &crcs->pipe);
-
-	if (sink_crc.supported)
-		get_sink_crc(&crcs->sink, mandatory_sink_crc);
-	else
-		memcpy(&crcs->sink, "unsupported!", SINK_CRC_SIZE);
+	get_sink_crc(&crcs->sink, mandatory_sink_crc);
 }
 
 static void init_blue_crc(enum pixel_format format, bool mandatory_sink_crc)