From patchwork Fri Jan 5 02:05:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10145973 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 2842860329 for ; Fri, 5 Jan 2018 02:22:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41BD128922 for ; Fri, 5 Jan 2018 02:22:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36A6028925; Fri, 5 Jan 2018 02:22:10 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 DE0BE28922 for ; Fri, 5 Jan 2018 02:22:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 026F06E2A3; Fri, 5 Jan 2018 02:22:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0076.outbound.protection.outlook.com [104.47.42.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12EC96E2A3 for ; Fri, 5 Jan 2018 02:22:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vitjEm8dC1WyxbW8s6qIUjJx8/rndmRKbZ1mgOGPax4=; b=ZJvAYRIufeZhwtb8wPRy73iNSveK51vkHn2O71VWiC6d/AguatQ0Ylpq0vprmvgeNjf0WqKi0DFzym5DsydlBwxRf0X1PZ07jEMcWCseEAy2NSp77Pgs+QbcbQ7CvaK9Fam+RCruNApQDXGV0n3aKYRBKaRmaINS46+HuI5Uc34= Received: from CY4PR02CA0046.namprd02.prod.outlook.com (10.175.57.160) by BY2PR02MB1331.namprd02.prod.outlook.com (10.162.79.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Fri, 5 Jan 2018 02:06:14 +0000 Received: from BL2NAM02FT015.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::206) by CY4PR02CA0046.outlook.office365.com (2603:10b6:903:117::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Fri, 5 Jan 2018 02:06:13 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; 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 BL2NAM02FT015.mail.protection.outlook.com (10.152.77.167) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Fri, 5 Jan 2018 02:06:13 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:39055 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1eXHOe-0006m7-Kc; Thu, 04 Jan 2018 18:06:12 -0800 Received: from [127.0.0.1] (helo=xsj-smtp-dlp1.xlnx.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eXHOe-0003P2-Em; Thu, 04 Jan 2018 18:06:12 -0800 Received: from xsj-pvapsmtp01 (mailhub.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w0526Bu0003023; Thu, 4 Jan 2018 18:06:11 -0800 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eXHOd-0003OX-7t; Thu, 04 Jan 2018 18:06:11 -0800 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 3AAC92C68EB; Thu, 4 Jan 2018 18:06:11 -0800 (PST) From: Hyun Kwon To: , Subject: [PATCH 04/10] drm: xlnx: Add xlnx gem of Xilinx DRM KMS Date: Thu, 4 Jan 2018 18:05:53 -0800 Message-ID: <1515117959-18068-5-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515117959-18068-1-git-send-email-hyun.kwon@xilinx.com> References: <1515117959-18068-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-23572.006 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)(39380400002)(396003)(346002)(376002)(39860400002)(2980300002)(438002)(199004)(189003)(5660300001)(50466002)(305945005)(107886003)(36756003)(90966002)(47776003)(356003)(63266004)(2950100002)(6266002)(4326008)(6666003)(52956003)(81156014)(16586007)(81166006)(42186006)(76176011)(8676002)(51416003)(316002)(50226002)(110136005)(106466001)(54906003)(103686004)(106002)(478600001)(8936002)(48376002)(2906002)(107986001)(5001870100001)(2101003)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR02MB1331; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT015; 1:K9CjJzZiEW8NpZwLolrcBvWIckwRD30QpN5S48OtBjrWNzQy02FYQhwgE7+cmEmjES+RnM8OcVO960vEynacwDpZmmi15s/mZZAaMhn5bdJmQWYL1moh9sL65xZ29jjs MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b0c2aea-1bb9-4b5d-6abe-08d553e0e5a6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BY2PR02MB1331; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB1331; 3:X1b0NjjjHxZs4cZCExrVF3RlPoG1WOdZgyG/Nxd2kFIZSP9WUXgkN7SnYyRjihLB8fuJUTu6s+djaRBcmIHd0aEnUQPitY3WrufyiXpuwaxS5OTMf/ywI+fsd+wYLZ/M9/5Wzo7atGSSSB5ca7rlEZLWXFplwamFVknpZHGPfmuFXUv2XBBapJ0lKvzWaye8bshNbR1q6vPdwclPd57j2bZ5JxkiNLXYqU14VqdbosIjsQu+6CCKPHE9VfVWvsBws14byiuC12sPKUYN/R1GCJTUrsO1AQGzmtqpUak/paO1zW+9Or90V0pN6lmsDMyefjatbQCvW0HafGJ9q2o1q+INWNVQjhe4drS+eVyjRPk=; 25:ASF7ex5d1UyuxRKqd5XzKJzH34G53vcrFSdSOvGHTBQAc+3RrCbAAHGbemo91r4QM/SlD6FGsgxZaNIVfmZEChXO0N2//lkQduhy6Ir1QqcJoMwSbvrYnK0ZLbR9X7Yx2ImpQvpsly3oK2SvXpiFSRuaAac/dbgsltQUIIkn2gqPONyioHYzVF2HMSF+1diZHKU9pw7eG8ZZxxXky/J3UG6U6nBTBC0aIZzyx0A3qBJFSvoiHUfq0o//PRwcQwycZRLBd7jFYf01KUgySeaPO+A9EFn8nd0iJJgVK8xTQD6GOt1attve6k0pR2ySeg6pySz+I7HYoili95etIF0Nzw== X-MS-TrafficTypeDiagnostic: BY2PR02MB1331: X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB1331; 31:psS2Ee+JkbjvYt2p8SsuqdTy4OLI/LATPxa3Uy4k6Kmklbjr4D/SUthFWWZjvRv5d659vSymfsRCf5IsEa9TI9OMvmTEXypxDvjKYIOmCIuxQXgMRo9cElEJmhc1x8foebyU39qh9PhCi9+aHbqNPD5lpZGWJvAVPOqiAQ6B1EuVfQVGWWgrcydEsG4CtvCMUd0PqmY4BBqVGcl1IiJcBaGO4LxqlvrXRXIqObQvwkQ=; 20:+MTk8AyUpObFHzi7a0asyqMgdbqx9cc5YL9ZJe2zQpF8tS8eu7F4MStD2644yXMQ1w1DU/ow1ly6eVNUsZSetcan5KaX0oI6/wzC3KVR36PLIRKocNVcRnVgoiobGXrJgOghKvYgHfk3D/boCYIaOg+mvaYvnB8/JsK4e4Lokru3lDirirQqR1/IVyPLBIRSkCgQy+6ClkqmX7jO/DaGKmsi2PW3tAlL/k53VAUpxoMi6De/j3BFYNjN3a5Mie3bxTVB/equf6o5VjsriuHhQG09JhDf813RLb+E9CdebYLSO19tiTfFPER11HRZaC3qSFHtVu5ANU2GLAuS4IPeYjVs7qnvKmxunn0rxhq7r9y3478ePwDaS+OOzuo4mvRyPgDeq7n7cZ2PzxI1BVA4gHsfwjen84jiKx0NszQEMTamRHCYQAFdZEI0JekuYTY9g6qDd1jyfXtK6wrqqTTTip55Q3MofP3tXAuv1/UwpTNHKT2N74qpsJITviaeeVGL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501075)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041268)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BY2PR02MB1331; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR02MB1331; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB1331; 4:5OSy843RptpeM8nXyCIT1K0pQAkxwPeHnUBU603bzHA6RRRLniHFuplVvzX7Ikz08aCI6kF4rIkYK22drt7+I77uG2SLXhlewT0hWkp2dIPIJMoSviZf28R+uStLJBIonsyyilolh1DIQQDhh4FQ9pbFwGq2sZnThFWdzzCPHYjoYQQvn8Dk6RySPxfro2pXM8XGdhrVX+ZLeIqXcSCgMcxxY/JBrVpK4IZfFTeXSqjccheK4IM2M7HopqXxJdPiihaViyxWKEQ6bxiQmLCIwGg1wf1hPiv2NbCSkDWT2XTXhcFgYvpP9cvuaNwcjisv X-Forefront-PRVS: 05437568AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR02MB1331; 23:R6IFJnaUBcknGIHynDlQtL77ZXW1Y2LRzhvNCPYZi?= =?us-ascii?Q?mgecBCi0xWPAz5QFuDURWmEhwerWwoY5K5rOeek/3Ksjp2VHdUcThQBY6UyP?= =?us-ascii?Q?AjIpxBOYchv2xUAxBF3D9ezCJsjebG6WUkZc+WQuYTzH6SP5fOVLvY4Q+C8E?= =?us-ascii?Q?N23wP633MOGTyH6WGXmACsqmcN0Cib5n5nhRs8x7NAaXOS6slvHatEOPxF2/?= =?us-ascii?Q?dyUaTLIeAat34Qn/3v9XA51xNpDIJ2VQYZ6vo/rHAaRvoXts5fwcPB/x+b0D?= =?us-ascii?Q?6U6coY+RjVTLuHMIOBQzxVREgSQFem+xSHeGZkA2suG1EqXsV4Y3TqTGafRc?= =?us-ascii?Q?U+DEqfg+THyfXG9EY5hNEVb61fGzrv6Cy1IBGsQH2MkM05cQD3Gvnq9cfEct?= =?us-ascii?Q?FF93yMk5jshTXlFOjUL/9tVRP3OQA1E+TOFy9bdSqAV501wDXJ0/Vumha4mY?= =?us-ascii?Q?kZ3chwh9eKOdBBrLHbKBmADVd8/1G5jIdDIMqUecOLW9gOQlOGbgt5i2Smzg?= =?us-ascii?Q?nocqd/1aWxIbP/o5n09x3o5N4rsO+9R83eqqeS4IpPUjCC5mkhoYppWMyLnx?= =?us-ascii?Q?CD2xdM3Qb432ej9yJ+2tLVifp6tcMtctVJHOQwwgT0GVaibtw91CH+IrAFU1?= =?us-ascii?Q?tKwJlgzSQKM99J76SaEjEa7DibmSbM/iPQkog/8cjjw8QycXkAfcG8nOUAxE?= =?us-ascii?Q?UwtpvgbSBH7IpHV2kCpC76anyQAMivgMGbbBE02lo9KHw+MjhCuYRCZ8Qsi9?= =?us-ascii?Q?JUgj/lcuE73UTVfinhBF2wPznlAGjKvsa/yQes9P9m1gc9oZIZVHsQoW7EKO?= =?us-ascii?Q?kF+zPIelsoM8xuMT2yPJY+HML1PTLhdQHzxbXxLDdy5Gl+K3juu1U0DO/73g?= =?us-ascii?Q?bZfO3PF7lQArs1pctBaEexryZk1poPyV7eTS6KVtKYdqa4yJwj8DYf9leylJ?= =?us-ascii?Q?72aAH3VqHKEIumkM++6c+lFh95jR3P+HKI4aECFQrEvEBMj+Wv6uTllbXd9+?= =?us-ascii?Q?HQGOHYZID5NbilxEEyXmP9xuhvmQJskrzzQXGfxiuZB/RWg4nvPvLh9E0Tsm?= =?us-ascii?Q?kDBPKjzvohBMDTn5EcOU6/hBFjL?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB1331; 6:AMhtImZkP/2Aje8BYYxYLAVDUfDgrq84Pn9wmvYuoWbCO4+bLQUTJ3a8kmCauJCTCv0I2rJ139L+m7dxXH9/IWghCeRWYwroLargsd5Ummf0BI7k7tzWJ767CVz66W1Ij54umWkhZE1px4UgrtEAbQdUQS57L3D6Vjrff9+wrXJ1XGRPbVuPr8RzQWYqwZC1kySB4z4ZLSFOOnSBDOEjuvz45aWqwgetkyPxJxzqDV20m+jAsq9GOKf9TWSMKdKlwnM6k4HG3fHXjtPXcDXnrqZbUhVOMW53WmkMBqy2aTO03zLHsak0jNZzcWcpVYO+31hWDIRXPxMiKnS9dF/5QWNkCaRmxS2EHJlpA/vNSDk=; 5:BVqru0sQe27TpIRKeNw1LhkjLlB1WLQMfkfkL/FsV3+TfN3gI+NfsfEvK21BdcFKAxlsBw61SM9JqN84K43jH4hjXMt96yo8jJbiGScCxl50394q1i8b+eWEIY4z9Lzk1NG3HAEh/3plExfzta8FJWym3U4v5ItjgyaKhzRf9dA=; 24:er1HHpW9stHksLyWU7ojcJ1Yeu8WplqoHY9Z+oipXmwxTApqHxkNsL0e/O3f/Xr7dUTZ/ZI/8deoQGVWvdPy3WSAQtZ2/iTr9YwYK3NZj3c=; 7:qt/xYqEjVuXpSomdaPRZKwQ9PQVr5dJkZkwif5wmteCr26cQvx5H7HW7qSpMEFmjKgLJ0LaWYo3/YWWasgm6PdL3TaWCYB5Lyg8oKe6eim1MrKHPjDNdT4BEBiV2YpXUe/cAuZWXq34DprLW3vnlKPZPUeymV71hgtIVr/W+Q7C/eqhVtGy5gtNPDZoNCPraNuctffgmuTENyS2+bX+/vaIHHz7YbNjez0C8AoBXDwKKRk+jBhVi64QhMdGOkCCX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2018 02:06:13.1742 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b0c2aea-1bb9-4b5d-6abe-08d553e0e5a6 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: BY2PR02MB1331 Cc: Michal Simek , Hyun Kwon X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Implement a simple wrapper around drm_gem_cma_dumb_create_internal() for alignment. Signed-off-by: Hyun Kwon --- drivers/gpu/drm/xlnx/xlnx_gem.c | 38 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/xlnx/xlnx_gem.h | 18 ++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 drivers/gpu/drm/xlnx/xlnx_gem.c create mode 100644 drivers/gpu/drm/xlnx/xlnx_gem.h diff --git a/drivers/gpu/drm/xlnx/xlnx_gem.c b/drivers/gpu/drm/xlnx/xlnx_gem.c new file mode 100644 index 0000000..af1abdc --- /dev/null +++ b/drivers/gpu/drm/xlnx/xlnx_gem.c @@ -0,0 +1,38 @@ +/* + * Xilinx DRM KMS GEM helper + * + * Copyright (C) 2015 - 2018 Xilinx, Inc. + * + * Author: Hyun Woo Kwon + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#include +#include + +#include "xlnx_gem.h" + +/* + * xlnx_gem_cma_dumb_create - (struct drm_driver)->dumb_create callback + * @file_priv: drm_file object + * @drm: DRM object + * @args: info for dumb scanout buffer creation + * + * This function is for dumb_create callback of drm_driver struct. Simply + * it wraps around drm_gem_cma_dumb_create() and sets the pitch value + * by retrieving the value from the device. + * + * Return: The return value from drm_gem_cma_dumb_create() + */ +int xlnx_gem_cma_dumb_create(struct drm_file *file_priv, struct drm_device *drm, + struct drm_mode_create_dumb *args) +{ + int pitch = DIV_ROUND_UP(args->width * args->bpp, 8); + unsigned int align = xlnx_get_align(drm); + + if (!args->pitch || !IS_ALIGNED(args->pitch, align)) + args->pitch = ALIGN(pitch, align); + + return drm_gem_cma_dumb_create_internal(file_priv, drm, args); +} diff --git a/drivers/gpu/drm/xlnx/xlnx_gem.h b/drivers/gpu/drm/xlnx/xlnx_gem.h new file mode 100644 index 0000000..bed8ff9 --- /dev/null +++ b/drivers/gpu/drm/xlnx/xlnx_gem.h @@ -0,0 +1,18 @@ +/* + * Xilinx DRM KMS GEM helper header + * + * Copyright (C) 2015 - 2018 Xilinx, Inc. + * + * Author: Hyun Woo Kwon + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#ifndef _XLNX_GEM_H_ +#define _XLNX_GEM_H_ + +int xlnx_gem_cma_dumb_create(struct drm_file *file_priv, + struct drm_device *drm, + struct drm_mode_create_dumb *args); + +#endif /* _XLNX_GEM_H_ */