From patchwork Tue Sep 24 08:00:44 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: 11158207 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F7CA13B1 for ; Tue, 24 Sep 2019 08:01:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5658921655 for ; Tue, 24 Sep 2019 08:01:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5658921655 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 81D8D898A4; Tue, 24 Sep 2019 08:01:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10071.outbound.protection.outlook.com [40.107.1.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2AB1F898A4 for ; Tue, 24 Sep 2019 08:01:01 +0000 (UTC) Received: from VI1PR08CA0115.eurprd08.prod.outlook.com (2603:10a6:800:d4::17) by DB7PR08MB3402.eurprd08.prod.outlook.com (2603:10a6:10:4f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.18; Tue, 24 Sep 2019 08:00:57 +0000 Received: from VE1EUR03FT030.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::201) by VI1PR08CA0115.outlook.office365.com (2603:10a6:800:d4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20 via Frontend Transport; Tue, 24 Sep 2019 08:00:57 +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 VE1EUR03FT030.mail.protection.outlook.com (10.152.18.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20 via Frontend Transport; Tue, 24 Sep 2019 08:00:55 +0000 Received: ("Tessian outbound 968ab6b62146:v31"); Tue, 24 Sep 2019 08:00:51 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a2ba5f72bd12ec55 X-CR-MTA-TID: 64aa7808 Received: from cbd30309ad05.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.14.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 74A75B4E-7C87-40A7-995F-A565BBE71447.1; Tue, 24 Sep 2019 08:00:46 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2051.outbound.protection.outlook.com [104.47.14.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cbd30309ad05.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Tue, 24 Sep 2019 08:00:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ly8vMuIAdhNWnoadUmVGNC8KYN8kalQwH8z3S8tPeR7o/9r7FO5aZ0VJz+y5WKeDtUkH339u6KIzhriLR5EEf69SwaS/T1jBACDXwTxwJPZkctA6l1+fZbq7f5mH46G7yz6XvgH8nqbcLvPava2JrNaB3ksZDX07xJwXC0XBs1FRFixKUkrAoUVQrRGOJlQbelMb+7hkB7cIlPmoAa4gEsbfk3wgZRjrlWAlUxlEHecuopVL4hDMZGpfcsEQiP2CJC/ARIPZ0TG0i1v0oPJhVdbO67M5buSqhqjf7xlkuxPQRtU5zytsN2nBWK8j2RIYQ0ipmmbBQg7K1RxpNFAcjA== 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=mZsp5b9CREF6o15QmOw7iKDF5xz9u0ShN5TG4mS9xYQ=; b=R/GbytrfuNklNs2St73zPS8JQb39VWYW64g0YRtwyt/JlqmG33uL24plhsMYO35Pg6rWzFMvgdOn7xiLzJF16SpkZmHcEGplxSZxMPJfyH3BR2Ype40tf/OIwnb7QcZUHuoLw51IBHVdoJNE05b3cNT3HsmPAUGlVK3OnJdBhZ9+D6pCfjeqTVrTNGe5LvRuiJMCNLW7DqTO/eLoNR8MEgvBKBavwRjCnrlm52mVWpwMdNd3zUpnetPAH1hagDn86z3t/Bg1j9Q4wmeqKPNq9oqvhm6lvG2xspYvmgcIdiHOACLu9c53MPADjNq32rGEiWo6mNrQ/4MphW8A3ivG9g== 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 VI1PR08MB3165.eurprd08.prod.outlook.com (52.133.15.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.18; Tue, 24 Sep 2019 08:00:44 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::d09e:254b:4d3b:456b]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::d09e:254b:4d3b:456b%3]) with mapi id 15.20.2284.023; Tue, 24 Sep 2019 08:00:44 +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 , Mihail Atanassov Subject: [PATCH v2 1/2] drm/komeda: Add line size support Thread-Topic: [PATCH v2 1/2] drm/komeda: Add line size support Thread-Index: AQHVcq4qSU8pTvlChUyRI22n1SYZCA== Date: Tue, 24 Sep 2019 08:00:44 +0000 Message-ID: <20190924080022.19250-2-lowry.li@arm.com> References: <20190924080022.19250-1-lowry.li@arm.com> In-Reply-To: <20190924080022.19250-1-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: HK0PR01CA0022.apcprd01.prod.exchangelabs.com (2603:1096:203:92::34) 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 2.17.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 1c364977-3a79-4df1-a7be-08d740c55420 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VI1PR08MB3165; X-MS-TrafficTypeDiagnostic: VI1PR08MB3165:|VI1PR08MB3165:|DB7PR08MB3402: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:7691;OLM:7691; x-forefront-prvs: 0170DAF08C X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(366004)(346002)(396003)(376002)(39860400002)(136003)(189003)(199004)(186003)(54906003)(81166006)(81156014)(71190400001)(8676002)(4326008)(11346002)(446003)(99286004)(14454004)(110136005)(66066001)(66946007)(66556008)(25786009)(66446008)(76176011)(26005)(486006)(66476007)(478600001)(316002)(64756008)(8936002)(7736002)(52116002)(36756003)(50226002)(476003)(2616005)(5660300002)(6116002)(2201001)(6512007)(86362001)(6436002)(102836004)(3846002)(256004)(6636002)(55236004)(1076003)(2501003)(305945005)(386003)(2906002)(6486002)(71200400001)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3165; 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: N9doEqZTz2A9tgzd+9OPryBH030Mw51WN9jA59+gPk25ZTCp4Nlu9/BJP8N1yosA+cn8erCEz+yEbUtra3jeZTPQjtxO6O3wKHg75zdORaWN1f5PALBkf+X4q8ZQmF4TuRqwXPMU/PitV7Uuvu8VTKQm4LCdBZKx2yLPRUSDoTLDuOYsJGrW9Oy+mn23dSZR+I8D2yp35xeNsVekq8OfS/zBS9bmVGGRGzL/RvqhJSXyNEn4V0s43JTHC5F9Ri7KCEfMNU+oHkklrpMJkKpVDHR9tirvoQZV3JVpet4/SFF8n5f67qHrvizKt57avHHYFOR90+6FNqh/Ke4Jh/Akna+YMZfHJrj2zPImzfD/CiAnq8rag/tYQks5kLzOaUV/d+ev8bQ8Grb22AI5bjWrypeiZCJ01/qTygM/hC0HVgg= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3165 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT030.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)(396003)(136003)(376002)(346002)(39860400002)(199004)(189003)(486006)(476003)(22756006)(126002)(66066001)(6512007)(186003)(8936002)(81156014)(81166006)(4326008)(8676002)(50226002)(6486002)(26826003)(3846002)(50466002)(47776003)(86362001)(478600001)(14454004)(76130400001)(36756003)(8746002)(25786009)(70206006)(102836004)(26005)(386003)(110136005)(54906003)(36906005)(316002)(5660300002)(6636002)(1076003)(356004)(99286004)(336012)(305945005)(6506007)(2201001)(70586007)(7736002)(23756003)(2501003)(2906002)(6116002)(2616005)(76176011)(63350400001)(11346002)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3402; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 8f28dee7-f4e9-48b2-65bb-08d740c54d27 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(710020)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB7PR08MB3402; NoDisclaimer: True X-Forefront-PRVS: 0170DAF08C X-Microsoft-Antispam-Message-Info: h0t6IYLRWSQ/9PNi3lll6gKId4/ULdsqGlW/qP4kZcX+y0zRq4Yhug6X1WyLKhRHs7MJr4Ut4bQ7I88D1dCo47Povb01EP/ge1kIT6oWNiwJzIAHy+YBUAi0HgLVVxhqGeOLy60A38obsuRxKuouJFS8KwLCw8mDNq8l5A5xw1WZgTD1V6/05O4IwYFNkE1jZQuV6/TUoHWiASQ5FqyMvwOAthgSRwzEBdom49iQS5nJLGeNv0u5LKK9RXObcYZax9Go4wh0fzQKu1S/xAxE7WR163+YJHYWOGlx0FVx5x7v2kcmGB1ZyaJqrbQUVrFFEbuVPavIWckmGImP5y4sT7EYFIePJd0E8tUu5IXPpT+TtdJ/xSOMlcO9N/MATTm1PryKT4UD2eNARCPjzyqaY3bA2z9gfQ4WgjDGC5TeldA= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2019 08:00:55.8974 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c364977-3a79-4df1-a7be-08d740c55420 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: DB7PR08MB3402 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=mZsp5b9CREF6o15QmOw7iKDF5xz9u0ShN5TG4mS9xYQ=; b=jOihrVVu7bg/+/wHTfQcvbaih6K0+RR41eLHIjOwNdX8fDxrY/RvfhlVHhZnjYL/y9B7PTJan019TzJ3VAU5OI+QO5ZwotXNlwJipsR8Lzpq8o3igalRpm6hKLHw4bV4L9hHbVYxXT7uqIkCgu9JCmrxXF218uuod2+vCu6wp4k= 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=mZsp5b9CREF6o15QmOw7iKDF5xz9u0ShN5TG4mS9xYQ=; b=jOihrVVu7bg/+/wHTfQcvbaih6K0+RR41eLHIjOwNdX8fDxrY/RvfhlVHhZnjYL/y9B7PTJan019TzJ3VAU5OI+QO5ZwotXNlwJipsR8Lzpq8o3igalRpm6hKLHw4bV4L9hHbVYxXT7uqIkCgu9JCmrxXF218uuod2+vCu6wp4k= 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=none 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" From: "Lowry Li (Arm Technology China)" On D71, we are using the global line size. From D32, every component have a line size register to indicate the fifo size. So this patch is to set line size support and do the line size check. Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: Liviu Dudau Reviewed-by: James Qian Wang (Arm Technology China) --- .../arm/display/komeda/d71/d71_component.c | 57 ++++++++++++++++--- .../gpu/drm/arm/display/komeda/d71/d71_regs.h | 9 +-- .../drm/arm/display/komeda/komeda_pipeline.h | 2 + .../display/komeda/komeda_pipeline_state.c | 17 ++++++ 4 files changed, 70 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c index 7b374a3b911e..357837b9d6ed 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c @@ -106,6 +106,23 @@ static void dump_block_header(struct seq_file *sf, void __iomem *reg) i, hdr.output_ids[i]); } +/* On D71, we are using the global line size. From D32, every component have + * a line size register to indicate the fifo size. + */ +static u32 __get_blk_line_size(struct d71_dev *d71, u32 __iomem *reg, + u32 max_default) +{ + if (!d71->periph_addr) + max_default = malidp_read32(reg, BLK_MAX_LINE_SIZE); + + return max_default; +} + +static u32 get_blk_line_size(struct d71_dev *d71, u32 __iomem *reg) +{ + return __get_blk_line_size(d71, reg, d71->max_line_size); +} + static u32 to_rot_ctrl(u32 rot) { u32 lr_ctrl = 0; @@ -365,7 +382,28 @@ static int d71_layer_init(struct d71_dev *d71, else layer->layer_type = KOMEDA_FMT_SIMPLE_LAYER; - set_range(&layer->hsize_in, 4, d71->max_line_size); + if (!d71->periph_addr) { + /* D32 or newer product */ + layer->line_sz = malidp_read32(reg, BLK_MAX_LINE_SIZE); + layer->yuv_line_sz = L_INFO_YUV_MAX_LINESZ(layer_info); + } else if (d71->max_line_size > 2048) { + /* D71 4K */ + layer->line_sz = d71->max_line_size; + layer->yuv_line_sz = layer->line_sz / 2; + } else { + /* D71 2K */ + if (layer->layer_type == KOMEDA_FMT_RICH_LAYER) { + /* rich layer is 4K configuration */ + layer->line_sz = d71->max_line_size * 2; + layer->yuv_line_sz = layer->line_sz / 2; + } else { + layer->line_sz = d71->max_line_size; + layer->yuv_line_sz = 0; + } + } + + set_range(&layer->hsize_in, 4, layer->line_sz); + set_range(&layer->vsize_in, 4, d71->max_vsize); malidp_write32(reg, LAYER_PALPHA, D71_PALPHA_DEF_MAP); @@ -456,9 +494,11 @@ static int d71_wb_layer_init(struct d71_dev *d71, wb_layer = to_layer(c); wb_layer->layer_type = KOMEDA_FMT_WB_LAYER; + wb_layer->line_sz = get_blk_line_size(d71, reg); + wb_layer->yuv_line_sz = wb_layer->line_sz; - set_range(&wb_layer->hsize_in, D71_MIN_LINE_SIZE, d71->max_line_size); - set_range(&wb_layer->vsize_in, D71_MIN_VERTICAL_SIZE, d71->max_vsize); + set_range(&wb_layer->hsize_in, 64, wb_layer->line_sz); + set_range(&wb_layer->vsize_in, 64, d71->max_vsize); return 0; } @@ -595,8 +635,8 @@ static int d71_compiz_init(struct d71_dev *d71, compiz = to_compiz(c); - set_range(&compiz->hsize, D71_MIN_LINE_SIZE, d71->max_line_size); - set_range(&compiz->vsize, D71_MIN_VERTICAL_SIZE, d71->max_vsize); + set_range(&compiz->hsize, 64, get_blk_line_size(d71, reg)); + set_range(&compiz->vsize, 64, d71->max_vsize); return 0; } @@ -753,7 +793,7 @@ static int d71_scaler_init(struct d71_dev *d71, } scaler = to_scaler(c); - set_range(&scaler->hsize, 4, 2048); + set_range(&scaler->hsize, 4, __get_blk_line_size(d71, reg, 2048)); set_range(&scaler->vsize, 4, 4096); scaler->max_downscaling = 6; scaler->max_upscaling = 64; @@ -862,7 +902,7 @@ static int d71_splitter_init(struct d71_dev *d71, splitter = to_splitter(c); - set_range(&splitter->hsize, 4, d71->max_line_size); + set_range(&splitter->hsize, 4, get_blk_line_size(d71, reg)); set_range(&splitter->vsize, 4, d71->max_vsize); return 0; @@ -933,7 +973,8 @@ static int d71_merger_init(struct d71_dev *d71, merger = to_merger(c); - set_range(&merger->hsize_merged, 4, 4032); + set_range(&merger->hsize_merged, 4, + __get_blk_line_size(d71, reg, 4032)); set_range(&merger->vsize_merged, 4, 4096); return 0; diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h b/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h index 2d5e6d00b42c..1727dc993909 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h @@ -10,6 +10,7 @@ /* Common block registers offset */ #define BLK_BLOCK_INFO 0x000 #define BLK_PIPELINE_INFO 0x004 +#define BLK_MAX_LINE_SIZE 0x008 #define BLK_VALID_INPUT_ID0 0x020 #define BLK_OUTPUT_ID0 0x060 #define BLK_INPUT_ID0 0x080 @@ -321,6 +322,7 @@ #define L_INFO_RF BIT(0) #define L_INFO_CM BIT(1) #define L_INFO_ABUF_SIZE(x) (((x) >> 4) & 0x7) +#define L_INFO_YUV_MAX_LINESZ(x) (((x) >> 16) & 0xFFFF) /* Scaler registers */ #define SC_COEFFTAB 0x0DC @@ -494,13 +496,6 @@ enum d71_blk_type { #define D71_DEFAULT_PREPRETCH_LINE 5 #define D71_BUS_WIDTH_16_BYTES 16 -#define D71_MIN_LINE_SIZE 64 -#define D71_MIN_VERTICAL_SIZE 64 -#define D71_SC_MIN_LIN_SIZE 4 -#define D71_SC_MIN_VERTICAL_SIZE 4 -#define D71_SC_MAX_LIN_SIZE 2048 -#define D71_SC_MAX_VERTICAL_SIZE 4096 - #define D71_SC_MAX_UPSCALING 64 #define D71_SC_MAX_DOWNSCALING 6 #define D71_SC_SPLIT_OVERLAP 8 diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 910d279ae48d..92aba58ce2a5 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -227,6 +227,8 @@ struct komeda_layer { /* accepted h/v input range before rotation */ struct malidp_range hsize_in, vsize_in; u32 layer_type; /* RICH, SIMPLE or WB */ + u32 line_sz; + u32 yuv_line_sz; /* maximum line size for YUV422 and YUV420 */ u32 supported_rots; /* komeda supports layer split which splits a whole image to two parts * left and right and handle them by two individual layer processors diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c index 5526731f5a33..6df442666cfe 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -285,6 +285,7 @@ komeda_layer_check_cfg(struct komeda_layer *layer, struct komeda_data_flow_cfg *dflow) { u32 src_x, src_y, src_w, src_h; + u32 line_sz, max_line_sz; if (!komeda_fb_is_layer_supported(kfb, layer->layer_type, dflow->rot)) return -EINVAL; @@ -314,6 +315,22 @@ komeda_layer_check_cfg(struct komeda_layer *layer, return -EINVAL; } + if (drm_rotation_90_or_270(dflow->rot)) + line_sz = dflow->in_h; + else + line_sz = dflow->in_w; + + if (kfb->base.format->hsub > 1) + max_line_sz = layer->yuv_line_sz; + else + max_line_sz = layer->line_sz; + + if (line_sz > max_line_sz) { + DRM_DEBUG_ATOMIC("Required line_sz: %d exceeds the max size %d\n", + line_sz, max_line_sz); + return -EINVAL; + } + return 0; } From patchwork Tue Sep 24 08:00:49 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: 11158213 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C7F513B1 for ; Tue, 24 Sep 2019 08:01:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 234E021655 for ; Tue, 24 Sep 2019 08:01:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 234E021655 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6FE1089991; Tue, 24 Sep 2019 08:01:12 +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-eopbgr140043.outbound.protection.outlook.com [40.107.14.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id CCB4A8991E for ; Tue, 24 Sep 2019 08:01:10 +0000 (UTC) Received: from VE1PR08CA0025.eurprd08.prod.outlook.com (2603:10a6:803:104::38) by DB6PR0802MB2439.eurprd08.prod.outlook.com (2603:10a6:4:a0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Tue, 24 Sep 2019 08:01:04 +0000 Received: from AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::201) by VE1PR08CA0025.outlook.office365.com (2603:10a6:803:104::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.21 via Frontend Transport; Tue, 24 Sep 2019 08:01:04 +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 AM5EUR03FT063.mail.protection.outlook.com (10.152.16.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.25 via Frontend Transport; Tue, 24 Sep 2019 08:01:02 +0000 Received: ("Tessian outbound 968ab6b62146:v31"); Tue, 24 Sep 2019 08:00:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 43709aea24852b2a X-CR-MTA-TID: 64aa7808 Received: from 5795323429b6.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.0.55]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id D03866E2-2541-4477-A523-3DBB1954CFBA.1; Tue, 24 Sep 2019 08:00:53 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01lp2055.outbound.protection.outlook.com [104.47.0.55]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5795323429b6.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Tue, 24 Sep 2019 08:00:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k48E04jdjUIqICSRAhcpPVAC2A6VvOvk3Etuptg5BpK0r2kGgpoHyk8fRUXQEefa2ZOZFAtwVbtzOpODd2ABofit3hEDxjYTVJOHDkWvIEAwb+1z9WO/f8dgsj5dC17JJEUzxvX1Zf6XhxP1XVaHqqI9R6rlCHvcZyD22PMxT0b3WhhvqZSfgFNtXp1VjSLgtA03tlJuis8s7EPryZIhT3+xJC6Yr9U5yJVty/1L/FQ1EpAS9WQADKndcG9Em1ch51c1c3fW/kq+Q1C6F6xLjdD3yDXspdt6c/VmDK8VT2M5c43/5NvsS926ZFNLlz8pT9m8VooMnrDposliWA6GkA== 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=432SZBl+XgNRowFEJpvuppz3A/j8ZcamL456V3bwWEE=; b=MyMcZOF6faL/3kO0L0z3snuGJwKR3W0bb21wJBMLVUVRLUCIbSLvWasscX9EDgtdIsq1+y17cZ0KlPy3lzVGO1IZqWvPJ6qDPLYmI23TMGamBBINoDwNGSY5NM5NuaOPfARKfjVjG1LTFk4Kc48zTY4CChZ0nhXTPCrA88+ppUxaDaDd80ytTmb8WfKCswvyEC5IIsxPmwXjpTW6NWnoYv+8ljunSMIktzudF124/LXO3aR/6OCRP8v6yyt4o10Iab1uHTQfQZRsv+MH5PMdlGkUEij+Rijj5lD+t1MISW0qsGy86fhb9Wk9P8/5R93oMlFwmYCwsgjSgYg3REEIfw== 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 VI1PR08MB3342.eurprd08.prod.outlook.com (52.134.31.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Tue, 24 Sep 2019 08:00:50 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::d09e:254b:4d3b:456b]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::d09e:254b:4d3b:456b%3]) with mapi id 15.20.2284.023; Tue, 24 Sep 2019 08:00:49 +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 , Mihail Atanassov Subject: [PATCH v2 2/2] drm/komeda: Adds layer horizontal input size limitation check for D71 Thread-Topic: [PATCH v2 2/2] drm/komeda: Adds layer horizontal input size limitation check for D71 Thread-Index: AQHVcq4tpEcv3GJQ1Eqd/4hiDuATxQ== Date: Tue, 24 Sep 2019 08:00:49 +0000 Message-ID: <20190924080022.19250-3-lowry.li@arm.com> References: <20190924080022.19250-1-lowry.li@arm.com> In-Reply-To: <20190924080022.19250-1-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: HK0PR01CA0022.apcprd01.prod.exchangelabs.com (2603:1096:203:92::34) 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 2.17.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 318aa38c-6978-4d93-0a21-08d740c5581c 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)(5600167)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR08MB3342; X-MS-TrafficTypeDiagnostic: VI1PR08MB3342:|VI1PR08MB3342:|DB6PR0802MB2439: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:4941;OLM:4941; x-forefront-prvs: 0170DAF08C X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(366004)(376002)(396003)(39860400002)(189003)(199004)(6116002)(66066001)(1076003)(81166006)(305945005)(71190400001)(14444005)(186003)(71200400001)(2906002)(25786009)(66946007)(52116002)(6512007)(446003)(8676002)(478600001)(64756008)(66556008)(11346002)(316002)(7736002)(386003)(6506007)(476003)(54906003)(2616005)(36756003)(6486002)(76176011)(486006)(66446008)(86362001)(110136005)(5660300002)(66476007)(14454004)(50226002)(6636002)(55236004)(81156014)(3846002)(8936002)(4326008)(2201001)(102836004)(26005)(99286004)(6436002)(256004)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3342; 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: LGXSt/yIp7pcZUvNuKFxRz/srddymqUfYDNiKMCdsqJbPguqeOcHJZqo6LT5LgOFQTSC/Ty5tqxoLlsyS6HAm2Bz0AzTpR8OYyOJSIagYSShocHkdT8z8y1rXJMi/q75aqPe3H3LdSGgaPlF6QQFUbHS1deZ3TbQ6Ar+Eu3VbV9AU7YHqALH8CbD2WzvqaylHkIvcl67Y5macLPUC8RB7DfxsQru/tZm9INWdFBzy1dzPjCUp3gIJ5KwNAm4cLDYPg8zV0fDW4QvUiJynIIqjqhn0HTaDjcWxyrxlNt2qHhpTXJhylJKjn9+4JiLruaBu/OZM+sfuXBJaAgEOJTv4dx/xRguxJzhmSgKIRhv0pNz/0f5cTK8soN0f6deFMEY+JlGL3+frIjqvbBoWQOj+9D93o6R9zf7ysEgnxXy62s= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3342 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT063.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)(376002)(39860400002)(396003)(346002)(136003)(189003)(199004)(14444005)(356004)(7736002)(76176011)(478600001)(86362001)(66066001)(6506007)(386003)(26826003)(36756003)(2201001)(3846002)(6116002)(70206006)(23756003)(70586007)(2501003)(1076003)(5660300002)(47776003)(76130400001)(336012)(11346002)(54906003)(63350400001)(486006)(126002)(6486002)(81156014)(25786009)(14454004)(22756006)(476003)(2616005)(2906002)(81166006)(6636002)(446003)(110136005)(36906005)(4326008)(8746002)(316002)(99286004)(8936002)(50466002)(186003)(6512007)(26005)(50226002)(305945005)(102836004)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0802MB2439; 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: 8d72181d-ab46-4505-75e0-08d740c5504a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(710020)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB6PR0802MB2439; NoDisclaimer: True X-Forefront-PRVS: 0170DAF08C X-Microsoft-Antispam-Message-Info: 9sEmTECTWRGBDtv/oRnCkh95bvFfShaeu8FYGlu4Qyo+iGEN9ipHo13+t63HeQ43yyuiEdY1tdK4e9Nxay/d2UPzHapYw72JZC9RR4vr6QZ3WxJ1emaprjwAgHfgivhmbyxKev+6s/rx7XL5N17zDqI2bS4RB7HS9HWoBVYiqgQKh3RGE2H+Tqy53wb+70CoNBV6pOXrbeX53LhrA+hpaY82huzA12aUsZdRtJ2A9vU+5+9DhEFFuYQajbzCROT6e+qh5eGaN5plNnek9KivUGCAZLvOg/fY4zVXBMy4XHYcAa2SAFyKptg4R5g/m/kTjHKGDMkZMPtxtYIf3s0qtEXg2k2S33nVWcQp9/QCUrXd1y1sZ8KnsCgF/mB8450vnv1lL5rkUavAnKgtu6LZ0Erp01q10mCpX0bbewC80vI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2019 08:01:02.5770 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 318aa38c-6978-4d93-0a21-08d740c5581c 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: DB6PR0802MB2439 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=432SZBl+XgNRowFEJpvuppz3A/j8ZcamL456V3bwWEE=; b=Ml5iZMVDZPxpeMG4PwAMZeC5oP8T0GktvNMruvTgW4ls+BRDdOiaebV2UXH1l9LegkpyS9bb/YZ/1NXAjV1aLz++pVfSXrp1/1jKSmDG1FoMOFgqc9yW/a4ZUxa0C4XpY/UGT5wnHQjmdAUgoml72qY+90ECjYA6RmxaoQXaVdg= 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=432SZBl+XgNRowFEJpvuppz3A/j8ZcamL456V3bwWEE=; b=Ml5iZMVDZPxpeMG4PwAMZeC5oP8T0GktvNMruvTgW4ls+BRDdOiaebV2UXH1l9LegkpyS9bb/YZ/1NXAjV1aLz++pVfSXrp1/1jKSmDG1FoMOFgqc9yW/a4ZUxa0C4XpY/UGT5wnHQjmdAUgoml72qY+90ECjYA6RmxaoQXaVdg= 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=none 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" From: "Lowry Li (Arm Technology China)" Adds maximum line size check according to the AFBC decoder limitation and special Line size limitation(2046) for format: YUV420_10BIT and X0L2. Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: Liviu Dudau --- .../arm/display/komeda/d71/d71_component.c | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c index 357837b9d6ed..6740b8422f11 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c @@ -349,7 +349,56 @@ static void d71_layer_dump(struct komeda_component *c, struct seq_file *sf) seq_printf(sf, "%sAD_V_CROP:\t\t0x%X\n", prefix, v[2]); } +static int d71_layer_validate(struct komeda_component *c, + struct komeda_component_state *state) +{ + struct komeda_layer_state *st = to_layer_st(state); + struct komeda_layer *layer = to_layer(c); + struct drm_plane_state *plane_st; + struct drm_framebuffer *fb; + u32 fourcc, line_sz, max_line_sz; + + plane_st = drm_atomic_get_new_plane_state(state->obj.state, + state->plane); + fb = plane_st->fb; + fourcc = fb->format->format; + + if (drm_rotation_90_or_270(st->rot)) + line_sz = st->vsize - st->afbc_crop_t - st->afbc_crop_b; + else + line_sz = st->hsize - st->afbc_crop_l - st->afbc_crop_r; + + if (fb->modifier) { + if ((fb->modifier & AFBC_FORMAT_MOD_BLOCK_SIZE_MASK) == + AFBC_FORMAT_MOD_BLOCK_SIZE_32x8) + max_line_sz = layer->line_sz; + else + max_line_sz = layer->line_sz / 2; + + if (line_sz > max_line_sz) { + DRM_DEBUG_ATOMIC("afbc request line_sz: %d exceed the max afbc line_sz: %d.\n", + line_sz, max_line_sz); + return -EINVAL; + } + } + + if (fourcc == DRM_FORMAT_YUV420_10BIT && line_sz > 2046 && (st->afbc_crop_l % 4)) { + DRM_DEBUG_ATOMIC("YUV420_10BIT input_hsize: %d exceed the max size 2046.\n", + line_sz); + return -EINVAL; + } + + if (fourcc == DRM_FORMAT_X0L2 && line_sz > 2046 && (st->addr[0] % 16)) { + DRM_DEBUG_ATOMIC("X0L2 input_hsize: %d exceed the max size 2046.\n", + line_sz); + return -EINVAL; + } + + return 0; +} + static const struct komeda_component_funcs d71_layer_funcs = { + .validate = d71_layer_validate, .update = d71_layer_update, .disable = d71_layer_disable, .dump_register = d71_layer_dump,