From patchwork Sun Jul 8 02:35:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10513007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 52A0460233 for ; Sun, 8 Jul 2018 02:37:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4294928718 for ; Sun, 8 Jul 2018 02:37:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36F7D28724; Sun, 8 Jul 2018 02:37:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE99428718 for ; Sun, 8 Jul 2018 02:37:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B90589D42; Sun, 8 Jul 2018 02:37:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0060.outbound.protection.outlook.com [104.47.40.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8091B6E002 for ; Sun, 8 Jul 2018 02:37:29 +0000 (UTC) Received: from DM6PR02CA0030.namprd02.prod.outlook.com (2603:10b6:5:1c::43) by BYAPR02MB4327.namprd02.prod.outlook.com (2603:10b6:a03:56::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.20; Sun, 8 Jul 2018 02:37:27 +0000 Received: from SN1NAM02FT033.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::206) by DM6PR02CA0030.outlook.office365.com (2603:10b6:5:1c::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.930.19 via Frontend Transport; Sun, 8 Jul 2018 02:37:27 +0000 Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by SN1NAM02FT033.mail.protection.outlook.com (10.152.72.133) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.906.15 via Frontend Transport; Sun, 8 Jul 2018 02:37:27 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:51623 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1fbzZm-0004mn-JR for dri-devel@lists.freedesktop.org; Sat, 07 Jul 2018 19:37:26 -0700 Received: from [127.0.0.1] (helo=xsj-smtp-dlp2.xlnx.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1fbzZh-00074U-Ej; Sat, 07 Jul 2018 19:37:21 -0700 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w682bKFY017996; Sat, 7 Jul 2018 19:37:20 -0700 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1fbzZg-00074J-Nc; Sat, 07 Jul 2018 19:37:20 -0700 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 3BF932C73CE; Sat, 7 Jul 2018 19:35:37 -0700 (PDT) From: Hyun Kwon To: Subject: [PATCH libdrm 1/3] tests: util: pattern: Use 64bit RGB samples Date: Sat, 7 Jul 2018 19:35:31 -0700 Message-ID: <1531017333-1483-2-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531017333-1483-1-git-send-email-hyun.kwon@xilinx.com> References: <1531017333-1483-1-git-send-email-hyun.kwon@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(39860400002)(396003)(136003)(376002)(346002)(2980300002)(438002)(199004)(189003)(106466001)(48376002)(8936002)(305945005)(50466002)(426003)(5660300001)(103686004)(50226002)(63266004)(47776003)(2906002)(8676002)(81156014)(81166006)(76176011)(2351001)(356003)(6346003)(90966002)(6916009)(51416003)(26005)(126002)(36756003)(316002)(486006)(44832011)(16586007)(478600001)(42186006)(575784001)(186003)(6266002)(6666003)(52956003)(4326008)(336012)(107886003)(446003)(106002)(2616005)(476003)(11346002)(107986001)(5001870100001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR02MB4327; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT033; 1:xy3xRTu/p3dGO2IAeTmjTsxoqO0eTVwdpalhVj3iyzQT6g0Heg/7/Kf35Pu9pHcMwCl+akMFfb6+B8fIw/t3JoURYaRj3vfuX7wJtEEIjp6PdlpSmMLZLe12pFFCGL11 MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ca5787b-721e-4202-b562-08d5e47bbe87 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060); SRVR:BYAPR02MB4327; X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4327; 3:MiU0C1jWaskQlGKb/70exC1PurckF/byFuAXIxrBJdhsgBJXBJuulhBfBYTLf/uNjV8dLOx+5+RZ1gVcKv8jJNDoFoZAMCp0bQKWHIPCjwNmIBM2YO8Gi9YPI6Xj0AIhPT6rIfx0zZk55mzXPvjYBGU+1pGWOqcx3+QM5uEE5IP55P+8PkmV8694xNPgK5lZ7AWRqlAoUbzkvYLDyXMhZeKkvfOMeBW/lUiG8Pjiq7GTwNpl+9r15rfvEWCvxmSgVrEtVL9FTTRDmJcTbuzB+wpo9NtXfSOu2mHJZo6hQ5tFSxkgYz8MTUxZ5Nepv7Bd4fv46JvwnA49ujQSkc9J8JttW/l894AeakNWcO2uWBI=; 25:dyEvcW107HSbkdhG/j3v6G7wzYp94FAsDM0rVU/7PhmIkOMCsXv+4fZlg2x+k0aqiyCxv25Vbjsdtt6fcUnfevMdIwbHIKvWVjv0D82+mf+4VMR6bYQwkteDnWl2g9opC84h2qyXqA2CbsiUPC7FQedzZdjqdP0/ln0/URg2unN8u58zpFSqq5i4lQEgkFwFTZ02tXv5OJMNqsoKYdcQInmqJ/4P2puAoJ8cmxHZ1JBeXlCCGQFyvXNlxx8nOtjCGeLeHouLnS8aXqRnGE209rzLWMDRAAZi4JCejel3xT3IqmT708EWGvXeHGMFqHfLpwABNPt0biQXIzVeQ+KSAA== X-MS-TrafficTypeDiagnostic: BYAPR02MB4327: X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4327; 31:GRelAbZWCo70GpdPW8R3R4xEu8OhZw+03pvYw5XDjYIcAce1DDMUNj4NDYGoA4FLvtTpto/+atCY8mvEXU7IdD/geTazwNyYODktRQr8p4r1mJ5UMmTGVZkvXxc93DMpHiU8lqWXmdzZ8OBTOQdt5HI24eG629Vt5UgvCI4pwXdNBzED71Zt6ne9NwfWXBrlmv+Udke/9TdzUkYKuyAtSXolGZcNL2n5jKGh1a2eTF4=; 20:l4Hq/iV+uvuWRvKmGFlkrmJhsySAW0IAbBSu/2fFOefo6BGmFjmY3SpGGFB7rSMLXdVBHQ2bXE9qsSSOQn8CaO6JLpkjIqNjpShLnVvbK6xtJ3tbGoEjDD5023HOK+f55k5nEpjSkUMpWQYs4y+1bVSoFmrX9BgrkrJVTwfgT06xHf21bi452S8BwgxM89AFZkhElwXH/tyAvkfv2vQIvMZGaioMIzVx9EETu39gzi4lTCRcz5ME7LcbOVNtyojjR9wvi+VZ1WFdzHZZKCQJ6YLuoAR1ZocodmJZhyX3tKTPO/djYPUIUJtYAbII87VK2XTloGNosRr8/oVZ6Sz029chdAHu3zuxEM7ZSGF1iF/TwJ0D2UCRcA1HGxE6GgK0uyr9Gz3g8p5gBh50oUMR+LSRZCx5cSS68h8CsN7Ml30xeNNACPc0/2XueGLMu1DRXKEGCgYV66UYxtoz9UTyVteSCLXPIlo0SsLp7JNQ1f1Se2jlJevCb8iaSN614lwk X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231311)(944501410)(52105095)(3002001)(93006095)(93004095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:BYAPR02MB4327; BCL:0; PCL:0; RULEID:; SRVR:BYAPR02MB4327; X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4327; 4:q+1JKOreSnxbnbtFUpYq5EMgTMvkR5Qj/s2xPbx6UdTw3Ce+uxqs6O/3xByzGVsBlnWqFnnCBU+vTiViFi/s5df6LwOGuHr/l3Vpv6MCCa5MPUiOQ9rCmPHGYkkBrUPhadfJ9c9MnXjxdaDQqZZxn22F4vrbTQuV8cxPVOCOTXHYOz6vXHRpE+/jk6YOkFHjvB+qqJ2cF2N8+tsCHMc86iga2q3wKWoE9IqfD5ZF1901459+h/cIiKxrty8YfWKbGKrAZb/OxwPbzq3Yg9YAvxysjedNlfRaWvPutGcWMUnOJWZHX3dWv2Yru7nq25zP X-Forefront-PRVS: 0727122FC6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BYAPR02MB4327; 23:ewUmsgF4zQL7oEJswYjFpVxIHI8DY0UliOANGGqgq?= =?us-ascii?Q?ZproZpMAxrHN/b0ZvEkKkI0KIPo2wnN10Yo/BkCOrOfymt3/Lxil/qFOw/x4?= =?us-ascii?Q?4o0D0EKRdulaJjUqetsKwS1NmYWpFsnFnB6xLJBL9asUamOf/5kNQgc2CgCj?= =?us-ascii?Q?sDx8TkdI72JiM6dt5NkygYb8GEM34T/d/0g3k6QCxDlSWplTk/moQR9KXDcF?= =?us-ascii?Q?O7+3se7wbzMDgIVRU6ZU5wtIgcufoW5bXTMfYaCUVZoT6nfXFXXQWiWKpMva?= =?us-ascii?Q?qc6WRJuZ/SgiJ2S45hJsEFy9fJ9iHAFh3cyk2sr9+O//j137hAy50LaOvaSc?= =?us-ascii?Q?eLj2p+0+/BXtQXIukjLCpYc1MLOKLCohYp95+ukhZmsWyA5ljQGY4G6Izvkl?= =?us-ascii?Q?qHIgdq04bFxgojuBe/5/3pH2wpQmV1vsZCLBwpyGtC9VXarvVrCjth9m+o2p?= =?us-ascii?Q?tP12aCtASMmjUEOX4QYVjU3sPzDAhmRznvLgV+HYlI1lnyMQN16smFj4tmij?= =?us-ascii?Q?vrT9HinTjiagJhtasOdPyryJJH+CgYkJXJnZ4Mku6R+XlZS3ufrEn9NuqUH4?= =?us-ascii?Q?DIh0tnQHzIA2YkWJxlkbp/1wDo93aCLs3P6PNA5lSV/kj+oWyB/ISW6PiEMn?= =?us-ascii?Q?wbhYTXJi0nzUter8UzE79N8itdFCuWTdMmPq6jSPkOSJEaB5WthlB1SA5MoD?= =?us-ascii?Q?g945aeE3pX4LoxORtmHfZgTNpl9Zt3hz9UsgDD3sgh/OrRcD05LyRsgAWWdQ?= =?us-ascii?Q?hE3hvggoEKvuh8P9eErAfK2VkIh2OqjMY0B9E8Fhs+McPHNkY4qVI5bSdebM?= =?us-ascii?Q?krIpJ2ANHZCHAriCshrn7Oc1h3hqNx1bDsRmd/EBQ8m6glt2/NORYAbUl2ie?= =?us-ascii?Q?3aT/1elJ2X9CK/IOhe9kMs4ryAX/ZcO13rBUn3ZmZ9Y1A4I4ADewz0KiymhY?= =?us-ascii?Q?DdMar7+Bli+VKRJXF88JbDOR18qt1IbsAbuQ3gCC0i/VVY18O96nAnKFW3x8?= =?us-ascii?Q?5x9qYWP6YoXdyki/48L2Ch/as2Zuh4/gwXGcO2iZVOxp5bjnSfa51bpfQZYP?= =?us-ascii?Q?FYgOm35hSU4g6DnM5FIoeyHFz4vz8XOS9sxK1vuIxIRbIlFmb0IiLIF+lOgA?= =?us-ascii?Q?k5Iws34b1vCm0XRz7sn7zA72aPu3X9kJBVAI1xIohNiAUACsui9VHrlVeHRa?= =?us-ascii?Q?WjwovVMdYYDI+MUj0haQFASpfInidtElAMxcYDgZTisFdbLMySCEFi4ydB88?= =?us-ascii?Q?usmNryLAUIStvQIYSExQf7m4SR9eb9dHPi8Vhanx9SE3bdx4u8qqMRuVEiro?= =?us-ascii?Q?7zE4DZ4RxkHpE9AIDCWHgI=3D?= X-Microsoft-Antispam-Message-Info: jRCj9eOeT/ucgbyJ8Zoofk/rAwXpASHw7UR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05uPsLxRPMCKPppNBPDWZ9JEE6MYsqYMbPmiWmlAl7GgBi4XykTSkqhGM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4327; 7:+FZyNQeEYo2VYKV+GtMp0WG1En7cP/7w0hjMuDITK5Z7VWJoAfI5veCs56d9Dubv94xzXbvYoxzBHhWLWbnnttKaTTAg0tpbEjMRsdvxvNPbqg/FwYJjshLiIDfJYG1niWBDXxZ0KVcm6XDhg1UiSgxby3fXleePmAJBpGngNIsNO1fB+2XAwzQ+vLVzVrhKufqb+fM15glCTIwKw+DnzAX89TnuK+6W790WbHOzbLvuiZhI/I50FCfSHUBqwn9p X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2018 02:37:27.0218 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ca5787b-721e-4202-b562-08d5e47bbe87 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4327 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hyun Kwon Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use of 32bit RGB samples, where each component is 8bit, cannot support formats with components greater than 8bit (ex, XRGB2101010). Introduce MAKE_RGBA_64() which creates pixels from a 64bit sample. Each component in a 64bit sample is 16bit long, thus a pixel with 10bit components can be generated correctly. MAKE_RGBA() can use MAKE_RGBA_64() by scaling each 8bit component to 16bit, for compatilbity. Signed-off-by: Hyun Kwon --- tests/util/pattern.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/util/pattern.c b/tests/util/pattern.c index 9fa0a41..aa067c9 100644 --- a/tests/util/pattern.c +++ b/tests/util/pattern.c @@ -60,11 +60,17 @@ struct color_yuv { .u = MAKE_YUV_601_U(r, g, b), \ .v = MAKE_YUV_601_V(r, g, b) } +#define COLOR_MASK(value, color) \ + ((value & ((1 << (color).length) - 1)) << (color).offset) + +#define MAKE_RGBA_64(rgb, r, g, b, a) \ + (COLOR_MASK(((r) >> (16 - (rgb)->red.length)), (rgb)->red) | \ + COLOR_MASK(((g) >> (16 - (rgb)->green.length)), (rgb)->green) | \ + COLOR_MASK(((b) >> (16 - (rgb)->blue.length)), (rgb)->blue) | \ + COLOR_MASK(((a) >> (16 - (rgb)->alpha.length)), (rgb)->alpha)) + #define MAKE_RGBA(rgb, r, g, b, a) \ - ((((r) >> (8 - (rgb)->red.length)) << (rgb)->red.offset) | \ - (((g) >> (8 - (rgb)->green.length)) << (rgb)->green.offset) | \ - (((b) >> (8 - (rgb)->blue.length)) << (rgb)->blue.offset) | \ - (((a) >> (8 - (rgb)->alpha.length)) << (rgb)->alpha.offset)) + MAKE_RGBA_64(rgb, (r) * 0x101, (g) * 0x101, (b) * 0x101, (a) * 0x101) #define MAKE_RGB24(rgb, r, g, b) \ { .value = MAKE_RGBA(rgb, r, g, b, 0) }