From patchwork Tue Aug 6 06:31:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 11078249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A700313A4 for ; Tue, 6 Aug 2019 06:32:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9443A2866C for ; Tue, 6 Aug 2019 06:32:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87A4328950; Tue, 6 Aug 2019 06:32:21 +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=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 EBA932875A for ; Tue, 6 Aug 2019 06:32:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1ECA89DA4; Tue, 6 Aug 2019 06:32:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140085.outbound.protection.outlook.com [40.107.14.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id C9E4D89DA4 for ; Tue, 6 Aug 2019 06:32:17 +0000 (UTC) Received: from VI1PR0802CA0011.eurprd08.prod.outlook.com (2603:10a6:800:aa::21) by DB6PR0802MB2598.eurprd08.prod.outlook.com (2603:10a6:4:97::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.12; Tue, 6 Aug 2019 06:32:14 +0000 Received: from VE1EUR03FT049.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::204) by VI1PR0802CA0011.outlook.office365.com (2603:10a6:800:aa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2157.14 via Frontend Transport; Tue, 6 Aug 2019 06:32:14 +0000 Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT049.mail.protection.outlook.com (10.152.19.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.18 via Frontend Transport; Tue, 6 Aug 2019 06:32:12 +0000 Received: ("Tessian outbound 1e6e633a5b56:v26"); Tue, 06 Aug 2019 06:32:08 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1dc7c2af83c44a27 X-CR-MTA-TID: 64aa7808 Received: from 310830fd9a82.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.13.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8BF8C2CC-FDCB-4037-9A17-FEE038CB7D2A.1; Tue, 06 Aug 2019 06:32:02 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04lp2051.outbound.protection.outlook.com [104.47.13.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 310830fd9a82.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Aug 2019 06:32:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oc0fC0e6b3QnpyzaYSvIA0l6pkTXrQn7AudENQv3fJnQRqKZv2IwgZK/HB7sCc/no99L2XFD3QSmsUINTl4y4OznSwOtvXVpxNY7v9scnxkBqvJGRbZ+SHOZBpU2vFD/OpvjqLeq7fiY48LGSxierk9MgGkzuDqtJh1O5i4Xjh3IFymtvLXdP/6nbpVH9X8FotwP2VY4ayuCpJ4hXIaK94Kvwtmy/kK45FcrujOX7KhcphkGLIiPMwElIbNKDXSV3cmpSaHMJLR2n7AwPT4xvFjyeNrNJSFHxqdu21LRsUyeBn8Jv7UFK/LdjykhITxw6Tj6xslbvIuPnGh5D+KW/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o0VVT2eU3D2sKLwNOSEdmVusF+uJxLrn88fc+KWl1XM=; b=RW/gVMqFEU2QOnirD5qSJ6Mu2a18fJ9cL8fp6qoGBUzJphbbDlx9PH+d0p+KdSqSclpv7Yt9tAGESAUnC9UcanjRHQHoSrsTCpwufShmZWg3T3YdvHOpx8v1oThP0q3unKRjBFbIZspSt7qMkERpENQwVvLwvIP4yXqfR5aJq7ieTOgQF3G5RlqIIhojOHp7dX9WGfJDymKLIEa/Pw4y56ONjot5ZI4IDT87KqRIXCP31071WQUN5PXGLWRSGxhMqMGBHniL6YNY0HwyintGHuWhdJagxGaV9UaBJcNRz9TWx7Zk9Tw71oueJ+lFgHV8pM53HfxSgxcUA6wNrpMuSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=arm.com;dmarc=pass action=none header.from=arm.com;dkim=pass header.d=arm.com;arc=none Received: from VI1PR08MB5488.eurprd08.prod.outlook.com (52.133.246.150) by VI1PR08MB3598.eurprd08.prod.outlook.com (20.177.61.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.17; Tue, 6 Aug 2019 06:31:56 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::c091:c28c:bb1a:5236]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::c091:c28c:bb1a:5236%2]) with mapi id 15.20.2136.018; Tue, 6 Aug 2019 06:31:56 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey Subject: [PATCH] drm/komeda: Adds internal bpp computing for arm afbc only format YU08 YU10 Thread-Topic: [PATCH] drm/komeda: Adds internal bpp computing for arm afbc only format YU08 YU10 Thread-Index: AQHVTCCkV8nwhj7hV0i5q+YUMqL9nw== Date: Tue, 6 Aug 2019 06:31:56 +0000 Message-ID: <1565073104-24047-1-git-send-email-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK2PR03CA0057.apcprd03.prod.outlook.com (2603:1096:202:17::27) To VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: f07cf5d7-e295-4c91-714b-08d71a37d0f7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR08MB3598; X-MS-TrafficTypeDiagnostic: VI1PR08MB3598:|DB6PR0802MB2598: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:3826;OLM:3826; x-forefront-prvs: 0121F24F22 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(346002)(366004)(136003)(376002)(39860400002)(396003)(189003)(199004)(25786009)(478600001)(2616005)(476003)(6506007)(6636002)(36756003)(14454004)(66946007)(86362001)(2501003)(4326008)(386003)(316002)(2201001)(81156014)(55236004)(102836004)(50226002)(110136005)(305945005)(7736002)(5660300002)(6512007)(3846002)(71200400001)(14444005)(71190400001)(6116002)(186003)(99286004)(64756008)(6486002)(8936002)(486006)(53936002)(8676002)(66556008)(54906003)(66476007)(66446008)(81166006)(66066001)(68736007)(2906002)(6436002)(52116002)(26005)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3598; H:VI1PR08MB5488.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: I7hIuDbOcBD0Q9CXIyVvVMZFu5rRHlDeuRTEyaEmv74mw3BZLlpu6l1xykmp4/V65UoPygO44lQ1UIGtO5iKi6QHWR4keBI0YTOFiTN3dQZth6kraP00vub0npL7FnLZ4PixZz758+ZWy8Zh9S7XLXI/w16Kkoi+JpgRi4XqlNKEgJ6z87sEmy3SdWYkbVaORMa/MZyjltC1xYPu9FJeTf+zZzwfJjKBTwjMAXT0Hy9Sg/IkbXHAcH+Dz6mxn7gecYyjF7dOSy6xsvlndRzoOMuT8FeG+EAHzqkdqMtXyCSR7pTQxZa67Jd+A/j71iBnt9uM+TZeW1Mjrq5bIatH8wCaIzH21crj47QnLiZ+rlX/jLJK42u8hRPp2NAsc/abn1NZP3egPBQ3Xz2qGJLXAa10urgwWa4Kn4d5jGGRZlI= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3598 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT049.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(396003)(346002)(2980300002)(189003)(199004)(36906005)(54906003)(102836004)(110136005)(8746002)(316002)(99286004)(4326008)(6506007)(386003)(7736002)(305945005)(81166006)(81156014)(22756006)(186003)(26005)(8676002)(6116002)(3846002)(50466002)(2906002)(126002)(476003)(66066001)(14444005)(86362001)(63370400001)(47776003)(76130400001)(63350400001)(486006)(6512007)(25786009)(23756003)(5660300002)(356004)(6486002)(6636002)(36756003)(26826003)(2616005)(336012)(14454004)(2201001)(70206006)(50226002)(2501003)(478600001)(8936002)(70586007); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0802MB2598; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: edba3253-9b86-48e7-2d57-08d71a37c6f8 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(710020)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:DB6PR0802MB2598; NoDisclaimer: True X-Forefront-PRVS: 0121F24F22 X-Microsoft-Antispam-Message-Info: cgTlw7WlwSqge4F/dMxyFI4/KzqRNGGQWcP7VYCRXJS6J6p6S35nriXZryKGlJBknhVZUvSkoqNIB+kVmI9EpzF/7GT1ZI3ITTZq4MM7MQCOQ4c3+wTSdu4T0yjeeG2F0o8a7ORXEdP1quzeqEWP/CpoZ6O7n64VCVBXnORQwe3qthbTqD8zNH7ESqqJvPm+XV286CsdObj8Bca51V/29L75B1x57WafZWHqKktmn1sA7ssjRzfxo7ZIRjWiKFUR1aYBcJXPKBbp+rKOlYlCskNlR3d0qIQSxaiKlUGjRHCPE1Bkwu2dRxH3b9GBFIorPff4kVevmFXIu94nC8GE6xA6wzde68xZk3yS4wx/LgWGvEnxbv8WdZLxjtuh2/8cZkckODPyhRKFz1lk/1Zd/tl5Sun1rDhx00hoXv+Fk14= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2019 06:32:12.6294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f07cf5d7-e295-4c91-714b-08d71a37d0f7 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2598 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o0VVT2eU3D2sKLwNOSEdmVusF+uJxLrn88fc+KWl1XM=; b=lqagpC5wEd8SodC/4g9wFckJBqvXqZbVMRHbCUn+8RBZ4jy8+WObb2aIMQDCKjMSAS6LZV5/i0JhG91N3muel5i2M+uKsCJglCP4p8Hnc7ijVhrM61qySsgiziGNn7VJ94PZkSRFoTSGlGyIkUXdyjYoHCRGfGvng8ADE1BmJ90= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o0VVT2eU3D2sKLwNOSEdmVusF+uJxLrn88fc+KWl1XM=; b=lqagpC5wEd8SodC/4g9wFckJBqvXqZbVMRHbCUn+8RBZ4jy8+WObb2aIMQDCKjMSAS6LZV5/i0JhG91N3muel5i2M+uKsCJglCP4p8Hnc7ijVhrM61qySsgiziGNn7VJ94PZkSRFoTSGlGyIkUXdyjYoHCRGfGvng8ADE1BmJ90= X-Mailman-Original-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=temperror action=none header.from=arm.com; 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: Ayan Halder , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , nd Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Lowry Li (Arm Technology China)" The drm_format_info doesn't have any cpp or block_size (both are zero) information for arm only afbc format YU08/YU10. we need to compute it by ourselves. Changes since v1: 1. Removed redundant warning check in komeda_get_afbc_format_bpp(); 2. Removed a redundant empty line; 3. Rebased the branch. Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/komeda_format_caps.c | 19 +++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_format_caps.h | 3 +++ .../gpu/drm/arm/display/komeda/komeda_framebuffer.c | 5 +++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c index cd4d9f5..c9a1edb 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c @@ -35,6 +35,25 @@ return NULL; } +u32 komeda_get_afbc_format_bpp(const struct drm_format_info *info, u64 modifier) +{ + u32 bpp; + + switch (info->format) { + case DRM_FORMAT_YUV420_8BIT: + bpp = 12; + break; + case DRM_FORMAT_YUV420_10BIT: + bpp = 15; + break; + default: + bpp = info->cpp[0] * 8; + break; + } + + return bpp; +} + /* Two assumptions * 1. RGB always has YTR * 2. Tiled RGB always has SC diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h index 3631910..32273cf 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h @@ -97,6 +97,9 @@ static inline const char *komeda_get_format_name(u32 fourcc, u64 modifier) komeda_get_format_caps(struct komeda_format_caps_table *table, u32 fourcc, u64 modifier); +u32 komeda_get_afbc_format_bpp(const struct drm_format_info *info, + u64 modifier); + u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table, u32 layer_type, u32 *n_fmts); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c index 3b0a70e..1b01a62 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c @@ -43,7 +43,7 @@ static int komeda_fb_create_handle(struct drm_framebuffer *fb, struct drm_framebuffer *fb = &kfb->base; const struct drm_format_info *info = fb->format; struct drm_gem_object *obj; - u32 alignment_w = 0, alignment_h = 0, alignment_header, n_blocks; + u32 alignment_w = 0, alignment_h = 0, alignment_header, n_blocks, bpp; u64 min_size; obj = drm_gem_object_lookup(file, mode_cmd->handles[0]); @@ -88,8 +88,9 @@ static int komeda_fb_create_handle(struct drm_framebuffer *fb, kfb->offset_payload = ALIGN(n_blocks * AFBC_HEADER_SIZE, alignment_header); + bpp = komeda_get_afbc_format_bpp(info, fb->modifier); kfb->afbc_size = kfb->offset_payload + n_blocks * - ALIGN(info->cpp[0] * AFBC_SUPERBLK_PIXELS, + ALIGN(bpp * AFBC_SUPERBLK_PIXELS / 8, AFBC_SUPERBLK_ALIGNMENT); min_size = kfb->afbc_size + fb->offsets[0]; if (min_size > obj->size) {