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.zan...@intel.com>
---
 tests/kms_frontbuffer_tracking.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

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)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to