From patchwork Tue Mar 1 12:09:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 8464711 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 085DFC0553 for ; Tue, 1 Mar 2016 12:10:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0DF012024F for ; Tue, 1 Mar 2016 12:10:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 47FC1202AE for ; Tue, 1 Mar 2016 12:10:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B94496E5D4; Tue, 1 Mar 2016 12:10:06 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E6016E5D1 for ; Tue, 1 Mar 2016 12:10:02 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 01 Mar 2016 04:09:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,523,1449561600"; d="scan'208";a="914346635" Received: from sthoene-mobl.ger.corp.intel.com (HELO ivy.ger.corp.intel.com) ([10.252.33.122]) by fmsmga001.fm.intel.com with ESMTP; 01 Mar 2016 04:09:44 -0800 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Tue, 1 Mar 2016 12:09:30 +0000 Message-Id: <1456834171-16304-3-git-send-email-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456834171-16304-1-git-send-email-lionel.g.landwerlin@intel.com> References: <1456834171-16304-1-git-send-email-lionel.g.landwerlin@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/3] kms_crtc_background_color: Update to match kernel interface X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Matt Roper 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 --- lib/igt_kms.c | 7 ++++--- tests/kms_crtc_background_color.c | 27 +++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 7521e42..7b9a9ce 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -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) 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. */