[igt-dev] [PATCH i-g-t 3/8] lib: Don't use dumb buffers for YCbCr

Ville Syrjala ville.syrjala at linux.intel.com
Tue Feb 27 21:21:15 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

We don't do the "black != zero" clearing for dumb buffers, so let's not
use them for YCbCr framebuffers.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_fb.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index d9c5406cb34e..7b967ac6188b 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -343,6 +343,20 @@ static void *memset32(void *s, uint32_t c, size_t n)
 	return s;
 }
 
+static bool is_yuv(uint32_t format)
+{
+	switch (format) {
+	case DRM_FORMAT_NV12:
+	case DRM_FORMAT_YUYV:
+	case DRM_FORMAT_YVYU:
+	case DRM_FORMAT_UYVY:
+	case DRM_FORMAT_VYUY:
+		return true;
+	default:
+		return false;
+	}
+}
+
 /* helpers to create nice-looking framebuffers */
 static int create_bo_for_fb(int fd, int width, int height,
 			    struct format_desc_struct *format,
@@ -357,7 +371,7 @@ static int create_bo_for_fb(int fd, int width, int height,
 	if (offsets)
 		memset(offsets, 0, ARRAY_SIZE(format->plane_bpp) * sizeof(*offsets));
 
-	if (tiling || size || stride || format->planes > 1) {
+	if (tiling || size || stride || is_yuv(format->drm_id)) {
 		unsigned calculated_size, calculated_stride;
 
 		if (format->planes > 1)
-- 
2.13.6



More information about the igt-dev mailing list