Message ID | 1516932247-10750-4-git-send-email-hyun.kwon@xilinx.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> 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 590CD60211 for <patchwork-dri-devel@patchwork.kernel.org>; Fri, 26 Jan 2018 02:04:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 470D428C40 for <patchwork-dri-devel@patchwork.kernel.org>; Fri, 26 Jan 2018 02:04:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BD7028C46; Fri, 26 Jan 2018 02:04:24 +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 20D6228C40 for <patchwork-dri-devel@patchwork.kernel.org>; Fri, 26 Jan 2018 02:04:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 123F76E09D; Fri, 26 Jan 2018 02:04:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0050.outbound.protection.outlook.com [104.47.36.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id E7C5B6E097 for <dri-devel@lists.freedesktop.org>; Fri, 26 Jan 2018 02:04:18 +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=hGSu0rXXrldZxMm2ynAy6pj9kfOlxkYqra0snAZGNGg=; b=L02JqgHDgAFV8lVVn7uG2dQiL+nRXMs96h2nG87jbCySaxXBVvsGobs1wVBQcaGIv15r9Z7X+vh6eSVQ60saIEMUAMiGy8WN1KOVmDkgmhaZShmZUXLqqxzHSQYCdReuUCC8XkRw6qVDUu7WHpLU3w2F5JCexwr3iPC8H0LiKlE= Received: from BLUPR0201CA0007.namprd02.prod.outlook.com (10.163.116.17) by BN6PR02MB3268.namprd02.prod.outlook.com (10.161.152.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Fri, 26 Jan 2018 02:04:17 +0000 Received: from BL2NAM02FT021.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::208) by BLUPR0201CA0007.outlook.office365.com (2a01:111:e400:52e7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.14 via Frontend Transport; Fri, 26 Jan 2018 02:04:16 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT021.mail.protection.outlook.com (10.152.77.158) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.444.13 via Frontend Transport; Fri, 26 Jan 2018 02:04:16 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from <hyun.kwon@xilinx.com>) id 1eetNH-0005K7-UY; Thu, 25 Jan 2018 18:04:15 -0800 Received: from [127.0.0.1] (helo=xsj-smtp-dlp1.xlnx.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from <hyun.kwon@xilinx.com>) id 1eetNH-0002n7-JC; Thu, 25 Jan 2018 18:04:15 -0800 Received: from xsj-pvapsmtp01 (smtp2.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w0Q24EFb016031; Thu, 25 Jan 2018 18:04:14 -0800 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from <hyunk@smtp.xilinx.com>) id 1eetNG-0002mA-7c; Thu, 25 Jan 2018 18:04:14 -0800 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 37E622C693D; Thu, 25 Jan 2018 18:04:14 -0800 (PST) From: Hyun Kwon <hyun.kwon@xilinx.com> To: <dri-devel@lists.freedesktop.org> Subject: [RFC v2 03/10] drm: fourcc: Add drm_format_plane_width_bytes() Date: Thu, 25 Jan 2018 18:04:00 -0800 Message-ID: <1516932247-10750-4-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516932247-10750-1-git-send-email-hyun.kwon@xilinx.com> References: <1516932247-10750-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-23618.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.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(376002)(346002)(396003)(2980300002)(438002)(189003)(199004)(2950100002)(8676002)(106002)(76176011)(305945005)(90966002)(52956003)(316002)(16586007)(2906002)(2351001)(42186006)(54906003)(81156014)(81166006)(6666003)(50226002)(36756003)(5660300001)(8936002)(6266002)(6916009)(63266004)(103686004)(186003)(336011)(47776003)(50466002)(4326008)(106466001)(51416003)(107886003)(478600001)(48376002)(356003)(26005)(39060400002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR02MB3268; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT021; 1:cCBFnPf37O2XzjzTwEHwl0DEEF7PbIWhWYNbBqYsVmu/Dmu81M75OR2o2bEVq5iKA1yiUKNnjMJvpFD95fzpCQCTPzCwKHEDKMFW7fpNqvURPSMzGIAGV8xLaAUewLlN MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c770226-dcc4-4db0-0b77-08d564611acd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BN6PR02MB3268; X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB3268; 3:imGHz5dTs5R+ax29hh4KIG2ie5YbgvpZHOhY4DIKWZFA27GQLr4+osMjL9uPK1QnggawA1zBL+qhBf8zmumtxWgVIKctDGUCw7a6TMLK8n3dcI5mlD3P5UM6PuV0WZaPYPx+8/TY3A0zKc9b/SB+sZL9tMQHKeUwAuSEwQ5MICKjioFQDcrC50k2mcLL+mQ/rlAxGOx4/IxuSS2/gh2aKT2gT0u84cWFpSs6qE4HlWLCGKrVws63pEh8EbmFWt5mjRICxvGhbnUu70KT/RdxWSqWinFucZHSxUKTRGCL57Ezvk5a2DWOvnn/5o1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vsn3fTafQN04fok07mNhWSt2TxZWao2tIrZRN00I3rexf4XSC01QnGUXqbiSTbCyyienej8Enu6XsspiNoYqw4ZXXXqMfijZa/IE4YtKSjfY0PsM35SsqgbYbbDgAeGTQ7iRKaxbYaERx X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: <BN6PR02MB3268857FA735CBA383C30BACD6E00@BN6PR02MB3268.namprd02.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(93006095)(93004095)(3002001)(10201501046)(3231023)(2400081)(944501161)(6055026)(6041288)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:BN6PR02MB3268; BCL:0; PCL:0; RULEID:; SRVR:BN6PR02MB3268; X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB3268; 4:IC1k5Q6ZJb/5tIy/VgmzbMP86+/8U9dS4jXa5D5CuZ52GevjsZwvPre2Yrxzb+Hl6mHr5eelp6STtUIeODE4xr2pFhWw5lfrAR9hOh6mghTrmRlmX9d4qJ5izw7PJlvvTP5JwRf2XoAjD+4ts9UgMyV40R32KT42H/OOVmpEqEPOuXEKxoKyWZXuVXtbriSB2fS9ieNpJ3bfKv976HeoJ5dv0hp5KQ2hCBF5TIGphNGFQWXSeftLt9yUdHbuIxMn5bzEdBmVnyttX8imuo/IiD09rsPtSw1+5lLi6QLBEbcLW5/lixeADd7dpcRMAtAq X-Forefront-PRVS: 05641FD966 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR02MB3268; 23:umDkswjZ/JDNOhrUzjyDJi7+18wuQ5foyqZkM5hm5?= =?us-ascii?Q?F0GB//1302e6R9Zc7qPXTI8iUMGkhTUW3QmtJ8XtoeJn+PI9XqOSZ56fMmDT?= =?us-ascii?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jt6zdXWjOLlqumS4lcll/ndqHCUIXX7CewLYeDNMv1z SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2018 02:04:16.5325 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c770226-dcc4-4db0-0b77-08d564611acd 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.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB3268 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Cc: Hyun Kwon <hyun.kwon@xilinx.com>, Daniel Vetter <daniel.vetter@ffwll.ch>, Emil Velikov <emil.l.velikov@gmail.com>, Michal Simek <michal.simek@xilinx.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index 8fc1e35..2070276 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -376,3 +376,25 @@ int drm_format_plane_height(int height, uint32_t format, int plane) return height / info->vsub; } EXPORT_SYMBOL(drm_format_plane_height); + +/** + * drm_format_plane_width_bytes - bytes of the given width of the plane + * @info: DRM format information + * @plane: plane index + * @width: width to get the number of bytes + * + * Returns: + * The bytes of @width of @plane. + */ +int drm_format_plane_width_bytes(const struct drm_format_info *info, + int plane, int width) +{ + int width_bits; + + if (!info || plane >= info->num_planes) + return 0; + + width_bits = DIV_ROUND_UP(width * info->bpm[plane], info->ppm[plane]); + return DIV_ROUND_UP(width_bits, 8); +} +EXPORT_SYMBOL(drm_format_plane_width_bytes); diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index 64038e9..1eafeb9 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -80,6 +80,8 @@ int drm_format_horz_chroma_subsampling(uint32_t format); int drm_format_vert_chroma_subsampling(uint32_t format); int drm_format_plane_width(int width, uint32_t format, int plane); int drm_format_plane_height(int height, uint32_t format, int plane); +int drm_format_plane_width_bytes(const struct drm_format_info *info, + int plane, int width); const char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf); #endif /* __DRM_FOURCC_H__ */
drm_format_plane_width_bytes() calculates and returns the number of bytes for given width of specified format. The calculation uses the macro pixel information to avoid bit level rounding. Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> --- v2 - This function is added --- --- drivers/gpu/drm/drm_fourcc.c | 22 ++++++++++++++++++++++ include/drm/drm_fourcc.h | 2 ++ 2 files changed, 24 insertions(+)