All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 2/2] kms_crtc_background_color: Update to match kernel interface
Date: Thu, 22 Oct 2015 17:27:01 -0700	[thread overview]
Message-ID: <1445560021-17399-2-git-send-email-matthew.d.roper@intel.com> (raw)
In-Reply-To: <1445560021-17399-1-git-send-email-matthew.d.roper@intel.com>

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@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-10-23  0:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-23  0:25 [PATCH 0/2] CRTC background color support for i915 Matt Roper
2015-10-23  0:25 ` [PATCH 1/2] drm: Add infrastructure for CRTC background color property Matt Roper
2015-10-23  1:26   ` kbuild test robot
2015-11-18 21:35   ` Bob Paauwe
2015-11-18 22:55     ` Matt Roper
2015-11-18 23:09   ` Emil Velikov
2015-10-23  0:25 ` [PATCH 2/2] drm/i915/skl: Add support for pipe background color Matt Roper
2015-10-23  0:39   ` [Intel-gfx] " kbuild test robot
2015-10-23  1:08   ` kbuild test robot
2015-11-18 21:43   ` Bob Paauwe
2015-10-23  0:26 ` [PATCH libdrm] xf86drmMode: Add RGBA property helpers Matt Roper
2015-10-23  0:27 ` [PATCH i-g-t 1/2] igt_kms: Set atomic capability bit Matt Roper
2015-10-23  0:27   ` Matt Roper [this message]
2015-10-23  8:05   ` Daniel Vetter
2015-10-26  9:14     ` Daniel Stone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445560021-17399-2-git-send-email-matthew.d.roper@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.