[igt-dev] [PATCH v4 02/13] fb: convert: Remove swizzle from the arguments

Maxime Ripard
2018-07-26T10:42:38Z

Since it can be inferred from the framebuffer that is already given as an
argument, it is redundant and can be removed.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
lib/igt_fb.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index a4e38b7a8963..4061fedec0c1 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1640,8 +1640,7 @@ static const unsigned char *yuyv_swizzle(uint32_t format)
}
}

-static void convert_yuyv_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_upload *blit,
- const unsigned char swz[4])
+static void convert_yuyv_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_upload *blit)
{
int i, j;
const uint8_t *yuyv;
@@ -1650,6 +1649,7 @@ static void convert_yuyv_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
uint8_t *buf = malloc(blit->linear.size);
struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb->color_encoding,
fb->color_range);
+ const unsigned char *swz = yuyv_swizzle(fb->drm_format);

/*
* Reading from the BO is awfully slow because of lack of read caching,
@@ -1699,8 +1699,7 @@ static void convert_yuyv_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
free(buf);
}

-static void convert_rgb24_to_yuyv(struct igt_fb *fb, struct fb_convert_blit_upload *blit,
- const unsigned char swz[4])
+static void convert_rgb24_to_yuyv(struct igt_fb *fb, struct fb_convert_blit_upload *blit)
{
int i, j;
uint8_t *yuyv = blit->linear.map;
@@ -1709,6 +1708,7 @@ static void convert_rgb24_to_yuyv(struct igt_fb *fb, struct fb_convert_blit_uplo
unsigned yuyv_stride = blit->linear.stride;
struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb->color_encoding,
fb->color_range);
+ const unsigned char *swz = yuyv_swizzle(fb->drm_format);

igt_assert_f(fb->drm_format == DRM_FORMAT_YUYV ||
fb->drm_format == DRM_FORMAT_YVYU ||
@@ -1766,7 +1766,7 @@ static void destroy_cairo_surface__convert(void *arg)
case DRM_FORMAT_YVYU:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
- convert_rgb24_to_yuyv(fb, blit, yuyv_swizzle(fb->drm_format));
+ convert_rgb24_to_yuyv(fb, blit);
break;
default:
igt_assert_f(false, "Conversion not implemented for formats 0x%x\n",
@@ -1818,7 +1818,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
case DRM_FORMAT_YVYU:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
- convert_yuyv_to_rgb24(fb, blit, yuyv_swizzle(fb->drm_format));
+ convert_yuyv_to_rgb24(fb, blit);
break;
default:
igt_assert_f(false, "Conversion not implemented for formats 0x%x\n",