From patchwork Thu Apr 18 15:26:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ville Syrjala X-Patchwork-Id: 2461401 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id ECD3C3FCA5 for ; Thu, 18 Apr 2013 15:43:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC9B2E64C3 for ; Thu, 18 Apr 2013 08:43:12 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 0075EE64B7 for ; Thu, 18 Apr 2013 08:27:05 -0700 (PDT) Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 18 Apr 2013 08:27:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,502,1363158000"; d="scan'208";a="228866236" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by AZSMGA002.ch.intel.com with SMTP; 18 Apr 2013 08:27:03 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 18 Apr 2013 18:27:02 +0300 From: ville.syrjala@linux.intel.com To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 libdrm 2/3] modetest: Make RGB565 pwetty too Date: Thu, 18 Apr 2013 18:26:58 +0300 Message-Id: <1366298819-27290-2-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1366298819-27290-1-git-send-email-ville.syrjala@linux.intel.com> References: <1366298819-27290-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Cc: Laurent Pinchart 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: , 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 From: Ville Syrjälä Render the crosshairs for 565 and x888/a888 formats. v2: Use the drm format to determine cairo format Signed-off-by: Ville Syrjälä Acked-by: Laurent Pinchart --- tests/modetest/buffers.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c index 2f3adf8..abacea5 100644 --- a/tests/modetest/buffers.c +++ b/tests/modetest/buffers.c @@ -656,15 +656,32 @@ fill_smpte(const struct format_info *info, void *planes[3], unsigned int width, #define BLUE 0 static void -make_pwetty(void *data, int width, int height, int stride) +make_pwetty(void *data, int width, int height, int stride, uint32_t format) { #ifdef HAVE_CAIRO cairo_surface_t *surface; cairo_t *cr; int x, y; + cairo_format_t cairo_format; + + /* we can ignore the order of R,G,B channels */ + switch (format) { + case DRM_FORMAT_XRGB8888: + case DRM_FORMAT_ARGB8888: + case DRM_FORMAT_XBGR8888: + case DRM_FORMAT_ABGR8888: + cairo_format = CAIRO_FORMAT_ARGB32; + break; + case DRM_FORMAT_RGB565: + case DRM_FORMAT_BGR565: + cairo_format = CAIRO_FORMAT_RGB16_565; + break; + default: + return; + } surface = cairo_image_surface_create_for_data(data, - CAIRO_FORMAT_ARGB32, + cairo_format, width, height, stride); cr = cairo_create(surface); @@ -774,6 +791,7 @@ fill_tiles_rgb16(const struct format_info *info, unsigned char *mem, unsigned int width, unsigned int height, unsigned int stride) { const struct rgb_info *rgb = &info->rgb; + unsigned char *mem_base = mem; unsigned int x, y; for (y = 0; y < height; ++y) { @@ -790,6 +808,8 @@ fill_tiles_rgb16(const struct format_info *info, unsigned char *mem, } mem += stride; } + + make_pwetty(mem_base, width, height, stride, info->format); } static void @@ -837,7 +857,7 @@ fill_tiles_rgb32(const struct format_info *info, unsigned char *mem, mem += stride; } - make_pwetty(mem_base, width, height, stride); + make_pwetty(mem_base, width, height, stride, info->format); } static void