@@ -1180,7 +1180,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;
}
}
}
@@ -1972,11 +1972,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.
+ * property and should be assembled via the libdrm drmModeRGBA()
+ * function or related macros (e.g., DRM_RGBA8888()).
* For example to get red as background, set background = 0x00000000FFFF.
*/
void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background)
@@ -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. */