From patchwork Wed Mar 21 18:01:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 7394 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 732E123E01 for ; Wed, 21 Mar 2012 18:01:16 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 34BCBA183CA for ; Wed, 21 Mar 2012 18:01:16 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so2504095iag.11 for ; Wed, 21 Mar 2012 11:01:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=wT6+9uxtF0ymCru6dSav2J6+UaczmXGHcFVtcGQE+HQ=; b=SSZAyD+aEFvxC4JWk+u4kvVxVMmnp3oqJCKiQQBML1vRkCedrDpsbWIdFDh8GFmsYl 14HeoohyS6B1xiRUNe0pUU05031h7PXUmQKb2u96OdDK7n7k/d5mJR01k7VoQN/5/9x6 Vh9YyFyDdLePoP5Rki/q4gf3KsWnpBAT85+wkem7B0PKYVKKELNsvw5Z/EEU3BE2aB6D /lVVpqDdiRUySNj91y/0aBKpRsjrwDWdWCfopJMY6W9HnfFqRodK+Wk89m9qrIVmkf11 25yB/1cKZwMChUu4giMfcBSVPBpNVPKmUTzaSvNkRaWB2Yx/Wx4qroAp7zrUG32G2elR 3Vdw== Received: by 10.50.155.229 with SMTP id vz5mr3505989igb.12.1332352875935; Wed, 21 Mar 2012 11:01:15 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.203.79 with SMTP id fh15csp23257ibb; Wed, 21 Mar 2012 11:01:15 -0700 (PDT) Received: by 10.182.7.4 with SMTP id f4mr3802923oba.57.1332352875336; Wed, 21 Mar 2012 11:01:15 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id y2si1544372obo.174.2012.03.21.11.01.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Mar 2012 11:01:15 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by obbuo19 with SMTP id uo19so1120516obb.37 for ; Wed, 21 Mar 2012 11:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=wT6+9uxtF0ymCru6dSav2J6+UaczmXGHcFVtcGQE+HQ=; b=gXoogXpFQ3xFPHYItWpHpqyT8GZ+RgAZxCgs/ZPW/pXej61zuTDBGeEyRZIOvdCuvu YJ8oiB6/j2AipG7vW3880j0TBrD7otVtJDXjQrdInx6Tld272fEwH4KTMckPOBGS2H3J Zq3q0Pl1T/YmCp96W+scVHoyBznfySxU7O+9tQejq1rcVBfJ7NINQt6HMpXI5qcTO9kJ 6ZiQYvi1skk5F7fpLTJJhm++Wm6wkU448wmUq5dm8CikF6Pe4HjmnE42T/+RpVCm8qaN fipliZfdsSjPtsDXBdvgyJGO0djSdfzP6fAiuh2h05KLou8Uxbw3vxd0qlf1Oh7F8204 z8xw== Received: by 10.182.169.4 with SMTP id aa4mr5670351obc.62.1332352875095; Wed, 21 Mar 2012 11:01:15 -0700 (PDT) Received: from localhost (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id r7sm2236993obc.15.2012.03.21.11.01.14 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Mar 2012 11:01:14 -0700 (PDT) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, Rob Clark Subject: [PATCH libdrm 3/3] modetest: add AR15/XR15 (RGB-1555) formats Date: Wed, 21 Mar 2012 13:01:04 -0500 Message-Id: <1332352864-18723-3-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1332352864-18723-1-git-send-email-rob.clark@linaro.org> References: <1332352864-18723-1-git-send-email-rob.clark@linaro.org> X-Gm-Message-State: ALoCoQkg84xYEJ1ogz1Sikd+oXCUVPTq+ZcC02AroSvC7A6LuQ6mi6srnN2Ex/GsUNYwtIy2ggff From: Rob Clark Signed-off-by: Rob Clark --- tests/modetest/modetest.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 36bdfff..819724a 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -652,6 +652,26 @@ fill422(unsigned char *virtual, int n, int width, int height, int stride) } } +static void +fill1555(unsigned char *virtual, int n, int width, int height, int stride) +{ + int i, j; + /* paint the buffer with colored tiles */ + for (j = 0; j < height; j++) { + uint16_t *ptr = (uint16_t*)((char*)virtual + j * stride); + for (i = 0; i < width; i++) { + div_t d = div(n+i+j, width); + uint32_t rgb = 0x00130502 * (d.quot >> 6) + 0x000a1120 * (d.rem >> 6); + unsigned char *rgbp = (unsigned char *)&rgb; + + *(ptr++) = 0x8000 | + (rgbp[RED] >> 3) << 10 | + (rgbp[GREEN] >> 3) << 5 | + (rgbp[BLUE] >> 3); + } + } +} + static int set_plane(struct kms_driver *kms, struct connector *c, struct plane *p) { @@ -756,6 +776,22 @@ set_plane(struct kms_driver *kms, struct connector *c, struct plane *p) 1, 0, p->w, p->h, pitches[0]); format = DRM_FORMAT_YVU420; + } else if (!strcmp(p->format_str, "XR15")) { + pitches[0] = p->w * 2; + offsets[0] = 0; + kms_bo_get_prop(plane_bo, KMS_HANDLE, &handles[0]); + + fill1555(virtual, 0, p->w, p->h, pitches[0]); + + format = DRM_FORMAT_XRGB1555; + } else if (!strcmp(p->format_str, "AR15")) { + pitches[0] = p->w * 2; + offsets[0] = 0; + kms_bo_get_prop(plane_bo, KMS_HANDLE, &handles[0]); + + fill1555(virtual, 0, p->w, p->h, pitches[0]); + + format = DRM_FORMAT_ARGB1555; } else { fprintf(stderr, "Unknown format: %s\n", p->format_str); return -1;