diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2018-11-01 22:54:45 +0200 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2018-11-05 18:09:39 +0200 |
commit | 9c33e5f74f510db349c51e9454070e84e3b0367d (patch) | |
tree | ccf1c1de0630905c9aa0b4948b8cfae280fe5c89 /lib/igt_fb.c | |
parent | e5eb140b67497ad74e058959e876376a83bdc09b (diff) |
lib/igt_fb: Assert converted formats harder
Add more asserts to make sure the converted formats are
correct.
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r-- | lib/igt_fb.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c index ac43f158..a59b5a88 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -1524,6 +1524,9 @@ static void convert_nv12_to_rgb24(struct fb_convert *cvt) struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(cvt->src.fb->color_encoding, cvt->src.fb->color_range); + igt_assert(cvt->src.fb->drm_format == DRM_FORMAT_NV12 && + cvt->dst.fb->drm_format == DRM_FORMAT_XRGB8888); + /* * Reading from the BO is awfully slow because of lack of read caching, * it's faster to copy the whole BO to a temporary buffer and convert @@ -1633,8 +1636,8 @@ static void convert_rgb24_to_nv12(struct fb_convert *cvt) struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(cvt->dst.fb->color_encoding, cvt->dst.fb->color_range); - igt_assert_f(cvt->dst.fb->drm_format == DRM_FORMAT_NV12, - "Conversion not implemented for !NV12 planar formats\n"); + igt_assert(cvt->src.fb->drm_format == DRM_FORMAT_XRGB8888 && + cvt->dst.fb->drm_format == DRM_FORMAT_NV12); for (i = 0; i < cvt->dst.fb->height / 2; i++) { for (j = 0; j < cvt->dst.fb->width / 2; j++) { @@ -1762,6 +1765,12 @@ static void convert_yuyv_to_rgb24(struct fb_convert *cvt) cvt->src.fb->color_range); const unsigned char *swz = yuyv_swizzle(cvt->src.fb->drm_format); + igt_assert((cvt->src.fb->drm_format == DRM_FORMAT_YUYV || + cvt->src.fb->drm_format == DRM_FORMAT_UYVY || + cvt->src.fb->drm_format == DRM_FORMAT_YVYU || + cvt->src.fb->drm_format == DRM_FORMAT_VYUY) && + cvt->dst.fb->drm_format == DRM_FORMAT_XRGB8888); + /* * Reading from the BO is awfully slow because of lack of read caching, * it's faster to copy the whole BO to a temporary buffer and convert @@ -1821,11 +1830,11 @@ static void convert_rgb24_to_yuyv(struct fb_convert *cvt) cvt->dst.fb->color_range); const unsigned char *swz = yuyv_swizzle(cvt->dst.fb->drm_format); - igt_assert_f(cvt->dst.fb->drm_format == DRM_FORMAT_YUYV || - cvt->dst.fb->drm_format == DRM_FORMAT_YVYU || - cvt->dst.fb->drm_format == DRM_FORMAT_UYVY || - cvt->dst.fb->drm_format == DRM_FORMAT_VYUY, - "Conversion not implemented for !YUYV planar formats\n"); + igt_assert(cvt->src.fb->drm_format == DRM_FORMAT_XRGB8888 && + (cvt->dst.fb->drm_format == DRM_FORMAT_YUYV || + cvt->dst.fb->drm_format == DRM_FORMAT_UYVY || + cvt->dst.fb->drm_format == DRM_FORMAT_YVYU || + cvt->dst.fb->drm_format == DRM_FORMAT_VYUY)); for (i = 0; i < cvt->dst.fb->height; i++) { for (j = 0; j < cvt->dst.fb->width / 2; j++) { |