All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/8] lib: Clear packed YUV formats to black
@ 2018-05-23 18:31 Ville Syrjala
  2018-05-23 18:31 ` [igt-dev] [PATCH i-g-t 2/8] lib: Don't use dumb buffers for YCbCr Ville Syrjala
                   ` (11 more replies)
  0 siblings, 12 replies; 19+ messages in thread
From: Ville Syrjala @ 2018-05-23 18:31 UTC (permalink / raw)
  To: igt-dev

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

As we do for NV12, let's also clear packed YUV formats to black instead
of zero. Avoids unexpected green screens.

v2: Nuke the debug messages

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index a926a08d44e1..4f17f9945419 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -335,6 +335,16 @@ uint64_t igt_fb_tiling_to_mod(uint64_t tiling)
 	}
 }
 
+static void *memset32(void *s, uint32_t c, size_t n)
+{
+	uint32_t *ptr = s;
+
+	for (int i = 0; i < n; i++)
+		*ptr++ = c;
+
+	return s;
+}
+
 /* helpers to create nice-looking framebuffers */
 static int create_bo_for_fb(int fd, int width, int height,
 			    struct format_desc_struct *format,
@@ -369,6 +379,7 @@ static int create_bo_for_fb(int fd, int width, int height,
 
 		if (is_i915_device(fd)) {
 			uint8_t *ptr;
+			bool full_range = false; /* FIXME */
 
 			bo = gem_create(fd, size);
 			gem_set_tiling(fd, bo, igt_fb_mod_to_tiling(tiling), stride);
@@ -377,10 +388,23 @@ static int create_bo_for_fb(int fd, int width, int height,
 			ptr = gem_mmap__gtt(fd, bo, size, PROT_READ | PROT_WRITE);
 			igt_assert(*(uint32_t *)ptr == 0);
 
-			if (format->drm_id == DRM_FORMAT_NV12) {
-				/* component formats have a different zero point */
-				memset(ptr, 16, offsets[1]);
-				memset(ptr + offsets[1], 0x80, (height + 1)/2 * stride);
+			switch (format->drm_id) {
+			case DRM_FORMAT_NV12:
+				memset(ptr + offsets[0], full_range ? 0x00 : 0x10,
+				       calculated_stride * height);
+				memset(ptr + offsets[1], 0x80,
+				       calculated_stride * height/2);
+				break;
+			case DRM_FORMAT_YUYV:
+			case DRM_FORMAT_YVYU:
+				memset32(ptr, full_range ? 0x80008000 : 0x80108010,
+					 calculated_stride * height / 4);
+				break;
+			case DRM_FORMAT_UYVY:
+			case DRM_FORMAT_VYUY:
+				memset32(ptr, full_range ? 0x00800080 : 0x10801080,
+					 calculated_stride * height / 4);
+				break;
 			}
 			gem_munmap(ptr, size);
 
-- 
2.16.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-06-07 15:18 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-23 18:31 [igt-dev] [PATCH i-g-t 1/8] lib: Clear packed YUV formats to black Ville Syrjala
2018-05-23 18:31 ` [igt-dev] [PATCH i-g-t 2/8] lib: Don't use dumb buffers for YCbCr Ville Syrjala
2018-06-05  9:51   ` Maarten Lankhorst
2018-05-23 18:31 ` [igt-dev] [PATCH i-g-t 3/8] lib: Clean up format_desc Ville Syrjala
2018-05-23 18:31 ` [igt-dev] [PATCH i-g-t 4/8] lib: Use igt_matrix for ycbcr<->rgb conversion Ville Syrjala
2018-06-06 10:11   ` Maarten Lankhorst
2018-05-23 18:31 ` [igt-dev] [PATCH i-g-t 5/8] lib: Add support for rendering into packed YCbCr framebuffers Ville Syrjala
2018-05-23 18:31 ` [igt-dev] [PATCH i-g-t 6/8] lib/fb: Add color_encoding/color_range to igt_fb Ville Syrjala
2018-05-23 18:31 ` [igt-dev] [PATCH i-g-t 7/8] lib/kms: Respect fb color_encoding/color_range Ville Syrjala
2018-05-23 18:31 ` [igt-dev] [PATCH i-g-t 8/8] tests/kms_plane: crc check plane pixel formats Ville Syrjala
2018-05-24 10:48   ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2018-06-07 15:18     ` Maarten Lankhorst
2018-05-23 19:09 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/8] lib: Clear packed YUV formats to black Patchwork
2018-05-23 23:27 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-05-24 17:15 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/8] lib: Clear packed YUV formats to black (rev2) Patchwork
2018-05-24 23:05 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-06-05  9:42 ` [igt-dev] [PATCH i-g-t 1/8] lib: Clear packed YUV formats to black Maarten Lankhorst
2018-06-05 10:13   ` Ville Syrjälä
2018-06-05 10:33     ` Maarten Lankhorst

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.