[igt-dev] [PATCH i-g-t] lib/igt_fb: better format printing
Daniel Vetter
daniel.vetter at ffwll.ch
Mon Mar 11 16:47:43 UTC 2019
Steal if from kms_plane.c and put it into igt_fb.h
Also tiny bikeshed to remove the space, so it fits more tidily into
the usual name1=value1, name2=value2 style printing.
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
lib/igt_fb.c | 6 ++++--
lib/igt_fb.h | 4 ++++
tests/kms_plane.c | 3 ---
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index f49becbd52f0..bafb0d085af7 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1115,8 +1115,10 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
fb->size = bo_size;
- igt_debug("%s(width=%d, height=%d, format=0x%x, tiling=0x%"PRIx64", size=%"PRIu64")\n",
- __func__, width, height, format, tiling, bo_size);
+ igt_debug("%s(width=%d, height=%d, format=" IGT_FORMAT_FMT
+ ", tiling=0x%"PRIx64", size=%"PRIu64")\n",
+ __func__, width, height, IGT_FORMAT_ARGS(format), tiling,
+ bo_size);
create_bo_for_fb(fb);
igt_assert(fb->gem_handle > 0);
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index e1d885e2c5bc..d53b68e56318 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -44,6 +44,10 @@
*/
#define IGT_FORMAT_FLOAT fourcc_code('I', 'G', 'F', 'x')
+#define IGT_FORMAT_FMT "%c%c%c%c(0x%08x)"
+#define IGT_FORMAT_ARGS(f) ((f) >> 0) & 0xff, ((f) >> 8) & 0xff, \
+ ((f) >> 16) & 0xff, ((f) >> 24) & 0xff, (f)
+
/**
* igt_fb_t:
* @fb_id: KMS ID of the framebuffer
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 91de46948a3a..68db63ca893a 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -401,9 +401,6 @@ static void set_legacy_lut(data_t *data, enum pipe pipe,
free(lut);
}
-#define IGT_FORMAT_FMT "%c%c%c%c (0x%08x)"
-#define IGT_FORMAT_ARGS(f) ((f) >> 0) & 0xff, ((f) >> 8) & 0xff, \
- ((f) >> 16) & 0xff, ((f) >> 24) & 0xff, (f)
static void test_format_plane_color(data_t *data, enum pipe pipe,
igt_plane_t *plane,
--
2.20.1
More information about the igt-dev
mailing list