summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoegeun Kwon <hoegeun.kwon@samsung.com>2016-11-23 20:23:36 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2018-02-26 10:21:48 +0900
commit6be70a245ec431f7b2c63ea9b41f9aae607d0f7f (patch)
tree134151a446b5a27914d6d08c432fefba2116c0ac
parent71d0ac41095e4804ad0bd43883e776d4a104254f (diff)
downloadlibdrm-6be70a245ec431f7b2c63ea9b41f9aae607d0f7f.tar.gz
libdrm-6be70a245ec431f7b2c63ea9b41f9aae607d0f7f.tar.bz2
libdrm-6be70a245ec431f7b2c63ea9b41f9aae607d0f7f.zip
ipptest: fix rotation test issue
This patch fixes the issue that we cannot identify whether the image displayed on Panel is correct or not after rotation. For this, it uses fill_smpte_rgb32 function instead of util_draw_buffer_youu. Change-Id: I764f3b17356c474e0afa628f5dd45e447cd596a8 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
-rw-r--r--tests/ipptest/fimc.c4
-rw-r--r--tests/ipptest/util.c71
-rw-r--r--tests/ipptest/util.h2
3 files changed, 74 insertions, 3 deletions
diff --git a/tests/ipptest/fimc.c b/tests/ipptest/fimc.c
index 22fa1d9f..73de30e1 100644
--- a/tests/ipptest/fimc.c
+++ b/tests/ipptest/fimc.c
@@ -713,8 +713,8 @@ void fimc_m2m_set_mode(struct device *dev, struct connector *c, int count,
util_draw_buffer_yuv(usr_addr1,
dev->mode.width, dev->mode.height);
else
- util_draw_buffer(usr_addr1[0], 1, dev->mode.width,
- dev->mode.height, dev->mode.width * 4, 0);
+ fill_smpte_rgb32(usr_addr1[0], dev->mode.width,
+ dev->mode.height, dev->mode.width * 4);
/*For destination buffer */
bo_dst = util_kms_gem_create_mmap(dev->kms, pipe.fourcc,
diff --git a/tests/ipptest/util.c b/tests/ipptest/util.c
index f49ad1d8..a2ec9883 100644
--- a/tests/ipptest/util.c
+++ b/tests/ipptest/util.c
@@ -311,6 +311,75 @@ struct kms_bo *util_kms_gem_create_mmap(struct kms_driver *kms,
return bo;
}
+#define MAKE_RGBA(rgb, r, g, b, a) \
+ ((((r) >> (8 - (rgb)->red.length)) << (rgb)->red.offset) | \
+ (((g) >> (8 - (rgb)->green.length)) << (rgb)->green.offset) | \
+ (((b) >> (8 - (rgb)->blue.length)) << (rgb)->blue.offset) | \
+ (((a) >> (8 - (rgb)->alpha.length)) << (rgb)->alpha.offset))
+
+void fill_smpte_rgb32(unsigned char *mem, unsigned int width,
+ unsigned int height, unsigned int stride)
+{
+ struct rgb_info rgb_status = { {8, 16}, {8, 8}, {8, 0}, {0, 0} };
+ const struct rgb_info *rgb = &rgb_status;
+
+ const uint32_t colors_top[] = {
+ MAKE_RGBA(rgb, 192, 192, 192, 255), /* grey */
+ MAKE_RGBA(rgb, 192, 192, 0, 255), /* yellow */
+ MAKE_RGBA(rgb, 0, 192, 192, 255), /* cyan */
+ MAKE_RGBA(rgb, 0, 192, 0, 255), /* green */
+ MAKE_RGBA(rgb, 192, 0, 192, 255), /* magenta */
+ MAKE_RGBA(rgb, 192, 0, 0, 255), /* red */
+ MAKE_RGBA(rgb, 0, 0, 192, 255), /* blue */
+ };
+ const uint32_t colors_middle[] = {
+ MAKE_RGBA(rgb, 0, 0, 192, 255), /* blue */
+ MAKE_RGBA(rgb, 19, 19, 19, 255), /* black */
+ MAKE_RGBA(rgb, 192, 0, 192, 255), /* magenta */
+ MAKE_RGBA(rgb, 19, 19, 19, 255), /* black */
+ MAKE_RGBA(rgb, 0, 192, 192, 255), /* cyan */
+ MAKE_RGBA(rgb, 19, 19, 19, 255), /* black */
+ MAKE_RGBA(rgb, 192, 192, 192, 255), /* grey */
+ };
+ const uint32_t colors_bottom[] = {
+ MAKE_RGBA(rgb, 0, 33, 76, 255), /* in-phase */
+ MAKE_RGBA(rgb, 255, 255, 255, 255), /* super white */
+ MAKE_RGBA(rgb, 50, 0, 106, 255), /* quadrature */
+ MAKE_RGBA(rgb, 19, 19, 19, 255), /* black */
+ MAKE_RGBA(rgb, 9, 9, 9, 255), /* 3.5% */
+ MAKE_RGBA(rgb, 19, 19, 19, 255), /* 7.5% */
+ MAKE_RGBA(rgb, 29, 29, 29, 255), /* 11.5% */
+ MAKE_RGBA(rgb, 19, 19, 19, 255), /* black */
+ };
+ unsigned int x;
+ unsigned int y;
+
+ for (y = 0; y < height * 6 / 9; ++y) {
+ for (x = 0; x < width; ++x)
+ ((uint32_t *)mem)[x] = colors_top[x * 7 / width];
+ mem += stride;
+ }
+
+ for (; y < height * 7 / 9; ++y) {
+ for (x = 0; x < width; ++x)
+ ((uint32_t *)mem)[x] = colors_middle[x * 7 / width];
+ mem += stride;
+ }
+
+ for (; y < height; ++y) {
+ for (x = 0; x < width * 5 / 7; ++x)
+ ((uint32_t *)mem)[x] =
+ colors_bottom[x * 4 / (width * 5 / 7)];
+ for (; x < width * 6 / 7; ++x)
+ ((uint32_t *)mem)[x] =
+ colors_bottom[(x - width * 5 / 7) * 3
+ / (width / 7) + 4];
+ for (; x < width; ++x)
+ ((uint32_t *)mem)[x] = colors_bottom[7];
+ mem += stride;
+ }
+}
+
void util_draw_buffer(void *addr, unsigned int stripe,
unsigned int width, unsigned int height,
unsigned int stride, unsigned int size)
@@ -347,7 +416,7 @@ void util_draw_buffer_yuv(void **addr, unsigned int width, unsigned int height)
v422 = malloc(width * (height / 2));
/* Get RGB fmt Image */
- util_draw_buffer(img_ptr, 1, width, height, width * 4, 0);
+ fill_smpte_rgb32(img_ptr, width, height, width * 4);
/* RGB888 to YUV422 Conversion */
i = 0;
diff --git a/tests/ipptest/util.h b/tests/ipptest/util.h
index 1e71d44d..2ad9f735 100644
--- a/tests/ipptest/util.h
+++ b/tests/ipptest/util.h
@@ -27,6 +27,8 @@ extern struct kms_bo *util_kms_gem_create_mmap(struct kms_driver *kms,
unsigned int format, unsigned int width,
unsigned int height, unsigned int handles[4],
unsigned int pitches[4], unsigned int offsets[4]);
+extern void fill_smpte_rgb32(unsigned char *mem, unsigned int width,
+ unsigned int height, unsigned int stride);
extern void util_draw_buffer(void *addr, unsigned int stripe,
unsigned int width, unsigned int height,
unsigned int stride, unsigned int size);