From patchwork Fri Jul 20 12:50:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1220901 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 06BCAE0038 for ; Fri, 20 Jul 2012 12:52:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD9449F378 for ; Fri, 20 Jul 2012 05:52:50 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [95.142.166.194]) by gabe.freedesktop.org (Postfix) with ESMTP id EA3F19E908 for ; Fri, 20 Jul 2012 05:50:45 -0700 (PDT) Received: from avalon.ideasonboard.com (unknown [91.178.183.173]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DCB5F35A88 for ; Fri, 20 Jul 2012 14:50:43 +0200 (CEST) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] modetest: Add support for ARGB888, BGRA888 and BGRX888 formats Date: Fri, 20 Jul 2012 14:50:43 +0200 Message-Id: <1342788648-28528-4-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1342788648-28528-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1342788648-28528-1-git-send-email-laurent.pinchart@ideasonboard.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Signed-off-by: Laurent Pinchart --- tests/modetest/modetest.c | 64 ++++++++++++++++++++++++++------------------- 1 files changed, 37 insertions(+), 27 deletions(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index b70fb10..2a04459 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -629,6 +629,9 @@ static const struct format_info format_info[] = { { DRM_FORMAT_XRGB1555, "XR15", MAKE_RGB_INFO(5, 10, 5, 5, 5, 0, 0, 0) }, { DRM_FORMAT_RGB888, "RG24", MAKE_RGB_INFO(8, 16, 8, 8, 8, 0, 0, 0) }, { DRM_FORMAT_XRGB8888, "XR24", MAKE_RGB_INFO(8, 16, 8, 8, 8, 0, 0, 0) }, + { DRM_FORMAT_BGRX8888, "BX24", MAKE_RGB_INFO(8, 8, 8, 16, 8, 24, 0, 0) }, + { DRM_FORMAT_ARGB8888, "AR24", MAKE_RGB_INFO(8, 16, 8, 8, 8, 0, 8, 24) }, + { DRM_FORMAT_BGRA8888, "BA24", MAKE_RGB_INFO(8, 8, 8, 16, 8, 24, 8, 0) }, }; unsigned int format_fourcc(const char *name) @@ -915,35 +918,36 @@ fill_smpte_rgb24(const struct rgb_info *rgb, void *mem, static void fill_smpte_rgb32(const struct rgb_info *rgb, void *mem, - unsigned int width, unsigned int height, unsigned int stride) + unsigned int width, unsigned int height, unsigned int stride, + uint8_t alpha) { const uint32_t colors_top[] = { - MAKE_RGBA(rgb, 192, 192, 192, 0), /* grey */ - MAKE_RGBA(rgb, 192, 192, 0, 0), /* yellow */ - MAKE_RGBA(rgb, 0, 192, 192, 0), /* cyan */ - MAKE_RGBA(rgb, 0, 192, 0, 0), /* green */ - MAKE_RGBA(rgb, 192, 0, 192, 0), /* magenta */ - MAKE_RGBA(rgb, 192, 0, 0, 0), /* red */ - MAKE_RGBA(rgb, 0, 0, 192, 0), /* blue */ + MAKE_RGBA(rgb, 192, 192, 192, alpha), /* grey */ + MAKE_RGBA(rgb, 192, 192, 0, alpha), /* yellow */ + MAKE_RGBA(rgb, 0, 192, 192, alpha), /* cyan */ + MAKE_RGBA(rgb, 0, 192, 0, alpha), /* green */ + MAKE_RGBA(rgb, 192, 0, 192, alpha), /* magenta */ + MAKE_RGBA(rgb, 192, 0, 0, alpha), /* red */ + MAKE_RGBA(rgb, 0, 0, 192, alpha), /* blue */ }; const uint32_t colors_middle[] = { - MAKE_RGBA(rgb, 0, 0, 192, 0), /* blue */ - MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */ - MAKE_RGBA(rgb, 192, 0, 192, 0), /* magenta */ - MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */ - MAKE_RGBA(rgb, 0, 192, 192, 0), /* cyan */ - MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */ - MAKE_RGBA(rgb, 192, 192, 192, 0), /* grey */ + MAKE_RGBA(rgb, 0, 0, 192, alpha), /* blue */ + MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */ + MAKE_RGBA(rgb, 192, 0, 192, alpha), /* magenta */ + MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */ + MAKE_RGBA(rgb, 0, 192, 192, alpha), /* cyan */ + MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */ + MAKE_RGBA(rgb, 192, 192, 192, alpha), /* grey */ }; const uint32_t colors_bottom[] = { - MAKE_RGBA(rgb, 0, 33, 76, 0), /* in-phase */ - MAKE_RGBA(rgb, 255, 255, 255, 0), /* super white */ - MAKE_RGBA(rgb, 50, 0, 106, 0), /* quadrature */ - MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */ - MAKE_RGBA(rgb, 9, 9, 9, 0), /* 3.5% */ - MAKE_RGBA(rgb, 19, 19, 19, 0), /* 7.5% */ - MAKE_RGBA(rgb, 29, 29, 29, 0), /* 11.5% */ - MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */ + MAKE_RGBA(rgb, 0, 33, 76, alpha), /* in-phase */ + MAKE_RGBA(rgb, 255, 255, 255, alpha), /* super white */ + MAKE_RGBA(rgb, 50, 0, 106, alpha), /* quadrature */ + MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */ + MAKE_RGBA(rgb, 9, 9, 9, alpha), /* 3.5% */ + MAKE_RGBA(rgb, 19, 19, 19, alpha), /* 7.5% */ + MAKE_RGBA(rgb, 29, 29, 29, alpha), /* 11.5% */ + MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */ }; unsigned int x; unsigned int y; @@ -992,10 +996,12 @@ fill_smpte(const struct format_info *info, void *planes[3], unsigned int width, case DRM_FORMAT_BGR888: return fill_smpte_rgb24(&info->rgb, planes[0], width, height, stride); + case DRM_FORMAT_ARGB8888: + case DRM_FORMAT_BGRA8888: case DRM_FORMAT_XRGB8888: case DRM_FORMAT_BGRX8888: return fill_smpte_rgb32(&info->rgb, planes[0], - width, height, stride); + width, height, stride, 255); } } @@ -1085,9 +1091,9 @@ fill_tile_xrgb8888(unsigned char *virtual, int width, int height, int stride) uint32_t *ptr = (uint32_t*)((char*)virtual + j * stride); for (i = 0; i < width; i++) { div_t d = div(i, width); - ptr[i] = - 0x00130502 * (d.quot >> 6) + - 0x000a1120 * (d.rem >> 6); + ptr[i] = 0xff000000 + | (0x00130502 * (d.quot >> 6) + + 0x000a1120 * (d.rem >> 6)); } } @@ -1116,6 +1122,7 @@ fill_tiles(const struct format_info *info, void *planes[3], unsigned int width, case DRM_FORMAT_ARGB1555: case DRM_FORMAT_XRGB1555: return fill_tiles_xrgb1555(planes[0], width, height, stride); + case DRM_FORMAT_ARGB8888: case DRM_FORMAT_XRGB8888: return fill_tile_xrgb8888(planes[0], width, height, stride); } @@ -1293,7 +1300,10 @@ create_test_buffer(struct kms_driver *kms, unsigned int format, planes[0] = virtual; break; + case DRM_FORMAT_ARGB8888: + case DRM_FORMAT_BGRA8888: case DRM_FORMAT_XRGB8888: + case DRM_FORMAT_BGRX8888: pitches[0] = width * 4; offsets[0] = 0; kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]);