From: "José Expósito" <jose.exposito89@gmail.com> To: javierm@redhat.com Cc: davidgow@google.com, dlatypov@google.com, tzimmermann@suse.de, mripard@kernel.org, daniel@ffwll.ch, airlied@linux.ie, maarten.lankhorst@linux.intel.com, jani.nikula@linux.intel.com, maira.canal@usp.br, isabbasso@riseup.net, magalilemes00@gmail.com, tales.aparecida@gmail.com, dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, "José Expósito" <jose.exposito89@gmail.com> Subject: [PATCH 4/4] drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb565() Date: Mon, 27 Jun 2022 18:11:32 +0200 [thread overview] Message-ID: <20220627161132.33256-5-jose.exposito89@gmail.com> (raw) In-Reply-To: <20220627161132.33256-1-jose.exposito89@gmail.com> Extend the existing test cases to test the conversion from XRGB8888 to RGB565. The documentation and the color picker available on [1] are useful resources to understand this patch and validate the values returned by the conversion function. [1] http://www.barth-dev.de/online/rgb565-color-picker/ Signed-off-by: José Expósito <jose.exposito89@gmail.com> --- .../gpu/drm/tests/drm_format_helper_test.c | 100 +++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c index 52dc41cc7c60..3fbe8026bccc 100644 --- a/drivers/gpu/drm/tests/drm_format_helper_test.c +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c @@ -48,7 +48,7 @@ struct convert_xrgb8888_case { unsigned int pitch; struct drm_rect clip; const u32 xrgb8888[TEST_BUF_SIZE]; - struct convert_xrgb8888_result results[1]; + struct convert_xrgb8888_result results[3]; }; static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { @@ -64,6 +64,26 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { .dst_pitch = 0, .expected = { 0xE0 }, }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = false, + }, + .dst_pitch = 0, + .expected = { 0x00, 0xF8 }, + }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = true, + }, + .dst_pitch = 0, + .expected = { 0xF8, 0x00 }, + }, }, }, { @@ -81,6 +101,26 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { .dst_pitch = 0, .expected = { 0xE0 }, }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = false, + }, + .dst_pitch = 0, + .expected = { 0x00, 0xF8 }, + }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = true, + }, + .dst_pitch = 0, + .expected = { 0xF8, 0x00 }, + }, }, }, { @@ -110,6 +150,36 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { 0xFC, 0x1F, }, }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = false, + }, + .dst_pitch = 0, + .expected = { + 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0xF8, 0xE0, 0x07, + 0x1F, 0x00, 0x1F, 0xF8, + 0xE0, 0xFF, 0xFF, 0x07, + }, + }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = true, + }, + .dst_pitch = 0, + .expected = { + 0xFF, 0xFF, 0x00, 0x00, + 0xF8, 0x00, 0x07, 0xE0, + 0x00, 0x1F, 0xF8, 0x1F, + 0xFF, 0xE0, 0x07, 0xFF, + }, + }, }, }, { @@ -133,6 +203,34 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { 0xA0, 0x6D, 0x0A, 0x00, 0x00, }, }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = false, + }, + .dst_pitch = 10, + .expected = { + 0x33, 0x0A, 0x60, 0x12, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x00, + 0x8E, 0x6B, 0x33, 0x0A, 0x60, 0x12, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xA8, 0x8E, 0x6B, 0x33, 0x0A, 0x00, 0x00, 0x00, 0x00, + }, + }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = true, + }, + .dst_pitch = 10, + .expected = { + 0x0A, 0x33, 0x12, 0x60, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6B, 0x8E, 0x0A, 0x33, 0x12, 0x60, 0x00, 0x00, 0x00, 0x00, + 0xA8, 0x00, 0x6B, 0x8E, 0x0A, 0x33, 0x00, 0x00, 0x00, 0x00, + }, + }, }, }, }; -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: "José Expósito" <jose.exposito89@gmail.com> To: javierm@redhat.com Cc: dri-devel@lists.freedesktop.org, tzimmermann@suse.de, magalilemes00@gmail.com, airlied@linux.ie, maira.canal@usp.br, dlatypov@google.com, linux-kernel@vger.kernel.org, tales.aparecida@gmail.com, davidgow@google.com, "José Expósito" <jose.exposito89@gmail.com>, isabbasso@riseup.net, kunit-dev@googlegroups.com Subject: [PATCH 4/4] drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb565() Date: Mon, 27 Jun 2022 18:11:32 +0200 [thread overview] Message-ID: <20220627161132.33256-5-jose.exposito89@gmail.com> (raw) In-Reply-To: <20220627161132.33256-1-jose.exposito89@gmail.com> Extend the existing test cases to test the conversion from XRGB8888 to RGB565. The documentation and the color picker available on [1] are useful resources to understand this patch and validate the values returned by the conversion function. [1] http://www.barth-dev.de/online/rgb565-color-picker/ Signed-off-by: José Expósito <jose.exposito89@gmail.com> --- .../gpu/drm/tests/drm_format_helper_test.c | 100 +++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c index 52dc41cc7c60..3fbe8026bccc 100644 --- a/drivers/gpu/drm/tests/drm_format_helper_test.c +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c @@ -48,7 +48,7 @@ struct convert_xrgb8888_case { unsigned int pitch; struct drm_rect clip; const u32 xrgb8888[TEST_BUF_SIZE]; - struct convert_xrgb8888_result results[1]; + struct convert_xrgb8888_result results[3]; }; static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { @@ -64,6 +64,26 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { .dst_pitch = 0, .expected = { 0xE0 }, }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = false, + }, + .dst_pitch = 0, + .expected = { 0x00, 0xF8 }, + }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = true, + }, + .dst_pitch = 0, + .expected = { 0xF8, 0x00 }, + }, }, }, { @@ -81,6 +101,26 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { .dst_pitch = 0, .expected = { 0xE0 }, }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = false, + }, + .dst_pitch = 0, + .expected = { 0x00, 0xF8 }, + }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = true, + }, + .dst_pitch = 0, + .expected = { 0xF8, 0x00 }, + }, }, }, { @@ -110,6 +150,36 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { 0xFC, 0x1F, }, }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = false, + }, + .dst_pitch = 0, + .expected = { + 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0xF8, 0xE0, 0x07, + 0x1F, 0x00, 0x1F, 0xF8, + 0xE0, 0xFF, 0xFF, 0x07, + }, + }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = true, + }, + .dst_pitch = 0, + .expected = { + 0xFF, 0xFF, 0x00, 0x00, + 0xF8, 0x00, 0x07, 0xE0, + 0x00, 0x1F, 0xF8, 0x1F, + 0xFF, 0xE0, 0x07, 0xFF, + }, + }, }, }, { @@ -133,6 +203,34 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = { 0xA0, 0x6D, 0x0A, 0x00, 0x00, }, }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = false, + }, + .dst_pitch = 10, + .expected = { + 0x33, 0x0A, 0x60, 0x12, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x00, + 0x8E, 0x6B, 0x33, 0x0A, 0x60, 0x12, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xA8, 0x8E, 0x6B, 0x33, 0x0A, 0x00, 0x00, 0x00, 0x00, + }, + }, + { + .dst_format = DRM_FORMAT_RGB565, + .has_swab = true, + .conv_swab = { + .func = drm_fb_xrgb8888_to_rgb565, + .swab = true, + }, + .dst_pitch = 10, + .expected = { + 0x0A, 0x33, 0x12, 0x60, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6B, 0x8E, 0x0A, 0x33, 0x12, 0x60, 0x00, 0x00, 0x00, 0x00, + 0xA8, 0x00, 0x6B, 0x8E, 0x0A, 0x33, 0x00, 0x00, 0x00, 0x00, + }, + }, }, }, }; -- 2.25.1
next prev parent reply other threads:[~2022-06-27 16:13 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-27 16:11 [PATCH 0/4] KUnit tests for RGB565 conversion José Expósito 2022-06-27 16:11 ` José Expósito 2022-06-27 16:11 ` [PATCH 1/4] drm/format-helper: Rename test cases to make them more generic José Expósito 2022-06-27 16:11 ` José Expósito 2022-06-27 16:11 ` [PATCH 2/4] drm/format-helper: Transform tests to be agnostic of target format José Expósito 2022-06-27 16:11 ` José Expósito 2022-06-27 16:11 ` [PATCH 3/4] drm/format-helper: Add support for conversion functions with swab José Expósito 2022-06-27 16:11 ` José Expósito 2022-06-27 16:11 ` José Expósito [this message] 2022-06-27 16:11 ` [PATCH 4/4] drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb565() José Expósito 2022-06-29 7:34 ` Thomas Zimmermann 2022-06-29 7:34 ` Thomas Zimmermann 2022-06-28 18:47 ` [PATCH 0/4] KUnit tests for RGB565 conversion Tales 2022-06-28 18:47 ` Tales 2022-06-29 7:27 ` David Gow 2022-06-29 7:27 ` David Gow 2022-07-03 15:19 ` José Expósito 2022-07-03 15:19 ` José Expósito 2022-06-29 7:37 ` Thomas Zimmermann 2022-06-29 7:37 ` Thomas Zimmermann
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220627161132.33256-5-jose.exposito89@gmail.com \ --to=jose.exposito89@gmail.com \ --cc=airlied@linux.ie \ --cc=daniel@ffwll.ch \ --cc=davidgow@google.com \ --cc=dlatypov@google.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=isabbasso@riseup.net \ --cc=jani.nikula@linux.intel.com \ --cc=javierm@redhat.com \ --cc=kunit-dev@googlegroups.com \ --cc=linux-kernel@vger.kernel.org \ --cc=maarten.lankhorst@linux.intel.com \ --cc=magalilemes00@gmail.com \ --cc=maira.canal@usp.br \ --cc=mripard@kernel.org \ --cc=tales.aparecida@gmail.com \ --cc=tzimmermann@suse.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.