[Intel-gfx] [PATCH i-g-t 2/2] kms_crtc_background_color: Update to match kernel interface

Matt Roper matthew.d.roper at intel.com
Thu Oct 22 17:27:01 PDT 2015


Update the existing test to use the current kernel interface, but leave
the test logic untouched.  As the test is written at the moment it's
only really useful for manual testing...it will happily return success
even if we fail to set the background color (or misprogram the HW with
the wrong value).  In the future it would be nice if we could use CRC's
to compare SW-painted framebuffers of a specific color with a background
canvas of the same color.

Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
---
 lib/igt_kms.c                     |  8 ++++----
 tests/kms_crtc_background_color.c | 27 +++++++++++++--------------
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 53bfc20..e6cad20 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1126,7 +1126,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 						   &pipe->background_property,
 						   &prop_value,
 						   NULL);
-				pipe->background = (uint32_t)prop_value;
+				pipe->background = prop_value;
 			}
 		}
 	}
@@ -1911,12 +1911,12 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
 /**
  * igt_crtc_set_background:
  * @pipe: pipe pointer to which background color to be set
- * @background: background color value in BGR 16bpc
+ * @background: background color value in 16bpc
  *
  * Sets background color for requested pipe. Color value provided here
  * will be actually submitted at output commit time via "background_color"
- * property.
- * For example to get red as background, set background = 0x00000000FFFF.
+ * property and should be assembled via the libdrm drmModeRGBA()
+ * function or related macros (e.g., DRM_RGBA8888()).
  */
 void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background)
 {
diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
index b496625..dbf9609 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -36,19 +36,18 @@ typedef struct {
 	igt_pipe_crc_t *pipe_crc;
 } data_t;
 
-#define BLACK      0x000000           /* BGR 8bpc */
-#define CYAN       0xFFFF00           /* BGR 8bpc */
-#define PURPLE     0xFF00FF           /* BGR 8bpc */
-#define WHITE      0xFFFFFF           /* BGR 8bpc */
-
-#define BLACK64    0x000000000000     /* BGR 16bpc */
-#define CYAN64     0xFFFFFFFF0000     /* BGR 16bpc */
-#define PURPLE64   0xFFFF0000FFFF     /* BGR 16bpc */
-#define YELLOW64   0x0000FFFFFFFF     /* BGR 16bpc */
-#define WHITE64    0xFFFFFFFFFFFF     /* BGR 16bpc */
-#define RED64      0x00000000FFFF     /* BGR 16bpc */
-#define GREEN64    0x0000FFFF0000     /* BGR 16bpc */
-#define BLUE64     0xFFFF00000000     /* BGR 16bpc */
+/* 8bpc values software rendered by Cairo */
+#define CAIRO_PURPLE     0xFF00FF
+
+/* 16bpc values (alpha is ignored) */
+#define BLACK64    DRM_RGBA16161616(0x0000, 0x0000, 0x0000, 0x0000)
+#define CYAN64     DRM_RGBA16161616(0x0000, 0xFFFF, 0xFFFF, 0x0000)
+#define PURPLE64   DRM_RGBA16161616(0xFFFF, 0x0000, 0xFFFF, 0x0000)
+#define YELLOW64   DRM_RGBA16161616(0xFFFF, 0xFFFF, 0x0000, 0x0000)
+#define WHITE64    DRM_RGBA16161616(0xFFFF, 0xFFFF, 0xFFFF, 0x0000)
+#define RED64      DRM_RGBA16161616(0xFFFF, 0x0000, 0x0000, 0x0000)
+#define GREEN64    DRM_RGBA16161616(0x0000, 0xFFFF, 0x0000, 0x0000)
+#define BLUE64     DRM_RGBA16161616(0x0000, 0x0000, 0xFFFF, 0x0000)
 
 static void
 paint_background(data_t *data, struct igt_fb *fb, drmModeModeInfo *mode,
@@ -142,7 +141,7 @@ static void test_crtc_background(data_t *data)
 		plane = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
 		igt_require(plane->pipe->background_property);
 
-		prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
+		prepare_crtc(data, output, pipe, plane, 1, CAIRO_PURPLE, BLACK64);
 
 		/* Now set background without using a plane, i.e.,
 		 * Disable the plane to let hw background color win blend. */
-- 
2.1.4



More information about the Intel-gfx mailing list